|
|
|
|
|
by Nican
1199 days ago
|
|
I have been toying with the idea lately of using a transactional database (like SQL) to manage some of the very important queues. Using a transaction to retrieve an item from the queue, and locking the row using "SELECT FOR UPDATE" and "SKIP LOCKED". Such that the row gets locked on read, and several workers can read from the table at the same time. Within the same transaction, other work is done, and everything gets committed to the database as a single atomic operation. CockroachDB (a consensus/raft distributed database) recently added supported for SKIP LOCKED, but I still have yet to work on this idea. |
|