1. A method in a computer system for servicing requests from multiple client computers, the method comprising: receiving a request from a client computer to perform a multi-state function; performing a first task, by a first work handler invoked by a first thread in a ready state, wherein the first task is associated with a first state of the multi-state function, and performing the first task includes issuing an asynchronous request for data to a database manager; storing the data in an input queue; placing the first thread back in the ready state; receiving the data specified in the asynchronous request; performing a second task, by a second work handler invoked by a second thread in the ready state, wherein the second task is associated with a second state of the multi-state function, and the second task performs an operation on the data and generates a result; storing the result in a results queue distinct from the input queue; determining whether the result is larger than a threshold; if the result is not larger than the threshold, then storing the result in a partial result cache and attempting to close a database connection; and if the result is larger than the threshold, then storing the result in a partial result cache and maintaining the database connection.