# Nginx 1.2.0 is slower than 1.1.12?

**URL:** <https://www.ruby-forum.com/t/nginx-1-2-0-is-slower-than-1-1-12/219275>\
**Category:** NGINX\
**Created:** [April 26, 2012, 11:51am UTC](https://www.ruby-forum.com/t/nginx-1-2-0-is-slower-than-1-1-12/219275 "2012-04-26T11:51:50Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [April 26, 2012, 11:51am UTC](https://www.ruby-forum.com/t/nginx-1-2-0-is-slower-than-1-1-12/219275/1 "2012-04-26T11:51:50Z")

</div>

Hi,

I did a simple load test for 1.2 and found that 1.2 is slower than  
1.1.12 ?

client—nginx(1.2/.1.12)----nginx(1.1.12)  
The tested nginx worked as a reverse proxy before another nginx box  
which serve static file, upstream keepalive is not enbaled.

```
Same test suite , the only difference is the version of nginx.

```

1.2.0 is about 30% slower .

BR,  
DeltaY

---

<div class="post-metadata">

**Author:** ![Delta\_Y](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f9ae1b/32.png) [@Delta\_Y](https://www.ruby-forum.com/u/Delta_Y)\
**Post date:** [April 26, 2012, 12:36pm UTC](https://www.ruby-forum.com/t/nginx-1-2-0-is-slower-than-1-1-12/219275/2 "2012-04-26T12:36:30Z")

</div>

On Thursday 26 April 2012 13:50:40 Delta Y. wrote:

> 1.2.0 is about 30% slower .

Can you provide more details about how you tested it and what test suite  
you  
used?

Personally, I found that some test suites are actually can perform  
slower than  
nginx and produce incorrect results (e.g. disable logging decrease RPS).

wbr, Valentin V. Bartenev

---

<div class="post-metadata">

**Author:** ![Delta\_Y](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f9ae1b/32.png) [@Delta\_Y](https://www.ruby-forum.com/u/Delta_Y)\
**Post date:** [April 26, 2012, 4:08pm UTC](https://www.ruby-forum.com/t/nginx-1-2-0-is-slower-than-1-1-12/219275/3 "2012-04-26T16:08:53Z")

</div>

I use jemeter to get a static file and observe the request per second.  
For nginx 1.2, I observe the result output stuck for a second ,then  
decrease.  
After 2 or 3 times of such stuck, the result become stable.

在 2012年4月26日 下午6:35，Valentin V. Bartenev [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 写道：

---

<div class="post-metadata">

**Author:** ![Delta\_Y](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f9ae1b/32.png) [@Delta\_Y](https://www.ruby-forum.com/u/Delta_Y)\
**Post date:** [April 27, 2012, 9:13am UTC](https://www.ruby-forum.com/t/nginx-1-2-0-is-slower-than-1-1-12/219275/4 "2012-04-27T09:13:17Z")

</div>

I use loadrunner, and although get the conclusion:1.2.0 is slower than  
1.1.12  
I observe connect timeout error in loadrunner console, but I didn’t see  
such  
error in 1.1.12.

For 1.2.0 , the rps line dive to very lower every 15-20 seconds, I  
think  
it because connect to nginx timeout .

I test 1.1.17 , the result is almost the same as 1.1.12.  
I then test 1.1.19 , the result is like 1.2.0,

So what happened between 1.1.17 and 1.1.19 will result the connection  
timeout every 15-20 seconds?

在 2012年4月26日 下午10:26，Valentin V. Bartenev [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 写道：

---

<div class="post-metadata">

**Author:** ![Delta\_Y](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f9ae1b/32.png) [@Delta\_Y](https://www.ruby-forum.com/u/Delta_Y)\
**Post date:** [April 27, 2012, 10:09am UTC](https://www.ruby-forum.com/t/nginx-1-2-0-is-slower-than-1-1-12/219275/5 "2012-04-27T10:09:05Z")

</div>

On 27.04.2012, at 11:12, Delta Y. wrote:

> So what happened between 1.1.17 and 1.1.19 will result the connection  
> timeout every 15-20 seconds?

Could you show your config? And what OS are you using?

---

<div class="post-metadata">

**Author:** ![Delta\_Y](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f9ae1b/32.png) [@Delta\_Y](https://www.ruby-forum.com/u/Delta_Y)\
**Post date:** [April 26, 2012, 4:27pm UTC](https://www.ruby-forum.com/t/nginx-1-2-0-is-slower-than-1-1-12/219275/6 "2012-04-26T16:27:28Z")

</div>

On Thursday 26 April 2012 18:07:48 Delta Y. wrote:

> I use jemeter to get a static file and observe the request per second.  
> For nginx 1.2, I observe the result output stuck for a second ,then  
> decrease. After 2 or 3 times of such stuck, the result become stable.

Can you reproduce it with other benchmarking tools (httperf, siege)?  
Do you run it on the same host or from several dedicated machines?

I assume that you’re benchmarking JMeter itself.

wbr, Valentin V. Bartenev

---

<div class="post-metadata">

**Author:** ![Delta\_Y](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f9ae1b/32.png) [@Delta\_Y](https://www.ruby-forum.com/u/Delta_Y)\
**Post date:** [April 27, 2012, 10:43am UTC](https://www.ruby-forum.com/t/nginx-1-2-0-is-slower-than-1-1-12/219275/7 "2012-04-27T10:43:45Z")

</div>

The loadrunner output of 1.1.19 is attached, there are many connection  
timeout error reported by loadrunner.

My latest test show that 1.1.18 is OK , so changes between 1.1.18 and  
1.1.19  
make things worse in my test lab.

the os is debian squeeze 32bit, the config is :

user root root;  
worker\_rlimit\_nofile 81920;  
worker\_processes 2;  
pid /secone/var/run/nginx.pid;  
error\_log /dev/null error;  
pcre\_jit on;  
events {  
use epoll;  
worker\_connections 12000;  
multi\_accept on;  
accept\_mutex off;  
}  
http {  
include mime.types;  
default\_type application/octet-stream;  
sendfile on;  
tcp\_nopush on;  
reset\_timedout\_connection on;  
ignore\_invalid\_headers on;  
underscores\_in\_headers on;  
proxy\_buffering on;  
proxy\_ignore\_client\_abort on;  
proxy\_intercept\_errors on;  
client\_header\_buffer\_size 16k;  
large\_client\_header\_buffers 4 16k;  
msie\_padding off;  
msie\_refresh off;  
access\_log off;

upstream upstream\_www {  
server 192.168.2.3:80 max\_fails=0 ;  
server 192.168.2.4:80 max\_fails=0 ;  
server 192.168.2.5:80 max\_fails=0 ;  
server 192.168.2.6:80 max\_fails=0 ;  
}  
upstream upstream\_www2 {  
server 192.168.2.254:80 max\_fails=0 ;  
}

server {

```
listen 192.168.1.1:80 ;
server_name _;
proxy_set_header Host $http_host;
location / {
  proxy_pass http://upstream_www2;
  proxy_redirect default;
}

```

}

server {

```
client_header_timeout 60;
client_body_timeout 120;
client_max_body_size 100m;
client_header_buffer_size 16k;
large_client_header_buffers 4 16k;
proxy_buffer_size 16k;
proxy_buffers 4 16k;
listen 192.168.1.1:80 ;
server_name www.test.com;

ssl off;
keepalive_timeout 0;
proxy_cache_key $scheme$host$request_uri;

location / {
  proxy_set_header Accept-Encoding identity;
  proxy_set_header Host $http_host;
  proxy_next_upstream error timeout http_500 http_502 http_503 

```

http\_504;  
proxy\_cache off;  
proxy\_pass http://upstream\_www;  
}  
}

}

在 2012年4月27日 下午4:08，Sergey B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 写道：

---

<div class="post-metadata">

**Author:** ![Delta\_Y](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f9ae1b/32.png) [@Delta\_Y](https://www.ruby-forum.com/u/Delta_Y)\
**Post date:** [April 27, 2012, 12:57pm UTC](https://www.ruby-forum.com/t/nginx-1-2-0-is-slower-than-1-1-12/219275/8 "2012-04-27T12:57:44Z")

</div>

Hello!

On Fri, Apr 27, 2012 at 06:51:04PM +0800, Delta Y. wrote:

> After revert svn r4577 of 1.2.0 , I get almost the same benchmark  
> result with 1.2.0 and 1.1.17.
> 
> So it seems r4577 descrease nginx 1.2.0 performance by 30-40%( a lot  
> of connect timeout reported by loadrunner) in my test lab.
> 
> nginx box OS is debian squeeze 32bit, CPU is intel core2 .

Which compiler do you use? Which compiler flags used during  
compilation?

Maxim D.

---

<div class="post-metadata">

**Author:** ![Delta\_Y](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f9ae1b/32.png) [@Delta\_Y](https://www.ruby-forum.com/u/Delta_Y)\
**Post date:** [April 27, 2012, 12:52pm UTC](https://www.ruby-forum.com/t/nginx-1-2-0-is-slower-than-1-1-12/219275/9 "2012-04-27T12:52:08Z")

</div>

After revert svn r4577 of 1.2.0 , I get almost the same benchmark  
result with 1.2.0 and 1.1.17.

So it seems r4577 descrease nginx 1.2.0 performance by 30-40%( a lot  
of connect timeout reported by loadrunner) in my test lab.

nginx box OS is debian squeeze 32bit, CPU is intel core2 .

在 2012年4月27日 下午4:43，Delta Y. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 写道：

---

<div class="post-metadata">

**Author:** ![Delta\_Y](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f9ae1b/32.png) [@Delta\_Y](https://www.ruby-forum.com/u/Delta_Y)\
**Post date:** [April 27, 2012, 1:07pm UTC](https://www.ruby-forum.com/t/nginx-1-2-0-is-slower-than-1-1-12/219275/10 "2012-04-27T13:07:02Z")

</div>

Using built-in specs.  
Target: i486-linux-gnu  
Configured with: …/src/configure -v --with-pkgversion=‘Debian  
4.3.5-4’ --with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs  
–enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr  
–enable-shared --enable-multiarch --enable-linker-build-id  
–with-system-zlib --libexecdir=/usr/lib --without-included-gettext  
–enable-threads=posix --enable-nls  
–with-gxx-include-dir=/usr/include/c++/4.3 --program-suffix=-4.3  
–enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc  
–enable-mpfr --enable-targets=all --with-tune=generic  
–enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu  
–target=i486-linux-gnu  
Thread model: posix  
gcc version 4.3.5 (Debian 4.3.5-4)

./nginx -V  
nginx version: nginx/2.1.2.0  
built by gcc 4.3.5 (Debian 4.3.5-4)  
TLS SNI support enabled  
configure arguments: --prefix=/usr/local/nginx --pid-path=/var  
–with-cpu-opt=pentium4 --with-ipv6 --with-pcre=/usr/local/pcre  
–with-pcre-jit --without-http\_autoindex\_module  
–without-http\_ssi\_module --without-http\_referer\_module  
–without-http\_userid\_module --without-http\_empty\_gif\_module  
–without-http\_limit\_req\_module --without-http\_browser\_module  
–without-http\_memcached\_module --without-http\_charset\_module  
–without-http\_split\_clients\_module --with-http\_stub\_status\_module  
–with-http\_ssl\_module --with-http\_realip\_module  
–with-http\_sub\_module --with-http\_geoip\_module -

在 2012年4月27日 下午6:57，Maxim D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 写道：

---

<div class="post-metadata">

**Author:** ![Delta\_Y](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f9ae1b/32.png) [@Delta\_Y](https://www.ruby-forum.com/u/Delta_Y)\
**Post date:** [April 27, 2012, 2:23pm UTC](https://www.ruby-forum.com/t/nginx-1-2-0-is-slower-than-1-1-12/219275/11 "2012-04-27T14:23:16Z")

</div>

Hello!

On Fri, Apr 27, 2012 at 07:06:02PM +0800, Delta Y. wrote:

> –enable-mpfr --enable-targets=all --with-tune=generic  
> –enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu  
> –target=i486-linux-gnu  
> Thread model: posix  
> gcc version 4.3.5 (Debian 4.3.5-4)
> 
> ./nginx -V  
> nginx version: nginx/2.1.2.0

This doesn’t looks like vanilla nginx. Could you please test  
vanilla one, without any patches?

> –with-http\_ssl\_module --with-http\_realip\_module  
> –with-http\_sub\_module --with-http\_geoip\_module -

The output looks truncated (note trailing “-”), is it?

In any case, please provide sample of an actual gcc command as  
used during compilation of nginx object files, it may contain  
various flags not visible in “nginx -V” output.

Maxim D.

---

<div class="post-metadata">

**Author:** ![Delta\_Y](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f9ae1b/32.png) [@Delta\_Y](https://www.ruby-forum.com/u/Delta_Y)\
**Post date:** [April 27, 2012, 3:09pm UTC](https://www.ruby-forum.com/t/nginx-1-2-0-is-slower-than-1-1-12/219275/12 "2012-04-27T15:09:46Z")

</div>

在 2012年4月27日 下午8:22，Maxim D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 写道：

> > –with-system-zlib --libexecdir=/usr/lib --without-included-gettext
> > 
> > ./nginx -V  
> > nginx version: nginx/2.1.2.0
> 
> This doesn’t looks like vanilla nginx. Could you please test  
> vanilla one, without any patches?

It’s an openresty like nginx bundle ,consist of modules for reverse  
proxy only.  
No thirdparty patch applied except the one “proxy\_bind support  
variable”.  
Maxim, I remember it is from you, 🙂

The major 2 in version string means upstream keepalive feaure only .

> > –with-http\_ssl\_module --with-http\_realip\_module  
> > –with-http\_sub\_module --with-http\_geoip\_module -
> 
> The output looks truncated (note trailing “-”), is it?
> 
> In any case, please provide sample of an actual gcc command as  
> used during compilation of nginx object files, it may contain  
> various flags not visible in “nginx -V” output.

The shell script to build nginx is :

DEPLOY\_TARGET=“/home/ngxproxy”  
INSTALL\_DIR=“/home/ngxproxy”

# tell nginx’s build system where to find lua:

#export LUA\_LIB=/usr/local/lib  
#export LUA\_INC=/usr/local/include  
#export LUA\_LIB=/usr/lib  
#export LUA\_INC=/usr/include/lua5.1

# or tell where to find LuaJIT when you want to use JIT instead

export LUAJIT\_LIB=$DEPLOY\_TARGET/lib  
export LUAJIT\_INC=$DEPLOY\_TARGET/include/luajit-2.0

./configure --prefix=$INSTALL\_DIR   
–with-cpu-opt=pentium4   
–with-ipv6   
–with-pcre=$DEPLOY\_TARGET/pcre   
–with-pcre-jit   
–with-pcre-jit   
–without-http\_autoindex\_module   
–without-http\_ssi\_module   
–without-http\_referer\_module   
–without-http\_userid\_module   
–without-http\_empty\_gif\_module   
–without-http\_limit\_req\_module   
–without-http\_browser\_module   
–without-http\_memcached\_module   
–without-http\_charset\_module   
–without-http\_split\_clients\_module   
–with-http\_stub\_status\_module   
–with-http\_ssl\_module   
–with-http\_realip\_module   
–with-http\_sub\_module   
–with-http\_geoip\_module   
–add-module=src/http/modules/ngx\_devel\_kit   
–add-module=src/http/modules/lua-nginx   
–add-module=src/http/modules/headers\_more   
–add-module=src/http/modules/substitute   
–add-module=src/http/modules/ngx\_iconv

make  
make install

---

<div class="post-metadata">

**Author:** ![Delta\_Y](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f9ae1b/32.png) [@Delta\_Y](https://www.ruby-forum.com/u/Delta_Y)\
**Post date:** [April 27, 2012, 4:01pm UTC](https://www.ruby-forum.com/t/nginx-1-2-0-is-slower-than-1-1-12/219275/13 "2012-04-27T16:01:16Z")

</div>

Hello!

On Fri, Apr 27, 2012 at 09:08:45PM +0800, Delta Y. wrote:

> > > –enable-shared --enable-multiarch --enable-linker-build-id
> 
> No thirdparty patch applied except the one “proxy\_bind support variable”.  
> Maxim, I remember it is from you, 🙂
> 
> The major 2 in version string means upstream keepalive feaure only .

Again: it’s really good idea to test vanilla nginx, without any  
patches and 3rd party modules, especially when debugging such  
subtle problems. Even trivial patch might cause unspecified  
behaviour e.g. if it applied incorrectly due to context code  
changes. And the similar thing applies to 3rd party modules.

> > > –with-http\_ssl\_module --with-http\_realip\_module  
> > > –with-http\_sub\_module --with-http\_geoip\_module -
> > 
> > The output looks truncated (note trailing “-”), is it?
> > 
> > In any case, please provide sample of an actual gcc command as  
> > used during compilation of nginx object files, it may contain  
> > various flags not visible in “nginx -V” output.
> 
> The shell script to build nginx is :

I need a gcc command as shown during “make”, like this:

gcc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter  
-Wunused-function -Wunused-variable -Wunused-value -Werror -g -I  
src/core -I src/event -I src/event/modules -I src/os/unix -I objs   
-o objs/src/core/nginx.o   
src/core/nginx.c

Maxim D.
