-
Notifications
You must be signed in to change notification settings - Fork 3k
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
locust support testing against HTTP/2 servers ? #264
Comments
We found that the Hyper could support the HTTP/2. Now we are trying to integrate the HTTP/2 into Locust, we were wondering that any kinds of suggestions about how to integrate the Hyper into Locust? Look forward to you reply. Thank you, |
read this to get started: |
Locust support http2? |
yes, if you use an http2 client within your locust scripts |
is there any example to implement hyper for http/2 client on locust ? Thanks |
Hi! I managed to make it work with httpx (which use hyper under the hood). It's mostly compatible with requests https://www.python-httpx.org/compatibility/ Check my gist. You just have to use the HttpxUser in your locustfile https://gist.github.com/gawel/f48e577425f872e1a81028f3f53353cf#file-clientx-py-L216 Let me know if you're interested in a PR to add this in contrib/httpx (of course I'll add some tests). If not I'll probably create a dedicated package |
I've also found a way using @Kenith sugestion: from locust import TaskSet, between, HttpUser
from hyper.contrib import HTTP20Adapter
class Http2User(HttpUser):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.client.mount(self.host, HTTP20Adapter()) Don't know which one is the more efficient but this second option is easy to use |
@gawel note that httpx relies on hyper-h2 (the HTTP/2 protocol stack) rather than hyper, the client (which I myself got confused about, see: encode/httpx#1476). The later is deprecated in favor of httpx. That means the HTTP20Adapter (which came with the client) shouldn't be used in new code, but FWIU, httpx aims to be very compatible with requests, so that might not be a problem. |
Any plans for Locust to support testing against HTTP/2 servers like h2o https://github.com/h2o/h2o and OpenLiteSpeed http://open.litespeedtech.com/mediawiki/ ?
cheers
George
The text was updated successfully, but these errors were encountered: