Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Identify Bottleneck with Passenger

We are running a big server (12 threads, 6 cores, 64Gb ram, 2 SDDs raid-0) for our rails app deployed with nginx/passenger.

Unfortunately, pages are taken forever to load something like between 10 and 40 seconds. However, the server is under a really light load, with a load average of 0.61 0.56 0.53. We have ram used weirdly, free -ml reporting 57Gb (of 64Gb) usage whereas htop reporting only 4Gb (of 64Gb).

We have checked our production log, and rails request takes something like 100/200ms to be completed, so almost nothing.

How can we identify the bottleneck?

like image 657
Hartator Avatar asked Dec 07 '25 06:12

Hartator


1 Answers

This question is fairly vague, but I'll see if I can give you some pointers.

My first guess is that your app is spending a lot of time doing database related stuff, see below for my advice.

As for the odd memory usage, are you looking at the correct part of the free -ml output? Just to clarify, you want to be looking at the -/+ buffers/cache: line to get the accurate output.

You might also check to see if any of your passenger workers are hanging, as that is a fairly common issue with passenger. You can do this by running strace -p $pid on your passenger workers. If its hanging, it will have an obvious lack of "doing anything"

As for troubleshooting response time within rails itself, I would highly suggest looking into using newrelic(http://newrelic.com/). You can often times see exactly which part of your app is causing the bad response time that way by breaking down how much time is spent in each part of your app. It's a simple gem to install and once you get reporting working, its pretty invaluable for issues like this.

like image 144
Eugene Avatar answered Dec 08 '25 18:12

Eugene