Apache/ab testing trouble – apr_socket_recv: Connection refused (111)

abapache-2.4

I have a problem with testing Apache server 2.4 by ab. The Apache server runs on Windows as a service and I test it from another server which is on Linux.

I write:

 ab -n 1000 -c 1000 "http://x.x.x.x/image.jpg"

Output:

 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 x.x.x.x (be patient)
 apr_socket_recv: Connection refused (111)

When -n and -c are 100, there is no problem.
I had tested it previously and it had been all right, but all at once it began to crash.
I tried everything, even used mpm_winnt_module, but it didn't help.

(I use default values in Apache.)

I suppose that is not a network problem. I can see in Wireshark that communication is reseted after a while. According to me Apache is guilty.

Best Answer

The -c option of ab is for concurrency. So you're telling it to do 1000 concurrent requests. The default number of connections serviced by Apache is 150 on Windows. That's why a concurrency of 100 succeeds, but a concurrency of 1000 fails.

If you are so inclined (and your server can take the load), you can increase ThreadsPerChild to 1000 in the mpm_winnt_module section of httpd-mpm.conf. Also make sure httpd-mpm.conf is uncommented in httpd.conf.