We are building an ajax application in which a users input is submitted for processing to a php script. We are currently writing every request to a log file for tracking. I would like to move this tracking into a database table but I do not want to run a insert statement after request. What I would like to do is set up a ‘queue’ of transactions (inserts and updates) that need to be processed on the MySQL database. I would then set up a cron job or process to check and process the transactions in the queue. Is there something out there that we could build upon or do we have to just write to plain ol’ text log files and process them?
Share
You want Gearman – it’ll queue the requests and insert them as and when the database is ready for them, so you don’t overload your DB server.
There’s a recent (and quality) post about using databases for logging here, which (summarised) says:
HighScalability write up on Gearman.
If you really want to avoid this, you could write the raw SQL statements to a file and process them with this cronjob: