# Latency Question

**URL:** <https://www.ruby-forum.com/t/latency-question/150890>\
**Category:** Rails\
**Created:** [October 14, 2008, 7:21pm UTC](https://www.ruby-forum.com/t/latency-question/150890 "2008-10-14T19:21:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![snowbird122](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c68b51/32.png) [@snowbird122](https://www.ruby-forum.com/u/snowbird122)\
**Post date:** [October 14, 2008, 7:21pm UTC](https://www.ruby-forum.com/t/latency-question/150890/1 "2008-10-14T19:21:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![snowbird122](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c68b51/32.png) [@snowbird122](https://www.ruby-forum.com/u/snowbird122)\
**Post date:** [October 14, 2008, 7:25pm UTC](https://www.ruby-forum.com/t/latency-question/150890/2 "2008-10-14T19:25:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![snowbird122](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c68b51/32.png) [@snowbird122](https://www.ruby-forum.com/u/snowbird122)\
**Post date:** [October 14, 2008, 8:16pm UTC](https://www.ruby-forum.com/t/latency-question/150890/3 "2008-10-14T20:16:01Z")

</div>

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](http://localhost:80), I hit Mongrel Cluster directly by  
going to [http://localhost:8000](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

---

<div class="post-metadata">

**Author:** ![snowbird122](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c68b51/32.png) [@snowbird122](https://www.ruby-forum.com/u/snowbird122)\
**Post date:** [October 14, 2008, 10:01pm UTC](https://www.ruby-forum.com/t/latency-question/150890/4 "2008-10-14T22:01:51Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![snowbird122](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c68b51/32.png) [@snowbird122](https://www.ruby-forum.com/u/snowbird122)\
**Post date:** [October 14, 2008, 9:18pm UTC](https://www.ruby-forum.com/t/latency-question/150890/5 "2008-10-14T21:18:20Z")

</div>

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.
