Nginx-0.7.52

On Tue, Apr 21, 2009 at 10:52:53AM +0100, Istv?n wrote:

Hi!

Please note that ab itself a huge bottleneck and it gives you zero
information about nginx performance. As you can see you hit the 100% CPU
-what comes from ab load-.

Yes, running ab on the same host is benchmark both ab and nginx.

I realized that during performance testing, all what I can tell you: use the
httperf instead if you have a chance.
(do not forget to modify the FD_SETSIZE to higher value)

BTW, nginx/Windows is currently build with FD_SETSIZE.

I realized that during performance testing, all what I can tell you: use the
httperf instead if you have a chance.
(do not forget to modify the FD_SETSIZE to higher value)

BTW, nginx/Windows is currently build with FD_SETSIZE.

did you mean “without defining FD_SETSIZE” or “with defining it?”

Note that ruby recently went through some acrobatics to “dynamically”
resize their fd_sets if you try to include > FD_SETSIZE file descriptors
in them :slight_smile:
http://redmine.ruby-lang.org/repositories/revision/ruby-19?rev=21487
http://redmine.ruby-lang.org/issues/show/755

Cheers!
-=r

On Tue, Apr 21, 2009 at 04:52:09PM +0200, Roger P. wrote:

I realized that during performance testing, all what I can tell you: use the
httperf instead if you have a chance.
(do not forget to modify the FD_SETSIZE to higher value)

BTW, nginx/Windows is currently build with FD_SETSIZE.

did you mean “without defining FD_SETSIZE” or “with defining it?”

I meant that nginx is built with FD_SETSIZE=1024

I meant that nginx is built with FD_SETSIZE=1024

What does nginx do when it receives more connections than 1024? Does it
try to override the fdset instance and possibly tromp on other memory
(I’m not sure if that’s a concern or not, even)?

does it reject incoming connections when it gets too many?
Thanks.
-=r

2009/4/21 Igor S. [email protected]

I meant that nginx is built with FD_SETSIZE=1024

is it enough? haven’t you seen performance issues with this
configuration?

On Tue, Apr 21, 2009 at 04:27:24PM +0100, Istv?n wrote:

did you mean “without defining FD_SETSIZE” or “with defining it?”

I meant that nginx is built with FD_SETSIZE=1024

is it enough? haven’t you seen performance issues with this configuration?

1024 is certainly not enough im modern web. However, select() is
unscalable
method: on 1000 sockets the select() itself will be bottleneck: this is
the reason why kqueue, epoll, etc. had been implemented. With nginx you
may try to overcome this select/poll limit using several worker
processes.

On Mon, Apr 20, 2009 at 03:20:59PM -0700, Chris Cortese wrote:

Thanks for this release! I’ve been trying to get nginx going on Windows
for a while now.

With this latest build though, all I can get is “No input file
specified”. I thought maybe I was specifying paths in a way it didn’t
like but I’ve tried every variation on the Windows paths I can think
of. This is my current conf for one of my sites. Can anyone tell me
what’s wrong here? TIA.

The message “No input file specified” meanse that PHP can not find file
on passed path, say:
“c:/cygwin/home/Chris/www/live/jobsite/trunk/html/public/index.php”
I do not know how Cygwin translated pathnames, but it may be just
“/home/Chris/www/live/jobsite/trunk/html/public/index.php”
therefore you may try

  • fastcgi_param SCRIPT_FILENAME c:/cygwin/home/Chris…
  • fastcgi_param SCRIPT_FILENAME /home/Chris…

The message “No input file specified” meanse that PHP can not find file
on passed path, say:
“c:/cygwin/home/Chris/www/live/jobsite/trunk/html/public/index.php”
I do not know how Cygwin translated pathnames, but it may be just
“/home/Chris/www/live/jobsite/trunk/html/public/index.php”
therefore you may try

  • fastcgi_param SCRIPT_FILENAME c:/cygwin/home/Chris…
  • fastcgi_param SCRIPT_FILENAME /home/Chris…

if it’s cygwin it might be something like /cygdrive/c/…

On Tue, Apr 21, 2009 at 05:36:01PM +0200, Roger P. wrote:

I meant that nginx is built with FD_SETSIZE=1024

What does nginx do when it receives more connections than 1024? Does it
try to override the fdset instance and possibly tromp on other memory
(I’m not sure if that’s a concern or not, even)?

does it reject incoming connections when it gets too many?

nginx will close connection with this message in error_log:
[error] … maximum number of descriptors supported by select() is
1024".

Just to clarify:

I’m really wanting to try Igor’s latest 0.7.52 native Windows build.
Ignore the part about “cygwin” being part of the pathname.
But there is history for why “cygwin” is in my path at all:

  1. I first was trying the cygwin build from the link out there on the
    net.
    How to install Nginx, PHP, PHP-FPM and MySQL under Windows with Cygwin - Software Projects Inc.
    Using that link and a couple other things I had to find / figure out, I
    was able to get nginx and php-fpm working on Windows, but I could not
    get the crypt() function to understand / do md5. This meant I couldn’t
    log in to my local website and so this was kind of useless.

  2. I next tried 0.7.50 from kevinworthington.com. I think it could
    have worked but it insisted on looking for nginx.conf down under the
    /cygwin place where I had built nginx from source (see #1, above). I
    could not figure out how to tell it just to use nginx.conf from
    c:\nginx\conf\nginx.conf. I tried uninstalling and reinstalling cygwin
    and nginx (but cygwin is not so easy to uninstall). That was apparently
    all that I needed to get that working! (Well, I never got to the point
    of testing crypt() on that attempt).

  3. Then Igor releases 0.7.52 native Windows build which I hoped would
    avoid both the above problems, and it probably still will, but I am
    unclear as to what kind of paths are expected. Somewhere I read that
    for the SCRIPT_FILENAME, I should include the drive letter, but for the
    “root” directive, I should not…??? And I did not know if double
    quotes should be used, etc… I can find no documentation on proper
    paths for the new 0.7.52 native Windows build nginx.conf.

I’ll keep trying. Hope that history explains how I got there and why
“cygwin” still is in my nginx.conf. I’m no longer trying to use the
cygwin build. I just happen to have my web codebase still in that
location (I’ve also tried other locations, like
c:\nginx\html\www.…etc)

Thanks!
Chris

Igor S. wrote:

Changes with nginx 0.7.52 20 Apr
2009

*) Feature: the first native Windows binary release.

*) Bugfix: in processing HEAD method while caching.

*) Bugfix: in processing the "If-Modified-Since", "If-Range", etc.
   client request header lines while caching.

*) Bugfix: now the "Set-Cookie" and "P3P" header lines are hidden in
   cacheable responses.

*) Bugfix: if nginx was built with the ngx_http_perl_module and with 

a
perl which supports threads, then during a master process exit
the
message “panic: MUTEX_LOCK” might be issued.

*) Bugfix: nginx could not be built --without-http-cache; the bug 

had
appeared in 0.7.48.

*) Bugfix: nginx could not be built on platforms different from 

i386,
amd64, sparc, and ppc; the bug had appeared in 0.7.42.

Hi, I try to run windows nginx , but I find a bug when I change
nginx.conf “worker_processes 4;”
error_log have much message like " "[alert] 4168#5612: select() failed
(10022: æä¾›äº†ä¸€ä¸ªæ— æ•ˆçš„å‚æ•°ã€‚) "
and the error_log file change very big, and half hour after, the file
become 10G!

PS:sorry, I am chinese,I’m bad at English.

Could you add

open_file_cache max=1000 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 2;
open_file_cache_errors on;

and run just

ab.exe -k -n 10000 -c 1

to see if CreateFile() adds noticeable overhead ?

I have tested it with above configration, and there is nothing in the
error.log.

C:\Program Files\Apache Software Foundation\Apache2.2\bin>ab.exe -k -n
10000 -
1 http://127.0.0.1/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 127.0.0.1 (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Completed 10000 requests
Finished 10000 requests

Server Software: nginx/0.7.52
Server Hostname: 127.0.0.1
Server Port: 80

Document Path: /
Document Length: 151 bytes

Concurrency Level: 1
Time taken for tests: 1.750 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Keep-Alive requests: 10000
Total transferred: 3670000 bytes
HTML transferred: 1510000 bytes
Requests per second: 5714.29 [#/sec] (mean)
Time per request: 0.175 [ms] (mean)
Time per request: 0.175 [ms] (mean, across all concurrent
requests)
Transfer rate: 2047.99 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.2 0 16
Processing: 0 0 1.6 0 16
Waiting: 0 0 1.3 0 16
Total: 0 0 1.6 0 16

Percentage of the requests served within a certain time (ms)
50% 0
66% 0
75% 0
80% 0
90% 0
95% 0
98% 0
99% 16
100% 16 (longest request)

Could you add

open_file_cache max=1000 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 2;
open_file_cache_errors on;

and run just

ab.exe -k -n 10000 -c 1

to see if CreateFile() adds noticeable overhead ?

Then I increased the concurrency:

ab.exe -k -n 10000 -c 500
nothing error

ab.exe -k -n 10000 -c 1000
Error.log: many lines of “2009/04/22 11:14:15 [alert] 2744#448: *951
WSARecv() failed (10053: Your software in this host abandons this
connection.) while keepalive, client: 127.0.0.1, server: 0.0.0.0:80”

(note: The error.log contains some Chinese characters after error number
10053 because of my OS’s location. I translated these into English,
maybe not accurate.)

My testing index.html is 151 bytes. Maybe it’s too small. Then I used a
test.html with size of 1K bytes. The result changed:

ab.exe -k -n 10000 -c 50
nothing error

ab.exe -k -n 10000 -c 100
nothing error

ab.exe -k -n 10000 -c 200
Error.log: many lines of “2009/04/22 11:34:22 [alert] 2744#448: *4806
WSARecv() failed (10053:Your software in this host abandons this
connection.) while keepalive, client: 127.0.0.1, server: 0.0.0.0:80”

Then I tested a 100k file:

ab.exe -k -n 10000 -c 5
nothing error

ab.exe -k -n 10000 -c 10
nothing error

ab.exe -k -n 10000 -c 20
nothing error

ab.exe -k -n 10000 -c 30
Error.log:
there are two kinds of errors:
1. 2009/04/22 11:45:50 [alert] 2744#448: *4996 WSASend() failed
(10053:Your software in this host abandons this connection.) while
sending response to client, client: 127.0.0.1, server: localhost,
request: “GET /test1.html HTTP/1.0”, host: “127.0.0.1”
2. 2009/04/22 11:45:50 [alert] 2744#448: *4992 WSARecv() failed
(10053:Your software in this host abandons this connection.) while
keepalive, client: 127.0.0.1, server: 0.0.0.0:80

On Wed, Apr 22, 2009 at 12:01:04PM +0800, Weibin Y. wrote:

(note: The error.log contains some Chinese characters after error number 10053 because of my OS’s location. I translated these into English, maybe not accurate.)
I wanted to log this in English only. Currently I use
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT)
for FormatMessage(), probably, I should use
MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT)

ab.exe -k -n 10000 -c 30
Error.log:
there are two kinds of errors:
1. 2009/04/22 11:45:50 [alert] 2744#448: *4996 WSASend() failed (10053:Your software in this host abandons this connection.) while sending response to client, client: 127.0.0.1, server: localhost, request: “GET /test1.html HTTP/1.0”, host: “127.0.0.1”
2. 2009/04/22 11:45:50 [alert] 2744#448: *4992 WSARecv() failed (10053:Your software in this host abandons this connection.) while keepalive, client: 127.0.0.1, server: 0.0.0.0:80

Probably, this is ab-specific errors: it opens several connections, and
when number of requests are reached, just closes superfluous
connections.
Unix does not returns error in this case or may return EPIPE.
It seems that Windows returns WSAECONNABORTED in this case.
I will lower its level to [info].

On Wed, Apr 22, 2009 at 11:12:39AM +0800, Weibin Y. wrote:

to see if CreateFile() adds noticeable overhead ?

I have tested it with above configration, and there is nothing in the error.log.

C:\Program Files\Apache Software Foundation\Apache2.2\bin>ab.exe -k -n 10000 -
1 http://127.0.0.1/

Requests per second: 5714.29 [#/sec] (mean)

Without open_file_cache:

ab.exe -k -n 10000 -c 1 http://127.0.0.1/
Requests per second: 2424.24 [#/sec] (mean)
CPU load: about 68%

It seems that CreateFile() is really heavy syscall: using
open_file_cache
increases twice the number of requests. In this case nginx saves 4
syscalls:

*) CreateFile() while index files testing,
*) and CreateFile()/GetFileAttributesEx/CloseHandle().

On Wed, Apr 22, 2009 at 05:37:41AM +0200, Chris Wan wrote:

Hi, I try to run windows nginx , but I find a bug when I change
nginx.conf “worker_processes 4;”
error_log have much message like " "[alert] 4168#5612: select() failed
(10022: ???) "
and the error_log file change very big, and half hour after, the file
become 10G!

Could you enable debug logging:

error_log logs/error.log debug;

reproduce the above error and send the log to me ?

On Tue, Apr 21, 2009 at 04:34:49PM -0700, Chris Cortese wrote:

was able to get nginx and php-fpm working on Windows, but I could not
of testing crypt() on that attempt).
“cygwin” still is in my nginx.conf. I’m no longer trying to use the
cygwin build. I just happen to have my web codebase still in that
location (I’ve also tried other locations, like c:\nginx\html\www…etc)

The path in SCRIPT_FILENAME is FastCGI server property. You may run
nginx
on Unix host and FastCGI on Windows. And in this case SCRIPT_FILENAME
should have Windows-style path.

If PHP is Cygwin application, then you should use Cygwin-compatible
path.
If PHP is native Win32 application, then you should use x:… style
path.

Thanks Igor!
Understanding the difference in who is handling which path was my last
hurdle. I now have all native nginx, mysql, php running successfully on
XP.

Very minor detail/request from Windows people: I’m not very
knowledgeable with MS-DOS Batch files. Can someone tell me how to run
“start nginx” from within a .bat? I’m just running it separately from a
cmd prompt now, which works, just one extra step.

On another note to the folks maintaining the nginx site and docs, I’m
sure it would be very helpful to M$ people if you took the information
from the following link, updated it so that it relates to the current
Windows native binary (and strip the Wordpress-specific stuff), and took
this information to the nginx site.

http://blogbuildingu.com/wordpress/install-wordpress-wemp

It would also be great if someone wanted to take the time to also add
the information from the following link, update some info in terms of
version numbers, etc., and ideally if you can explain how to get crypt()
to work in cygwin (I never figured this out), this would be very helpful
to people who want to run nginx on Windows but have everything be in the
Cygwin environment, build php-fpm and everything from source.


The following is my vhost conf for a very basic site built on Code
Igniter:

note that the “WEMP” stack is not using any cygwin components. I just

have my web PHP code in that directory

structure still, which is convenient for when I want to use *nix-like

environment on my Windows codebase.

server {
listen *:80;
server_name jobsite.xpdesktop;

access_log html/jobsite/logs/jobsite.access.log;
error_log html/jobsite/logs/jobsite.error.log;

root /cygwin/home/Chris/www/live/jobsite/trunk/html/public;
index index.php index.html;

location / {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME
c:/cygwin/home/Chris/www/live/jobsite/trunk/html/public/index.php;
fastcgi_param QUERY_STRING q=$request_uri;
include fastcgi_params;
}

location ~ /.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME
c:/cygwin/home/Chris/www/live/public$fastcgi_script_name;
fastcgi_param QUERY_STRING q=$request_uri;
include fastcgi_params;
}
}

Hello folks,

Is windows binary unable to customize installation path? The only path
is C:/nginx ?
Thanks.

Posted at Nginx Forum:

Igor S. wrote:

On Wed, Apr 22, 2009 at 05:37:41AM +0200, Chris Wan wrote:

Hi, I try to run windows nginx , but I find a bug when I change
nginx.conf “worker_processes 4;”
error_log have much message like " "[alert] 4168#5612: select() failed
(10022: ???) "
and the error_log file change very big, and half hour after, the file
become 10G!

Could you enable debug logging:

error_log logs/error.log debug;

reproduce the above error and send the log to me ?

2009/04/23 09:52:15 [debug] 616#11980: *5736 write new buf t:1 f:0
00A48940, pos 00A48940, size: 211 file: 0, size: 0
2009/04/23 09:52:15 [debug] 616#11980: *5736 http write filter: l:0 f:0
s:211
2009/04/23 09:52:15 [debug] 616#11980: *5736 http output filter
“/index.html?”
2009/04/23 09:52:15 [debug] 616#11980: *5736 copy filter: “/index.html?”
2009/04/23 09:52:15 [debug] 616#11980: *5736 http postpone filter
“/index.html?” 00A48B44
2009/04/23 09:52:15 [debug] 616#11980: *5736 write old buf t:1 f:0
00A48940, pos 00A48940, size: 211 file: 0, size: 0
2009/04/23 09:52:15 [debug] 616#11980: *5736 write new buf t:1 f:0
00A48AAC, pos 00A48AAC, size: 151 file: 0, size: 0
2009/04/23 09:52:15 [debug] 616#11980: *5736 http write filter: l:1 f:0
s:362
2009/04/23 09:52:15 [debug] 616#11980: *5736 http write filter limit 0
2009/04/23 09:52:15 [debug] 616#11980: *5736 WSASend: fd:220, s:362
2009/04/23 09:52:15 [debug] 616#11980: *5736 http write filter 00000000
2009/04/23 09:52:15 [debug] 616#11980: *5736 copy filter: 0
“/index.html?”
2009/04/23 09:52:15 [debug] 616#11980: *5736 http finalize request: 0,
“/index.html?” 1
2009/04/23 09:52:15 [debug] 616#11980: *5736 http close request
2009/04/23 09:52:15 [debug] 616#11980: *5736 http log handler
2009/04/23 09:52:15 [debug] 616#11980: *5736 run cleanup: 00A48860
2009/04/23 09:52:15 [debug] 616#11980: *5736 file cleanup: fd:208
2009/04/23 09:52:15 [debug] 616#11980: *5736 free: 00A48338, unused:
1893
2009/04/23 09:52:15 [debug] 616#11980: *5736 close http connection: 220
2009/04/23 09:52:15 [debug] 616#11980: *5736 select del event fd:220
ev:0
2009/04/23 09:52:15 [debug] 616#11980: *5736 free: 00A3C4C0
2009/04/23 09:52:15 [debug] 616#11980: *5736 free: 00A51350
2009/04/23 09:52:15 [debug] 616#11980: *5736 free: 00A51628, unused: 56
2009/04/23 09:52:15 [debug] 616#11980: posted event 00000000
2009/04/23 09:52:15 [debug] 616#11980: worker cycle
2009/04/23 09:52:15 [debug] 616#11980: accept mutex lock failed: 0
2009/04/23 09:52:15 [debug] 616#11980: select timer: 500
2009/04/23 09:52:15 [debug] 616#11980: select read fd_set: 00000000
2009/04/23 09:52:15 [debug] 616#11980: select ready -1
2009/04/23 09:52:15 [alert] 616#11980: select() failed (10022:
æä¾›äº†ä¸€ä¸ªæ— æ•ˆçš„å‚æ•°ã€‚)
2009/04/23 09:52:15 [debug] 616#11980: timer delta: 0
2009/04/23 09:52:15 [debug] 616#11980: posted events 00000000
2009/04/23 09:52:15 [debug] 616#11980: worker cycle
2009/04/23 09:52:15 [debug] 616#11980: accept mutex lock failed: 0
2009/04/23 09:52:15 [debug] 616#11980: select timer: 500
2009/04/23 09:52:15 [debug] 616#11980: select read fd_set: 00000000
2009/04/23 09:52:15 [debug] 616#11980: select ready -1
2009/04/23 09:52:15 [alert] 616#11980: select() failed (10022:
æä¾›äº†ä¸€ä¸ªæ— æ•ˆçš„å‚æ•°ã€‚)
2009/04/23 09:52:15 [debug] 616#11980: timer delta: 0
2009/04/23 09:52:15 [debug] 616#11980: posted events 00000000
2009/04/23 09:52:15 [debug] 616#11980: worker cycle
2009/04/23 09:52:15 [debug] 616#11980: accept mutex lock failed: 0
2009/04/23 09:52:15 [debug] 616#11980: select timer: 500
2009/04/23 09:52:15 [debug] 616#11980: select read fd_set: 00000000
2009/04/23 09:52:15 [debug] 616#11980: select ready -1
2009/04/23 09:52:15 [alert] 616#11980: select() failed (10022:
æä¾›äº†ä¸€ä¸ªæ— æ•ˆçš„å‚æ•°ã€‚