# Reducing Memory Footprint of Mongrel Handlers

**URL:** <https://www.ruby-forum.com/t/reducing-memory-footprint-of-mongrel-handlers/164488>\
**Category:** Mongrel\
**Created:** [April 1, 2009, 9:16pm UTC](https://www.ruby-forum.com/t/reducing-memory-footprint-of-mongrel-handlers/164488 "2009-04-01T21:16:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Asif\_A](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/858c86/32.png) [@Asif\_A](https://www.ruby-forum.com/u/Asif_A)\
**Post date:** [April 1, 2009, 9:16pm UTC](https://www.ruby-forum.com/t/reducing-memory-footprint-of-mongrel-handlers/164488/1 "2009-04-01T21:16:23Z")

</div>

Dear Members,  
Mongrel Handlers seem to take up about 110 MB for each instance and  
sometimes upto 20% cpu usage on an 8 core system…

Though this has a lot to do with the application, any suggestions for  
improvement at the software stack level? [especially for the RAM?]

regards

Asif A.

---

<div class="post-metadata">

**Author:** ![Asif\_A](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/858c86/32.png) [@Asif\_A](https://www.ruby-forum.com/u/Asif_A)\
**Post date:** [April 2, 2009, 3:51am UTC](https://www.ruby-forum.com/t/reducing-memory-footprint-of-mongrel-handlers/164488/2 "2009-04-02T03:51:15Z")

</div>

Asif A. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Dear Members,  
> Mongrel Handlers seem to take up about 110 MB for each instance and  
> sometimes upto 20% cpu usage on an 8 core system..

> Though this has a lot to do with the application, any suggestions for  
> improvement at the software stack level? [especially for the RAM?]

Avoid slurping. Don’t read large files into memory all at once,  
LIMIT all your SELECT statements. That’s the biggest problem  
I see in all sorts of apps.

Other than that there could be a lot of app specific things…  
Go by process of elimination and figure out where/when/if memory  
jumps are taking place and even rip out chunks of code  
that are suspect 🙂

---

<div class="post-metadata">

**Author:** ![Asif\_A](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/858c86/32.png) [@Asif\_A](https://www.ruby-forum.com/u/Asif_A)\
**Post date:** [April 2, 2009, 9:42am UTC](https://www.ruby-forum.com/t/reducing-memory-footprint-of-mongrel-handlers/164488/3 "2009-04-02T09:42:13Z")

</div>

Eric,

Thank you for those suggestions. We are reviewing those select  
statements…again.

But do some patches [like the forking patch] help?

Asif A.

---

<div class="post-metadata">

**Author:** ![Asif\_A](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/858c86/32.png) [@Asif\_A](https://www.ruby-forum.com/u/Asif_A)\
**Post date:** [April 2, 2009, 2:05pm UTC](https://www.ruby-forum.com/t/reducing-memory-footprint-of-mongrel-handlers/164488/4 "2009-04-02T14:05:12Z")

</div>

Nope, that looks about normal, based on my experience. Our app would  
consume 80Mb once mongrel had started, and would jump to well over  
120Mb after serving a request.

---

<div class="post-metadata">

**Author:** ![Asif\_A](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/858c86/32.png) [@Asif\_A](https://www.ruby-forum.com/u/Asif_A)\
**Post date:** [April 4, 2009, 7:48am UTC](https://www.ruby-forum.com/t/reducing-memory-footprint-of-mongrel-handlers/164488/5 "2009-04-04T07:48:48Z")

</div>

Asif A. wrote:

> Dear Members,  
> Mongrel Handlers seem to take up about 110 MB for each instance and  
> sometimes upto 20% cpu usage on an 8 core system..
> 
> Though this has a lot to do with the application, any suggestions for  
> improvement at the software stack level? [especially for the RAM?]

try the MBARI patches, if you’re using 1.8.x  
Cheers!  
-=r
