2

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.

Cristian Ciupitu
  • 6,396
  • 2
  • 42
  • 56
goLK
  • 21
  • 1
  • 4

1 Answers1

3

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.

Cristian Ciupitu
  • 6,396
  • 2
  • 42
  • 56
karyhead
  • 426
  • 3
  • 6
  • Well, there is written "Context: server config" but it doesn't work in httpd.conf. I tried "MaxClients" (it should work in all versions) and "MaxRequestWorkers" (it's in version 2.4). I also tried to change httpd-mpm.conf even but no success. :-/ AH00526: Syntax error on line 525 of C:/Apache24/conf/httpd.conf: Invalid command 'MaxClients', perhaps misspelled or defined by a module not included in the server configuration – goLK Jun 17 '14 at 08:16
  • Make sure the `httpd-mpm.conf` line is uncommented in `httpd.conf`. I think you want to edit the `mpm_winnt_module` section and increase `ThreadsPerChild`. Sorry about the MaxClients, I forgot you were on Windows. – karyhead Jun 17 '14 at 17:58
  • I've edited my answer. Let me know if it doesn't help – karyhead Jun 17 '14 at 18:05
  • I tried all of these things, doesn't help. – goLK Jun 18 '14 at 07:50
  • I don't have a Windows machine immediately accessible, but I'll see if I can get my hands on one and look at this. Could you also add the relevant parts of your `httpd.conf` and `httpd-mpm.conf`? – karyhead Jun 19 '14 at 00:27
  • I've been able to hit the thread limit, but I get `connection reset by peer` not `connection refused`. There's an error in logs/error that says `Server ran out of threads to service requests`. Is there anything useful in your Apache error log? Also, could you upload a wireshark capture to cloudshark or dropbox or something? – karyhead Jun 19 '14 at 03:40
  • httpd.conf - http://pastebin.com/h8ag1i4G, httpd-mpm.conf - http://pastebin.com/tvvymW6s, error.log - http://pastebin.com/86kBwBbG. – goLK Jun 24 '14 at 08:35
  • WireShark log - https://www.dropbox.com/s/5u3n373kq5h2xi1/log.txt. It is for command: ab -n 2000 -c 2000 "http://something.com/logo_inverzni.jpg". – goLK Jun 24 '14 at 09:21