Bug 50644

Summary: Add support for maximum number of requests per Keep-Alive connection to apachebench
Product: Apache httpd-2 Reporter: John E <johneagl>
Component: supportAssignee: Apache HTTPD Bugs Mailing List <bugs>
Severity: enhancement Keywords: MassUpdate
Priority: P2    
Version: 2.2.17   
Target Milestone: ---   
Hardware: All   
OS: All   
Attachments: Patch to enable limiting the number of requests per keep-alive connection
Patch to enable limiting the number of requests per keep-alive connection

Description John E 2011-01-24 19:53:11 UTC
Apache bench (ab) currently doesn't allow a limit on the number of requests per keep-alive tcp connection. The only options are a new connection per request, or c connections over which all n requests are sent (for n/c requests per connection). Unfortunately this does not mirror real-world traffic, as most HTTP clients (browsers) will make ~4 requests per tcp connection.
Comment 1 John E 2011-01-24 19:55:01 UTC
Created attachment 26542 [details]
Patch to enable limiting the number of requests per keep-alive connection

Attached is a patch to add a flag to apachebench to allow the specification of the number of requests per keep-alive connection to better simulate real-world clients.
Comment 2 John E 2011-01-24 20:03:55 UTC
Comment on attachment 26542 [details]
Patch to enable limiting the number of requests per keep-alive connection

Obsoleting patch -- comments do not match style and an additional bugfix is present (to limit number of spurious requests).
Comment 3 John E 2011-01-24 20:05:05 UTC
Created attachment 26543 [details]
Patch to enable limiting the number of requests per keep-alive connection

Second patch to add user-configurable limit on number of requests per connection. Obsoletes prior patch as prior patch had different comment style and contained a bugfix unrelated to this bug.
Comment 4 Stefan Fritsch 2011-06-22 21:14:51 UTC
With a large number of requests, this makes my machine run out of ports because too many connections are in TIME_WAIT:

ab -n 100000 -c 40 -k -m 2  http://localhost/
This is ApacheBench, Version 2.3 <$Revision: 1125877 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)
Completed 10000 requests
Completed 20000 requests
Completed 30000 requests
Completed 40000 requests
Completed 50000 requests

Test aborted after 10 failures

apr_socket_connect(): Cannot assign requested address (99)
Total of 56404 requests completed

The problem probably appears because now ab closes the connections first while without that option, httpd closes the connections first.
Comment 5 William A. Rowe Jr. 2018-11-07 21:10:03 UTC
Please help us to refine our list of open and current defects; this is a mass update of old and inactive Bugzilla reports which reflect user error, already resolved defects, and still-existing defects in httpd.

As repeatedly announced, the Apache HTTP Server Project has discontinued all development and patch review of the 2.2.x series of releases. The final release 2.2.34 was published in July 2017, and no further evaluation of bug reports or security risks will be considered or published for 2.2.x releases. All reports older than 2.4.x have been updated to status RESOLVED/LATER; no further action is expected unless the report still applies to a current version of httpd.

If your report represented a question or confusion about how to use an httpd feature, an unexpected server behavior, problems building or installing httpd, or working with an external component (a third party module, browser etc.) we ask you to start by bringing your question to the User Support and Discussion mailing list, see [https://httpd.apache.org/lists.html#http-users] for details. Include a link to this Bugzilla report for completeness with your question.

If your report was clearly a defect in httpd or a feature request, we ask that you retest using a modern httpd release (2.4.33 or later) released in the past year. If it can be reproduced, please reopen this bug and change the Version field above to the httpd version you have reconfirmed with.

Your help in identifying defects or enhancements still applicable to the current httpd server software release is greatly appreciated.