Help Diagnosing Slow Controller Actions

From: Steven C.
Sent on: Wednesday, June 23, 2010 4:29 PM
I've got an app running on a VPS that has about 2% of it's requests taking way longer than they should (> 1 sec).  These are random instances of requests that normally process fast (max a couple hundred ms).  I've got the production log files, but they aren't giving me much insight into why things are occasionally slow & I was hoping people on this list might be able to suggest next steps to track this down.

The app (http://firstkidbank.com) is running on Passenger and MySQL at railsplayground on a VPS slice with 512mb of RAM that is "burstable" to 1024.  In general, the memory used shows up in VirtualMin at about 400mb.  The machine is running a POSTFIX mail server, ssh, etc, but no other web sites or rails apps.

Looking at a sample of 4919 requests, there are 92 that took over 1 second (1.87%)

Of the 92,
26 spent more than 1 second in the DB
32 spent more than 1 second in the view (no overlap with slow db requests)
31 are redirects to session#new when the :login_required before_filter (from restful_authentication) causes a redirect [These are 3% of the times :login_required fails, the other 97% of the cases where :login_required causes a redirect, it's fast .. like between 1ms and 70 ms]

I don't see any obvious time of day pattern to when slow requests show up (so I don't think it's backup related, but I'm not 100% sure).

It's not a Query optimization problem because:
* I've looked query explains
* ABCController#action will run fast most of the time (e.g. completed in[masked]ms), but have a couple of instances that are 10-50x slower (e.g. 1000 - 10,000 ms)
* we're not dealing with lots of rows (the biggest table in the database is sub-10,000 rows)

My gut is saying that is a VPS / server config issue, but I'm not sure what to do next to get more info.  

Any help out be appreciated!

Thanks,
Steve
_____________________
Steven Chanin
[address removed]
(415)[masked]



Our Sponsors

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy