Giter Site home page Giter Site logo

defaults for ARM about compression HOT 9 CLOSED

expressjs avatar expressjs commented on April 27, 2024
defaults for ARM

from compression.

Comments (9)

usernameisalreadytaken2014 avatar usernameisalreadytaken2014 commented on April 27, 2024

(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.

usernameisalreadytaken2014 avatar usernameisalreadytaken2014 commented on April 27, 2024

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.

usernameisalreadytaken2014 avatar usernameisalreadytaken2014 commented on April 27, 2024

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.

dougwilson avatar dougwilson commented on April 27, 2024

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:

  1. Get Node.js core to provide a different default.
  2. 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.

usernameisalreadytaken2014 avatar usernameisalreadytaken2014 commented on April 27, 2024

@dougwilson

Could you point to where in NodeJS the default is implemented?

from compression.

dougwilson avatar dougwilson commented on April 27, 2024

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.

usernameisalreadytaken2014 avatar usernameisalreadytaken2014 commented on April 27, 2024

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.

dougwilson avatar dougwilson commented on April 27, 2024

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.

usernameisalreadytaken2014 avatar usernameisalreadytaken2014 commented on April 27, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.