# Newbie question about mongrel

**URL:** <https://www.ruby-forum.com/t/newbie-question-about-mongrel/87835>\
**Category:** Deployment\
**Created:** [March 6, 2007, 10:01am UTC](https://www.ruby-forum.com/t/newbie-question-about-mongrel/87835 "2007-03-06T10:01:47Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![pablo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ad7895/32.png) [@pablo](https://www.ruby-forum.com/u/pablo)\
**Post date:** [March 6, 2007, 10:01am UTC](https://www.ruby-forum.com/t/newbie-question-about-mongrel/87835/1 "2007-03-06T10:01:47Z")

</div>

Hello!

At the begining i want to say that i am no expert. I had my deployment  
server configured by my friend. Anyway I am running on VPS on Debian  
Sarge.

I use mongrel & nginx combination.

I have the following problem. It seems to me mongrel needs to kind of  
“warm up”. After somebody enters the site, then the pages load fast for  
everybody, but the first “initial load” sometimes takes to 40 seconds! I  
dont think its connected with nginx, because it happens when i enter  
through nginx or directly at mongrel at some :3000 port. Any ideas? It’s  
really strange for me.

---

<div class="post-metadata">

**Author:** ![pablo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ad7895/32.png) [@pablo](https://www.ruby-forum.com/u/pablo)\
**Post date:** [March 6, 2007, 10:17am UTC](https://www.ruby-forum.com/t/newbie-question-about-mongrel/87835/2 "2007-03-06T10:17:10Z")

</div>

Sounds like it may be slow dynamic rendering rescued by some form of  
caching.  
To test this guess, try to hit the same page twice after restarting  
Mongrel,  
and see if it’s fast the second time.

Alex

---

<div class="post-metadata">

**Author:** ![pablo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ad7895/32.png) [@pablo](https://www.ruby-forum.com/u/pablo)\
**Post date:** [March 6, 2007, 10:26am UTC](https://www.ruby-forum.com/t/newbie-question-about-mongrel/87835/3 "2007-03-06T10:26:38Z")

</div>

Alexey V. wrote:

> Sounds like it may be slow dynamic rendering rescued by some form of  
> caching.  
> To test this guess, try to hit the same page twice after restarting  
> Mongrel,  
> and see if it’s fast the second time.
> 
> Alex

After restart, page loads fast, the first, and the second time. I am  
using mongrel cluster also. Maybe after some time of running it slows  
down and if nobody enters the site the “first load” takes forever.

---

<div class="post-metadata">

**Author:** ![pablo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ad7895/32.png) [@pablo](https://www.ruby-forum.com/u/pablo)\
**Post date:** [March 6, 2007, 2:26pm UTC](https://www.ruby-forum.com/t/newbie-question-about-mongrel/87835/4 "2007-03-06T14:26:03Z")

</div>

Pablo wrote:

> After restart, page loads fast, the first, and the second time. I am  
> using mongrel cluster also. Maybe after some time of running it slows  
> down and if nobody enters the site the “first load” takes forever.

Any chance you’re low on memory and your mongrel process(es) are getting  
swapped out?

–Al Evans

---

<div class="post-metadata">

**Author:** ![pablo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ad7895/32.png) [@pablo](https://www.ruby-forum.com/u/pablo)\
**Post date:** [March 6, 2007, 3:39pm UTC](https://www.ruby-forum.com/t/newbie-question-about-mongrel/87835/5 "2007-03-06T15:39:15Z")

</div>

On 3/6/07, Al Evans [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Any chance you’re low on memory and your mongrel process(es) are getting  
> swapped out?

This would be my second guess, too.

Alex

---

<div class="post-metadata">

**Author:** ![pablo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ad7895/32.png) [@pablo](https://www.ruby-forum.com/u/pablo)\
**Post date:** [March 6, 2007, 3:08pm UTC](https://www.ruby-forum.com/t/newbie-question-about-mongrel/87835/6 "2007-03-06T15:08:09Z")

</div>

On 3/6/07, Pablo [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> “warm up”. After somebody enters the site, then the pages load fast for  
> everybody, but the first “initial load” sometimes takes to 40 seconds! I  
> dont think its connected with nginx, because it happens when i enter  
> through nginx or directly at mongrel at some :3000 port. Any ideas? It’s  
> really strange for me.

You should search the mongrel list for this issue - I no its come up  
before and Zed has commented on it.

- Rob

---

<div class="post-metadata">

**Author:** ![pablo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ad7895/32.png) [@pablo](https://www.ruby-forum.com/u/pablo)\
**Post date:** [March 6, 2007, 6:22pm UTC](https://www.ruby-forum.com/t/newbie-question-about-mongrel/87835/7 "2007-03-06T18:22:59Z")

</div>

In production mode, the first time your app is accessed on each  
instance of mongrel, mongrel loads all the ruby classes it needs (it  
loads them EVERY time in development). The load is what’s slowing down  
the initial hit to each mongrel. After that, the classes are present  
in memory, thus fast hits.

-C

On Mar 6, 6:38 am, “Alexey V.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![pablo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ad7895/32.png) [@pablo](https://www.ruby-forum.com/u/pablo)\
**Post date:** [March 7, 2007, 7:59am UTC](https://www.ruby-forum.com/t/newbie-question-about-mongrel/87835/8 "2007-03-07T07:59:23Z")

</div>

On 3/6/07, cee-dub [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> The load is what’s slowing down  
> the initial hit to each mongrel. After that, the classes are present  
> in memory, thus fast hits.

Quoting Pablo:

> After restart, page loads fast, the first, and the second time. I am  
> using mongrel cluster also. Maybe after some time of running it slows  
> down and if nobody enters the site the “first load” takes forever.

So, it’s not that. Besides, I never saw it taking up to 40 seconds.

Alex
