Commit dfa1f3bf by Alexander Makarov

Elaborated on processing data in background in performance tuning guide

parent 905751bd
...@@ -223,10 +223,20 @@ working with AR objects. ...@@ -223,10 +223,20 @@ working with AR objects.
In order to respond to user requests faster you can process heavy parts of the In order to respond to user requests faster you can process heavy parts of the
request later if there's no need for immediate response. request later if there's no need for immediate response.
- Cron jobs + console. There are two common ways to achieve it: cron job processing and specialized queues.
- queues + handlers.
TBD In the first case we need to save data which processing we want to do later to persistent storage
such as database. A [console command](tutorial-console.md) that is run regularly via cron job queries
database and processes data if there's any.
The solution is OK for most cases but has one significant drawback. We aren't aware if there's data to
process before we query database so we're either querying database quite often or have a slight delay
between each data processing.
This issue could be solved by queue and job servers such RabbitMQ, ActiveMQ, Amazon SQS and more.
In this case instead of writing data to persistent storage you're queueing it via APIs provided
by queue or job server. Processing is often put into job handler class. Job from the queue is executed
right after all jobs before it are done.
### If nothing helps ### If nothing helps
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment