Troubleshooting Long Requests


I’m using Scout to monitor a Rails app of mine. What I’m noticing is
that all of the pages in the site take a fraction of a second to
complete. This is totally acceptable. However, occasionally I’ll have
a request that takes 189 seconds to complete. It’s very consistent. A
request takes a fraction of a second 99% of the time and takes either
189 seconds or 3.5 seconds that last 1% of the time. Naturally, that
1% of the time is when clients, friends, family, etc. are viewing the
site. The actual page that takes 189 or 3.5 seconds to process varies

  • sometimes it is the homepage, sometimes it is something like the
    About Us page.

My server setup is as follows. The server is a quad-core machine with
2GB of RAM running RHEL 5. I’m using Nginx as the proxy and
mongrel_cluster running 15 mongrel instances. Other than that, I’ve
got MySql, Sphix, and backgroundRB runnning. The server is under very
low utilization, only getting a few hundred visitors a day and never
consuming more than 1% of the processor and 50% of the memory.

Does anyone have any ideas on how best to troubleshoot this?


On Oct 24, 8:41 pm, emarthinsen [email protected] wrote:

  • sometimes it is the homepage, sometimes it is something like the

can you reproduce it ? Look at your logs for the times when it has
happened, is there a common pattern in terms of the requests?
(parameters, things all of those requests do, something else?). Are
the requests slow because you’re spending loads of time talking to the
database, the network, something else? Might something else be holding
database locks that block the other pages?