I run a Ruby on Rails application which isn’t complex; it simply involves users posting images and commenting on them.
I noticed lately I am using a lot more CPU seconds than I used to, even though the number of visitors I get a day is basically the same and most of the changes to the application over time have been trivial. I finally looked at the itemized resources analysis, and while most of it looks normal, it seems like dispatch.fcgi is using large chunks of CPU at once. Here is an excerpt:
2.33 cpu 10748k mem 0 io dispatch.fcgi *
0.04 cpu 10748k mem 0 io dispatch.fcgi *
17.68 cpu 10748k mem 0 io dispatch.fcgi
39.39 cpu 10742k mem 0 io dispatch.fcgi
0.03 cpu 10742k mem 0 io dispatch.fcgi *
1.99 cpu 10742k mem 0 io dispatch.fcgi *
I can’t think of any aspect of my actual application that would cause this. The most CPU-intensive part of the application is presumably thumbnailing, which just calls ImageMagick. There are no indications of problems when I run the application locally or even when I browse the site. I don’t know whether or not CPU seconds translate 1:1 to realtime seconds or not. I do know that php5.cgi always seems to be under 1 second no matter what.
So, uh, is this normal? Just going through the log and adding up numbers, these larger spurts account for about ~300 CPU seconds, which is the vast majority of them considering I’m at ~400 a day. I know 400 CPU seconds isn’t a whole lot, but I’m just thinking ahead to when my site might not be so small. I only get about 250 unique visitors a day at the moment. So, imagine I’m getting a thousand unique visitors a day and that 400 seconds becomes two thousand or roughly 30 CPU minutes.
Am I freaking out over nothing?