Browse Prior Art Database

An efficient method for assigning log or queue entries to processing threads in a farmed environment that accesses a remote database Disclosure Number: IPCOM000174388D
Original Publication Date: 2008-Sep-06
Included in the Prior Art Database: 2008-Sep-06
Document File: 2 page(s) / 19K

Publishing Venue



In a host farm, the processing threads running on the hosts don't share main memory. The hosts in a farm are unaware of each other, do not communicate with each other, and operate independently of each other. Often, the only thing of significance that the processing threads share is a database running on a remote database server. We are interested in the case where there is a table in the remote database that is used as a log or a FIFO queue. We want to assign each log or queue entry exclusively to a processing thread, and let the threads process their assigned log/queue entries concurrently. In the event that one of the hosts in the farm crashes, we want threads on surviving hosts to eventually take over processing of the log/queue entries that were assigned to threads running on the failed host.

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 51% of the total text.

Page 1 of 2

An efficient method for assigning log or queue entries to processing threads in a farmed environment that accesses a remote database

Let table Q hold the log or queue entries. To order the log/queue entries in table Q, there is a column SEQ. That column is a 64 bit unsigned integer sequence number that starts at zero. Column SEQ is a unique key of retrieval of the table, so that the entries in the log/queue can be accessed efficiently in increasing time order with a SQL query. It is assumed that 64 bits is sufficient to keep the sequence number from ever wrapping around.

In order to assign the next available sequence number, there is a supporting table S. That table has only one row with only one column. The value of the column is the next available sequence number. When inserting a new row into table Q, the one row in S is retrieved and locked, the value of the next available sequence number column is saved in a program variable, the value of the column incremented by one, and the single row of table S is updated. The new entry in table Q is inserted in the same database transaction that updates table
S. The value of the SEQ column of the new entry in table Q is set from the saved value.

There are two more columns in table Q that are used in assigning entries in Q to processing threads:

The first column, TIMEOUT, holds the current date-time plus the timeout period when the entry is assigned to a processing thread. When the current date-time exceeds the value of TIMEOUT,...