Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[h2load] add support for requests until reconnect via -q #1593

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jdamato-fsly
Copy link

Greetings!

This PR should not be merged as is (because it has at least one bug), but highlights a feature I'd love to see in h2load.

I would love to tell h2load to force clients to reconnect to the server after a certain number of requests have been issued. I would like to do this so that I can benchmark TLS handshakes after a certain number of requests have been issued.

This PR attempts to do this only for http1.1 and it creates a bug where the last request is never issued to the server and is always marked as a failure.

In order to test this PR, I created a simple python web server:

#!/usr/bin/env python
import SimpleHTTPServer
import SocketServer

class MyHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
    protocol_version = 'HTTP/1.1'

    def end_headers(self):
        self.send_my_headers()
        SimpleHTTPServer.SimpleHTTPRequestHandler.end_headers(self)

    def send_my_headers(self):
    	self.send_header("Cache-Control", "max-age=3800")

if __name__ == '__main__':
    SocketServer.TCPServer.allow_reuse_address = True
    httpd = SocketServer.TCPServer(("", 10000), MyHTTPRequestHandler)
    httpd.serve_forever()

which I ran with strace -tf -etrace=accept python test.py (so that I could more easily track the number of reconnects).

and then issued requests against it, like this:

./src/h2load --h1 -n 8 -c 1 -t 1 -q 4 http://127.0.0.1:10000/

This results in the server showing the following:

11:33:32 accept(3, {sa_family=AF_INET, sin_port=htons(43572), sin_addr=inet_addr("127.0.0.1")}, [16]) = 4
127.0.0.1 - - [21/Jun/2021 11:33:32] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [21/Jun/2021 11:33:32] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [21/Jun/2021 11:33:32] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [21/Jun/2021 11:33:32] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [21/Jun/2021 11:33:32] "GET / HTTP/1.1" 200 -
11:33:32 accept(3, {sa_family=AF_INET, sin_port=htons(43574), sin_addr=inet_addr("127.0.0.1")}, [16]) = 4
127.0.0.1 - - [21/Jun/2021 11:33:32] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [21/Jun/2021 11:33:32] "GET / HTTP/1.1" 200 -

(This is off by 1 because the requests are counted in the msg_complete cb, it would probably be better to count them in submit_request or similar)

and h2load reports:

requests: 8 total, 8 started, 7 done, 7 succeeded, 1 failed, 1 errored, 0 timeout
status codes: 7 2xx, 0 3xx, 0 4xx, 0 5xx
traffic: 1.67KB (1709) total, 1.17KB (1197) headers (space savings 0.00%), 476B (476) data

As you can see, the 8th request is never issued and is always marked as a failure -- as such, this PR should not be merged.

Is this a feature that h2load would potentially benefit from? If so, perhaps I can get this into a better state fit for merging. Any suggestions on this approach are appreciated 馃槃

@jdamato-fsly jdamato-fsly changed the title add support for requests until reconnect via -q [h2load] add support for requests until reconnect via -q Jun 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant