Menu
Home Explore People Places Arts History Plants & Animals Science Life & Culture Technology
On this page
Database-as-IPC
Anti-pattern where a database is used as the message queue for routine interprocess communication

In computer programming, Database-as-IPC may be considered an anti-pattern where a disk persisted table in a database is used as the message queue store for routine inter-process communication (IPC) or subscribed data processing. If database performance is of concern, alternatives include sockets, network socket, or message queue.

British computer scientist, Junade Ali, defined the Database-as-IPC Anti-Pattern as using a database to "schedule jobs or queue up tasks to be completed", noting that this anti-pattern centres around using a database for temporary messages instead of persistent data.

We don't have any images related to Database-as-IPC yet.
We don't have any YouTube videos related to Database-as-IPC yet.
We don't have any PDF documents related to Database-as-IPC yet.
We don't have any Books related to Database-as-IPC yet.
We don't have any archived web articles related to Database-as-IPC yet.

Controversy

The issue arises if there is a performance issue, and if additional systems (and servers) can be justified. In terms of performance, recent advancements in database systems provide more efficient mechanisms for signaling and messaging, and database systems also support memory (non-persisted) tables.

There are databases with built-in notification mechanisms, such as PostgreSQL,23 SQL Server,4 and Oracle.5 These mechanisms and future improvements of database systems can make queuing much more efficient and avoid the need to set up a separate signaling or messaging queue system along with the server and management overhead.

While MySQL doesn't have direct support for notifications,6 some workarounds are possible. However, they would be seen as non-standard and therefore more difficult to maintain.7

See also

  • Inbox and outbox pattern

References

  1. Ali, Junade (September 2016). Mastering PHP Design Patterns. Birmingham, England: Packt Publishing Limited. pp. 45–46. ISBN 978-1-78588-713-0. Retrieved 11 December 2017. 978-1-78588-713-0

  2. [1] Postgresql.org 2020 September 09 https://www.postgresql.org/docs/current/sql-listen.html

  3. [2] Postgresql.org 2020 September 09 https://www.postgresql.org/docs/current/sql-notify.html

  4. [3] Nic Ferrier. 2018 Aug 15 https://stackoverflow.com/questions/51824753/emitting-application-event-like-objects-from-sql-server-with-service-broker-in-n/51866080#51866080

  5. [4] docs.oracle.com. 2020 September 09 https://docs.oracle.com/en/database/oracle/oracle-database/19/jjdbc/continuos-query-notification.html#GUID-4987516F-872F-47D1-B9E7-270A28D50AF8

  6. [5] MariaDB Jira. 2020 September 09 https://jira.mariadb.org/browse/MDEV-16590

  7. 5 subtle ways you’re using MySQL as a queue, and why it’ll bite you Archived 2018-06-12 at the Wayback Machine Schwartz, Baron. 2011 September 14. https://www.engineyard.com/blog/5-subtle-ways-youre-using-mysql-as-a-queue-and-why-itll-bite-you