Today I have uploaded Q4M (a Queue for MySQL) 0.6, which is basically a performance-improvement from previous releases. Instead of using pread's and a small user-level cache, Q4M (in default configuration) now uses mmap for reads with a reader/writer lock to improve concurrency.
I also noticed that it would be possible to consume a queued row in one SQL statement.
SELECT * FROM queue_table WHERE queue_wait('queue_table');
This statement actually does the same thing as,
if (SELECT queue_wait('queue_table') == 1) {
SELECT * FROM queue_table;
}
But since the former style requires only one SQL statement (compared to two statements of the second one), it has much less overhead.
And combining these optimizations together, consumption speed of Q4M has nearly doubled from previous post (or trippled from 0.5.1) to over 57,000 rows per second. …
[Read more]