Nginx + Passenger + Rails 3 Rack processes hang
I have a MySQL backed Rails 3 application. I currently have scaling issues with reads on the database and I am working on fixing them independently.
In the meantime, since certain database querie开发者_Python百科s take many minutes to run, Passenger spawns multiple Rack processes (upto the limit specified), but all of them wait / hang waiting for the database.
At a certain point, nginx refuses to accept more connections.
Is there a way I can tell Passenger to timeout its Rails delegated calls and free up resources so it can listen for incoming requests?
Thanks.
If you're handling queries in requests that take many minutes, you're doing it wrong.
Requests should be as fast as possible. Several minutes is unacceptable. Consider off-loading the long-running queries to Delayed::Job, so they can run in the background instead of blocking other requests.
Also, I don't know what query you're running, but if it's taking many minutes you might want consider analyzing them.
精彩评论