Why do Databases fail? AntiPatterns to avoid!

Gaurav Sen
Gaurav Sen
115.3 هزار بار بازدید - 6 سال پیش - Databases are often used to
Databases are often used to store various types of information, but one case where it becomes an a problem is when being used as a message broker. The database is rarely designed to deal with messaging features, and hence is a poor substitute of a specialized message queue. When designing a system, this pattern is considered an anti pattern. Here are possible drawbacks: 1) Polling intervals have to be set correctly. Too long makes the system is inefficient. Too short makes the database undergo heavy read load. 2) Read and write operation heavy DB. Usually, they are good at one of the two. 3) Manual delete procedures to be written to remove read messages. 4) Scaling is difficult conceptually and physically. Disadvantages of a Message Queue: 1) Adds more moving parts to the system. 2) Cost of setting up the MQ along with training is large. 3) Maybe be overkill for a small service. In a system design interview, it is important to be able to reason why or why not a system needs a message queue. These reasons allow us to argue on the merits and demerits of the two approaches. However, there are blogs on why Databases are perfectly fine as message queues too. A deep understanding of the pros and cons helps evaluate how effective they would be for a given scenario. In general, for a small application, databases are fine as they bring no additional moving part to the system. For complex message sending requirements, it is useful to have an abstraction such as a message queue handle message delivery for us. Links: http://blog.codepath.com/2012/11/15/asynchronous-processing-in-web-applications-part-1-a-database-is-not-a-queue/ https://softwareengineering.stackexchange.com/questions/231410/why-database-as-queue-so-bad http://mikehadlow.blogspot.com/2012/04/database-as-queue-anti-pattern.html https://www.cloudamqp.com/blog/2015-11-23-why-is-a-database-not-the-right-tool-for-a-queue-based-system.html
6 سال پیش در تاریخ 1397/02/29 منتشر شده است.
115,379 بـار بازدید شده
... بیشتر