jeffweb
By:
jeffweb

Is my droplet blocking highly concurrent requests?

November 6, 2013 2.5k views
I have created a web app where the client polls the server every 1-2 seconds for a small bit of information. I have configured a Ubuntu 12.04 droplet with Varnish as a frontend to Apache. Here's a real URL that I'm serving: http://lafayettecc.org/lcc_live/event/132/progress You can see that it returns only a single integer If I log into my server and run apachebench I get astounding results: ====================================== $ ab -n 200 -c 200 http://lafayettecc.org/lcc_live/event/132/progress This is ApacheBench, Version 2.3 Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/ [TRIMMED] Document Path: /lcc_live/event/132/progress Document Length: 2 bytes Concurrency Level: 200 Time taken for tests: 0.087 seconds Complete requests: 200 Failed requests: 0 Write errors: 0 Total transferred: 67589 bytes HTML transferred: 400 bytes Requests per second: 2289.88 [#/sec] (mean) Time per request: 87.341 [ms] (mean) Time per request: 0.437 [ms] (mean, across all concurrent requests) Transfer rate: 755.71 [Kbytes/sec] received ====================================== However, after doing some minor testing from my local machine, I am now getting this: ====================================== $ ab -n 100 -c 20 http://lafayettecc.org/lcc_live/event/132/progress This is ApacheBench, Version 2.3 Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking lafayettecc.org (be patient)...Send request failed! Send request failed! Send request failed! apr_socket_recv: Connection reset by peer (54) Total of 43 requests completed ====================================== Running it again, I get this: ====================================== $ ab -n 100 -c 20 http://lafayettecc.org/lcc_live/event/132/progress This is ApacheBench, Version 2.3 Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking lafayettecc.org (be patient).....done Server Software: Apache/2.2.22 Server Hostname: lafayettecc.org Server Port: 80 Document Path: /lcc_live/event/132/progress Document Length: 2 bytes Concurrency Level: 20 Time taken for tests: 0.605 seconds Complete requests: 100 Failed requests: 0 Write errors: 0 Total transferred: 33789 bytes HTML transferred: 200 bytes Requests per second: 165.39 [#/sec] (mean) Time per request: 120.928 [ms] (mean) Time per request: 6.046 [ms] (mean, across all concurrent requests) Transfer rate: 54.57 [Kbytes/sec] received ====================================== The performance is way worse, but that's okay since I have to consider my own network lag to the droplet. However, if I up the concurrency just to 50 I get this: ====================================== $ ab -n 100 -c 50 http://lafayettecc.org/lcc_live/event/132/progress This is ApacheBench, Version 2.3 Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking lafayettecc.org (be patient)...apr_socket_recv: Operation timed out (60) ====================================== So, is there some reason why my droplet can handle massively concurrent requests locally, but times out when they come from the network?
1 Answer
Hi Jeff,

Are you still experiencing this? What OS is the local machine? It seems that there is a known issue with ApacheBench on (at least) OSX, that could be causing what you're seeing:

http://simon.heimlicher.com/articles/2012/07/08/fix-apache-bench-ab-on-os-x-lion

Let us know if it's still a problem!
Have another answer? Share your knowledge.