-
Notifications
You must be signed in to change notification settings - Fork 1.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
K6 seems to time decompression of Content-Encoding: gzip
responses
#2685
Comments
🤔 Indeed, the time spend decompressing the body will be measured simply because the body is decompressed on-the-fly, while it's being read from the I am wondering though, this decompression should happen pretty quickly on modern machines 🤔 I see we are using a mixture of github.com/klauspost/compress, github.com/andybalholm/brotli, and the stdlib's k6/lib/netext/httpext/compression.go Lines 151 to 159 in 3e88e18
I also see you are using a pretty old k6 version (v0.34.0, released ~1y ago). I suggest updating to the latest one (v0.40.0, released a couple of weeks ago) and seeing if you notice any improvements. In general, on-the-fly decompression should be pretty unnoticeable if you haven't undersized the machine k6 will run on. In any case, to get back on topic - changing how k6 does the That said, we plan to create a new k6 HTTP API (#2461) that addresses some of the many issues with the current one, hopefully soon... 🤞 That's why I won't close this issue outright - we might figure out some way to address it and satisfy your use case without making performance or UX compromises. The big problem I can see here is that k6 automatically decompresses the response bodies and there is no way to disable that behavior. If that part is configurable and can be disabled, then the measurement of Still, all of this is worth considering, so thank you for opening this issue! 🙇 |
I'll just reiterate that this isn't the case for our API. We saw some test cases get what looked like 15% slower with |
…E IMPROVEMENT) See: grafana/k6#2685 It might be interesting to think about taking into consideration decompression time when thinking about performance, but In general I think doing so is surprising and I wasted a lot of time trying to figure out why my optimizations to the compression codepath weren't improving things to the degree I expected The downside here is we lose error reporting, so you'll need to only set discardResponseBodies: true after the query has been tested. PR-URL: hasura/graphql-engine-mono#5940 GitOrigin-RevId: 82a589a59b93f10ffb5391e4a3190459fb6e613b
…E IMPROVEMENT) See: grafana/k6#2685 It might be interesting to think about taking into consideration decompression time when thinking about performance, but In general I think doing so is surprising and I wasted a lot of time trying to figure out why my optimizations to the compression codepath weren't improving things to the degree I expected The downside here is we lose error reporting, so you'll need to only set discardResponseBodies: true after the query has been tested. PR-URL: hasura/graphql-engine-mono#5940 GitOrigin-RevId: 3b088b8e66cec9fde603d3c8613724d6e03f01c5
…E IMPROVEMENT) See: grafana/k6#2685 It might be interesting to think about taking into consideration decompression time when thinking about performance, but In general I think doing so is surprising and I wasted a lot of time trying to figure out why my optimizations to the compression codepath weren't improving things to the degree I expected The downside here is we lose error reporting, so you'll need to only set discardResponseBodies: true after the query has been tested. PR-URL: hasura/graphql-engine-mono#5940 GitOrigin-RevId: 3b088b8e66cec9fde603d3c8613724d6e03f01c5
Brief summary
It appears that k6 includes the time it takes to decompress a gzip’ed response body in
http_req_duration
, when notdiscardResponseBodies
.This caused me a lot of time debugging, as I was attempting to optimize our compressed code path and wasn't seeing the results from k6 align with my micro benchmarks.
The time to decompress a response body is useful though (one might be trying to optimize for page load time if serving html, e.g.), but otherwise I think this is a surprising default. Can I suggest including this separately?
loosely related: #2586
k6 version
0.34.0
OS
linux
Docker version and image (if applicable)
No response
Steps to reproduce the problem
Large request with
Accept-Encoding: gzip
, then try w/discardResponseBodies
Expected behaviour
Don't time body decompression or validation, or include it separately.
Actual behaviour
Decompression is included in reported latency.
The text was updated successfully, but these errors were encountered: