|
|
|
|
|
by hbrn
1361 days ago
|
|
A controversial, but a very pragmatic take. Queues are great for semi-infinite scalability, but you rarely need it. There's numerous subtle benefits to using db compared to regular message queues that are often overlooked. Being able to delete, reorder, or edit specific messages can be a lifesaver when things go wrong. Most common issue with queue-based systems is getting overwhelmed with messages. Either your consumers went down. Or your producers had a bug / executed too frequently. Being able to recover with a simple SQL query is a blessing. |
|
1. Huge number of messages from test system were accidentally inserted into production.
Queue solution: disable consumers, move messages to a temporary queue while filtering them, move messages back to the old queue, enable consumers
DB solution: just delete rogue messages
2. We want to store some of the messages, but we're not ready to process them yet
Queue solution: create a separate queue for each message type, insert messages to different queues, manually move them when you're ready to process them (and keep in mind that not every queue can persist messages forever, SQS for example can't hold messages longer than 14 days)
DB solution: just skip those messages while processing
3. Consumers went down and the queue now contains a big number of duplicate messages. While it was fine to just wait a couple hours to let it stabilize, a whale customer started complaining
Queue solution: none (any hacky solution would take longer than it takes for the system to naturally stabilize)
DB solution: move whale customer messages to the front of the queue