Code rant: The Database As Queue Anti-Pattern
mikehadlow.blogspot.se
Code rant: The Database As Queue Anti-Pattern
1–10 of 15 posts
Re: Code rant: The Database As Queue Anti-Pattern
#2A full blown message queue system is often overkill; it adds another system that you have to learn. (And frankly, queues are often backed by databases anyway)
That said, it's best to avoid having application state in the queue, it should be generic. This makes it more scalable and flexible.
Re: Code rant: The Database As Queue Anti-Pattern
#3Using databases as a queue is not an anti-pattern (delayed_job is an example). A full blown message queue system is often overkill; it adds another system that you have to learn. (And frankly, queues are often backed by databases anyway) That said, it's best to avoid having application state in the queue, it should be generic. This makes it more scalable and flexible.
Edit: Just don't pole the 'finished' status as that can have a lot of elements in it.
Re: Code rant: The Database As Queue Anti-Pattern
#4Re: Code rant: The Database As Queue Anti-Pattern
#5Using databases as a queue is not an anti-pattern (delayed_job is an example). A full blown message queue system is often overkill; it adds another system that you have to learn. (And frankly, queues are often backed by databases anyway) That said, it's best to avoid having application state in the queue, it should be generic. This makes it more scalable and flexible.
Also, if your using the DB as a queue index on the status element. Inserts are still low overhead and the DB can handle poling that table 10,000 time a second without issue. Edit: Just don't pole the 'finished' status as that can have a lot of elements in it.
Re: Code rant: The Database As Queue Anti-Pattern
#6Re: Code rant: The Database As Queue Anti-Pattern
#7Re: Code rant: The Database As Queue Anti-Pattern
#8A lot of that post is specific to SQL Server. I used a MySQL table as a queue as part of Signal Spam ( https://www.signal-spam.fr/ ) and it worked flawlessly. Polling was at 1 minute intervals and queue entries that were completed were simply deleted.
It isn't nearly the anti-pattern, at least for many loads, in an MVCC database engine.
Re: Code rant: The Database As Queue Anti-Pattern
#9We're looking to create working solutions, not works of art. Seeking the perfect component for every piece is often simply not worthwhile.