-
Notifications
You must be signed in to change notification settings - Fork 83
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
Feature: turn off gzip compression #65
Comments
Hi, thanks for raising an issue about this. I have some questions to understand this better.
This is currently true.
Decompressed by what? The browser, or your Go program? When you performed the benchmark, did you use
Can you please clarify what you mean by "without actually handling compression headers"? I'm not sure which headers you're referring to.
In general, I prefer to expose as few options as viable. There's a high bar in order to add one, but I will consider it if there's sufficient justification for it. |
I was referring to when one serves those compressed static resources without using your Benchmarking software, programmatic API clients, curl and other HTTP clients apart from end-user browser software typically do not send headers to indicate they want or can handle compressed content.
I understand that. There are some use cases where the static files are few, very small or perhaps simple ( But even if you want to prioritise the typical end-user browser setup – which is certainly a valid approach – I think it would be a good idea to include a concrete example of serving the content with the Thanks for your response! |
If you're going to add an option to the interface... May I suggest that instead of a flag to turn on/off compression you accept an In fact I was about to suggest that this package always used I wouldn't mind doing the legwork if it's something you'd be interested in merging. Right now I have my own fork with |
Hello,
There doesn't seem to be an option to turn off automatic compression of included files. The
findAndWriteFiles
uses size comparison passed fromwriteCompressedFileInfo
to detect whether it would be better to serve the resource as-is or compressed with gzip. This is a cool feature, but there is no way to turn it off when disabling compression application-wide for security or performance reasons.I benchmarked HTTP responses – a byte array resource at ~83000 req/sec, an uncompressed http.FileSystem resource at ~78000 req/sec, and a gzip'ed resource that has to be decompressed on the fly at ~20000 req/sec, so the performance is about 1/4 for small ~1024 byte resources versus non-compressed byte arrays. Serving gzip'ed content without actually handling compression headers thus comes at a noticeable performance cost.
It would be nice if there was a way to set a configuration option in
Options
and pass this to the file system walking function to disable all compression.The text was updated successfully, but these errors were encountered: