Patent ID: 8443375

Claim:
A method for passing information about HTTP requests from a web-server worker thread to a logging thread that writes a log to disk, comprising: for the worker thread: allocating a block of memory for storing data-carrying objects; creating a number of data-carrying objects sufficient to fill the block of memory and storing them in the block of memory; creating a stack for holding empty data-carrying objects; inserting into the stack a pointer to each of the data-carrying objects that are stored in the block of memory; creating a queue having a finite capacity to act as a buffer for data-carrying objects to be processed by the logging thread, the queue containing an array, a pointer to the head of the queue and a pointer to the tail of the queue, wherein the head of the queue is the location of the next data-carrying object to be processed by the logging thread and the tail of the queue is the location of last object inserted into the queue; receiving a first HTTP request; retrieving a first data-carrying object from the stack; at least partly populating the first data-carrying object with information based upon the first HTTP request; responding to the first request; determining that a second data-carrying object in the queue has already been processed by the logging thread; moving the second data-carrying object from the queue to the top of the stack; inserting the first data-carrying object into the position in the queue formerly occupied by the second data-carrying object; updating the pointer to the tail of the queue to point to the position in the queue of the first data-carrying object; receiving a second HTTP request; retrieving the second data-carrying object from the stack; at least partly populating the second data-carrying object with information based upon the second HTTP request; responding to the second request; discovering that there is no space available in the queue into which to insert the second data-carrying object; inserting the second data-carrying object back into the stack; retrieving the second data-carrying object from the stack; receiving a third HTTP request; at least partly populating the second data-carrying object retrieved from the stack with information based upon the third HTTP request; and responding to the third request; and providing information related to the first, the second, and the third HTTP request to the logging thread to write the log to disk.