How to get a stack trace in all running ruby ​​flows on a passenger

I have a ruby ​​sinatra application running on nginx / passenger, and I often see requests becoming inexplicably inhibited. I wrote a script to call passenger status on my machine cluster every ten seconds and to display the results on a graph. Here is what I see:

enter image description here

The blue line indicates that the global waiting line is constantly increasing to 60. This is the average value on 4 cars, so when the blue line reaches 60, it means that each machine is maximized. I have a current user_max_pool_size value of 20, so that it reaches 3x the maximum pool size, and then supposedly discards subsequent requests.

My application depends on two key external resources - the Amazon RDS mysql backend and the Redis instance. Perhaps one of them periodically becomes slow or does not respond and thereby causes this behavior?

Can someone advise me how to get the stack trace to see if the bottleneck is here Amazon RDS, Redis or something else?

Thanks!

+6
ruby redis passenger
source share
2 answers

I realized this - I had a SAVE configuration parameter in Redis that shot once a minute. Obviously, redking lock operations for my application are blocked. I change the configuration parameter as "3600 1", that is, I save only one database once per hour, which is normal, because I use it as a cache (data is saved in MYSQL).

+4
source share

To answer your original question, you can get "all stack traces" for the ruby ​​processes that the passenger soars. Basically send a SIGQUIT message to each of them, and they will spit all their backtracks into the apache / nginx log file, for example:

https://gist.github.com/rdp/905759f88134229c2969b9f242188615

0
source share

All Articles