What are the best practicing in implement a queuing database?
-
Hello, I am looking into create a database that does the following: - Accepts data, such as a questions for a support system - (Somehow) funnels the pushed data into a processing queue - (Somehow) waits for someone to answer the question - (Somehow) Pops question out of processing queue To answer my "somehowâs" I am thinking the way to do this is as follows - Create a table for unanswered questions - Create a script that will run on a cron-tab every 1-second - - This script will query the Unanswered Questions table of the database - - Collect the last one (FIFO) - - Transaction: Move that data to a Processing Table and send alert to âAnswerers.â - Create another script that the Answerer will call when he answers question So, currently my solution is to use a cron-tab and standalone scripts (such as Python or PHP) to manage the database at every interval. Are there better ways of doing this? Perhaps a way to handle queuing systems within the database itself and not rely on external scripts to run on Cron? My database system will most likely be MySQL running on a RedHat/CentOS system.
-
Answer:
Yes, there are better ways of doing this: use a message queue instead of a database. Examples of message queue systems: http://www.rabbitmq.com/- http://www.rabbitmq.com/ http://activemq.apache.org/ http://gearman.org/ https://github.com/defunkt/resque The "database as queue" is commonly identified as an anti-pattern. https://blog.engineyard.com/2011/5-subtle-ways-youre-using-mysql-as-a-queue-and-why-itll-bite-you http://mikehadlow.blogspot.com/2012/04/database-as-queue-anti-pattern.html
Bill Karwin at Quora Visit the source
Related Q & A:
- What is the best way to calculate a date difference?Best solution by Stack Overflow
- What's the best way to get a job in a restaurant?Best solution by Yahoo! Answers
- What's the best way to make a good impression at a job interview?Best solution by Yahoo! Answers
- What are the best ways to find a job with a social entrepreneurial company?Best solution by answers.yahoo.com
- What is the best way to negotiate a salary for a new position?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.