# Nginx high memory usage in benchmarks

**URL:** <https://www.ruby-forum.com/t/nginx-high-memory-usage-in-benchmarks/170454>\
**Category:** NGINX\
**Created:** [June 17, 2009, 7:26pm UTC](https://www.ruby-forum.com/t/nginx-high-memory-usage-in-benchmarks/170454 "2009-06-17T19:26:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![martinr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/87869e/32.png) [@martinr](https://www.ruby-forum.com/u/martinr)\
**Post date:** [June 17, 2009, 7:26pm UTC](https://www.ruby-forum.com/t/nginx-high-memory-usage-in-benchmarks/170454/1 "2009-06-17T19:26:24Z")

</div>

hello,  
i’ve been running some benchmarks for static content with httperf and  
autobench to compare nginx to apache’s worker mpm. i used the default  
config on apache (2 worker processes, 150 max clients) and set nginx to  
use 2 worker processes with epoll and a keepalive\_timeout of 15.  
during the benchmarks i monitored the systems ressources with sar and  
while i expected nginx to outperform apache in every way possible i  
noticed that nginx uses way more ram than apache while staying ~1/3rd  
behind it in cpu usage.

the benchmarks request a 10k file repeatedly over multiple persistent  
connections and while apache used ~5mb throughout the tests nginx took  
~70mb. can someone explain to me what the cause of this might be. from  
what i read its low memory usage is one of the key features of nginx so  
i’m pretty sure somethings wrong on my side.

martin

---

<div class="post-metadata">

**Author:** ![martinr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/87869e/32.png) [@martinr](https://www.ruby-forum.com/u/martinr)\
**Post date:** [June 17, 2009, 7:35pm UTC](https://www.ruby-forum.com/t/nginx-high-memory-usage-in-benchmarks/170454/2 "2009-06-17T19:35:12Z")

</div>

On Wed, Jun 17, 2009 at 07:16:16PM +0200, Martin R. wrote:

> the benchmarks request a 10k file repeatedly over multiple persistent  
> connections and while apache used ~5mb throughout the tests nginx took  
> ~70mb. can someone explain to me what the cause of this might be. from  
> what i read its low memory usage is one of the key features of nginx so  
> i’m pretty sure somethings wrong on my side.

What nginx version have you tested ?  
How many worker\_connections did you set ?

---

<div class="post-metadata">

**Author:** ![martinr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/87869e/32.png) [@martinr](https://www.ruby-forum.com/u/martinr)\
**Post date:** [June 17, 2009, 8:27pm UTC](https://www.ruby-forum.com/t/nginx-high-memory-usage-in-benchmarks/170454/3 "2009-06-17T20:27:28Z")

</div>

hello igor, i found the culprit. it was the access log. i’m pretty new  
to nginx and i just commented the access\_log option not knowing that i  
had to set it to off to disable it.  
as i was monitoring the whole system’s ram usage i also got the access  
log being written to the filesystem cache. turned it off now and results  
look more promising. thanks for answering.

martin

---

<div class="post-metadata">

**Author:** ![martinr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/87869e/32.png) [@martinr](https://www.ruby-forum.com/u/martinr)\
**Post date:** [June 24, 2009, 6:17am UTC](https://www.ruby-forum.com/t/nginx-high-memory-usage-in-benchmarks/170454/4 "2009-06-24T06:17:37Z")

</div>

Also important to note when doing these benchmarks is whether or not  
you ran the benchmark programs on DIFFERENT machines or the same  
machine as the webservers. If it’s the latter, you will get noise as  
the benchmark programs compete with the webserving programs for  
resources.

– Merlin

2009/6/17 Martin R. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):
