Latency Question



I built a rails app and all of a sudden its performance has plumeted.
There’s no specific culprit I have been able to find in my code.
Here’s a sample line from my log file:

Processing PagesController#faq (for at 2008-10-14
13:04:57) [GET]
Session ID:
Parameters: {“action”=>“faq”, “controller”=>“pages”}
Rendering template within layouts/application
Rendering pages/faq
Completed in 8.29165 (0 reqs/sec) | Rendering: 7.91346 (95%) | DB:
0.00000 (0%) | 200 OK

From this, it looks like it’s struggling to render the page. The DB%
is at zero, so the usual culprit doesn’t seem to apply.

Here’s my server setup:

Fedora 9
MySql 5.0.51a
nginx 0.6.23
mongrel 1.1.5
mongrel_cluster (running 2 instances of mongrel in the cluster)

The site does use haml, which I know to be a little slower to render,
but still, 8 seconds to render a page seems like an excessive amount
of time.

I’m not even sure where to start troubleshooting this one. Does anyone
have any ideas? Has anyone seen something like this before?



On 14 Oct 2008, at 18:20, emarthinsen wrote:


Use ruby-prof. At least at one point in the past if you did queries
(or caused queries to be done) from the view then that would count as
time spent rendering so this could still be a db problem.



Thanks for the advice. I installed it on our test machine and fired up
Mongrel on port 3000 to do some testing. I did not use nginx or
Mongrel Cluster. It was much faster. I then fired up nginx and Mongrel
Cluster again. The site speed returned to a crawl. Then, instead of
pointing to http://localhost:80, I hit Mongrel Cluster directly by
going to http://localhost:8000 and experienced the same slowness.
Unless someone can point out a flaw in my testing methodology (and
there is likely to be a flaw), then I think it looks like Mongrel
Cluster is the problem, but it just spawns Mongrel instances, so
perhaps Mongrel is the culprit.

Has anyone had performance issues with Mongrel. Here’s my
mongrel_cluster.yml file:

environment: production
log_file: log/mongrel.log
port: 8000
pid_file: tmp/pids/
servers: 3

Am I doing anything wrong?

Thanks in advance.



For the most recent batch of tests, I just tested from the local
machine. I wanted to take network latency out of the question. Plus, I
didn’t want to monkey with my firewall settings. What I meant in that
statement is that Mongrel Cluster is inlikely to be a problem itself
as all it does is launch Mongrel processes. It isn’t much of a
resource-consumer itself. I do, indeed, just have three instances

Do you think I’d get significant information testing from a outside


Just so I understand the test box and your browser is on the same
machine? Did you test this from a outside ip too?

Your config’s look correct. What do you mean by this statement:

“but it just spawns Mongrel instances, so perhaps Mongrel is the

With your config you should have only three mongrel processes running
on ports 8000-8002.