Latency Question


#1

Hello-

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 72.93.100.34 at 2008-10-14
13:04:57) [GET]
Session ID:
BAh7BzoMY3NyZl9pZCIlMTZlODgxMDE1OTVkNDc5MjBjMDkwOTQwNmE2OTky
YmUiCmZsYXNoSUM6J0FjdGlvbkNvbnRyb2xsZXI6OkZsYXNoOjpGbGFzaEhh
c2h7AAY6CkB1c2VkewA=–30d9fb5b1b5000e412e76309060148ecf42d8422
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?

Regards,
Eric


#2

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

BAh7BzoMY3NyZl9pZCIlMTZlODgxMDE1OTVkNDc5MjBjMDkwOTQwNmE2OTky

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.

Fred


#3

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/mongrel.pid
servers: 3

Am I doing anything wrong?

Thanks in advance.

Regards,
Eric


#4

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
running.

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


#5

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
culprit”

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