Comments (9)
(for reference, default settings for a hardware load balancer:
https://support.f5.com/kb/en-us/solutions/public/3000/300/sol3393.html
see "gzip compression level".)
from compression.
As a side note, the F5 guys know what they are doing. So we can assume that they have a very good reason for setting the level to 1. Likely decided on after lots of testing.
If you would like, I can do a bit of research and check other web server software and appliances for http traffic delivery and see what other people choose as defaults. I have a feeling that the industry standard is not 6. :-)
from compression.
Some relevant graphs:
https://mscblogs.blob.core.windows.net/media/owscott/Media/IIS7CompressionRatio.jpg
https://mscblogs.blob.core.windows.net/media/owscott/Media/IIS7Compression-TTFB.jpg
from compression.
Hi! You'll notice in our source code, we do not actually set any defaults anywhere, so there is no where we can just change the default to level 1 for ARM. All defaults are handled in Node.js core, we just document them on our README because people kept complaining that they had to go read Node.js core documentation :)
This means you have two options here:
- Get Node.js core to provide a different default.
- Publish a module to npm that wraps this module with a different default, using the public API options we provide.
I hope that makes sense :)
from compression.
Could you point to where in NodeJS the default is implemented?
from compression.
Hi @usernameisalreadytaken2014, I'm not certain. I guess it is https://github.com/nodejs/node/blob/v5.7.0/lib/zlib.js#L27
from compression.
More like https://github.com/nodejs/node/blob/v5.7.0/lib/zlib.js#L31 yeah?
I think the zlib module is intended for general usage.
The compression module is a special case that does live compression during streaming.
Other users of the zlib module may expect the compression level to be a constant, in particular modules that use zlib to compress files on disk or other non-streaming purposes.
In short, after thinking about it a bit, it seems to me that the correct place to adjust the level to something suitable for streaming is inside the compression module (even if it is initially defined to some default value in zlib).
from compression.
the correct place to adjust the level to something suitable for streaming is inside the compression module (even if it is initially defined to some default value in zlib).
You need to do this yourself, or publish a module to npm wrapping this module to do the same thing:
app.use(compression({
level: process.config.variables.host_arch == 'arm' ? 1 : -1
}))
from compression.
OK, thank you.
(Might be useful to include this as a hint in the documentation, in case there are other people out there using NodeJS + compression on a Raspberry Pi platform. OTOH, I guess github issues is a kind of documentation too ;-).)
from compression.
Related Issues (20)
- Setting Vary header although caching is disabled HOT 1
- "drain" event listener leak when using res.once("drain"); can't use res.removeListener("drain") HOT 3
- compresssion doesn't work ,the vue.txt is 2m HOT 2
- Content-Type: application/json; charset=utf-8 No effect HOT 2
- Question: Why this middleware HOT 2
- Corrupted compressed .js-files for Mac OS / Safari -clients HOT 11
- Is compression working when node server is running on a container? HOT 2
- middleware fails when the request has more than 1 values for accept-encoding header HOT 2
- Is compression result cached? HOT 1
- change Transfer-encoding HOT 1
- Why does the data size increase after compression HOT 1
- Force size to be a minimum... HOT 2
- Chunked encoding is broken after using this middleware HOT 1
- Using a current debug version HOT 1
- Deflate backwards HOT 7
- Compression instrumentation (before/after compression hooks) HOT 2
- Angular Not Compressing? HOT 2
- compression not working json payload HOT 6
- Crash when compressing characters like ū HOT 1
- Express returns a non-compliant HTTP/206 response when gzip is enabled HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from compression.