Patent ID: 8417817

Claim:
A method performed by data processing apparatus, the method comprising: placing each request of a plurality of requests into a queue, each request for an image; popping requests from the queue, and for each popped request, in response to popping the request: incrementing a counter value indicating a number of requests being handled; allocating memory for an image satisfying the request and storing the image in the allocated memory; determining that the image specified by the request has been transmitted to a requester of the request and de-allocating the memory for the image in response to the determination; and decrementing the counter value after de-allocating the memory; determining whether the counter value exceeds a first threshold number of requests being handled; in response to determining that the counter value does not exceed the first threshold number of requests being handled, continuing to pop requests from the queue, wherein the first threshold number of requests being handled is based on a maximum amount of memory per request and an amount of available memory; and in response to determining that the counter value exceeds the first threshold number of requests being handled, ceasing to pop requests from the queue until the counter value is decremented to or below the first threshold number, including: determining that the counter value exceeds a second threshold number of requests being handled; in response to determining that the counter value exceeds the second threshold number of requests being handled, discarding a first plurality of requests from the queue, including, for each of the first plurality of requests in the queue: determining a difference between a time stamp of the request and a current time; and if the difference exceeds a threshold difference, discarding the request without allocating computing resources for the request or determining a response for the request, wherein discarding the request includes sending an error message to a device that sent the request.