4 ms·
Rails typically scales via adding processes rather than threads, and you can do concurrency the same way. Rather than ever doing anything blocking in the HTTP
by patio11 16y ago
Rails typically scales via adding processes rather than threads, and you can do concurrency the same way. Rather than ever doing anything blocking in the HTTP request/response protocol, just offload your tasks to worker processes and give your clients the page layout with Javascript ready to poll for the interesting stuff.
This works, is fairly simple to implement, and kicks concurrency to database programmers, who actually understand it.
The only reason I hesitate to give this advice is that substantially all of my downtime can be traced to worker processes either failing silently or going wild and munching my swap until the server died. Productizing the use of them is a little tricky.
Concrete recommendation: I like DelayedJob, Thomas likes the Redis queue.