Django: updating the DB asynchronously
I develop a django app where lots of DB updates could/should be deferred to later time.
What would be a good way to update the DB in a background batch job?
One way I could think of is to have a message queue that would contain raw SQL statements.
T开发者_如何学Gohe django app would fill the queue with raw SQLs when the update should be done asynchronously.
A simple background job, (in a different un-related process), would just deqeue and execute the SQL statements it in its own pace..
What do you think?
Celery is often used for this.
Start with this related questions: https://stackoverflow.com/questions/tagged/celery.
I've found this good review about the subject. It recommends Gearman
Seems a lighter solution than Celery.. I think I will give it a try
精彩评论