Skip to content
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

Is there a particular reason there is no support for Brotli, bzip2 and LZMA2? #113

Closed
gajus opened this issue May 8, 2017 · 2 comments
Closed
Assignees
Labels

Comments

@gajus
Copy link

gajus commented May 8, 2017

I am surprised that there isn't even an open ticket for the feature request.

Would a PR be accepted for either of these algorithms?

(...or is there a reason that makes performing this operation at Node.js-level a bad idea?)

Brotli in particular has a wide (58%) browser adoption http://caniuse.com/#search=Brotli

@gajus
Copy link
Author

gajus commented May 8, 2017

Oh, I see. There is an open issue for Brotli.

#71

@gajus gajus closed this as completed May 8, 2017
@dougwilson dougwilson self-assigned this May 8, 2017
@dougwilson
Copy link
Contributor

Hi @gajus I know you closed the issue, but wanted to respond anyhow :) The main reason there is no support currently is because this module (like all of Express) tries to provide a "hassle-free" experience of installation. Effectively this means no dependencies on native modules, as this is still quite the hassle for Windows users (though it has been getting better). That limits the module to the algorithms that are bundled into Node.js binary natively.

Now, an idea floated around is to add an extension API to the module, to allow the algorithms to be extended by options, which by extension, means one could publish a compression-brotli module to npm with this module as a dependent, rather than forking and maintaining a fork. Users who are OK with native module can use an extended version.

I think the biggest limiting factor to adopting this is that doing the compression within Node.js is just in the end bad for performance. At least with the algorithms built into Node.js directly (I cannot speak for how any native modules are implemented), the compression is happening as work items on the built-in thread pool within Node.js. The thread pool by default is only 4 threads, which can be a serious bottleneck, especially when you realize that all file I/O and even the default DNS operations all need to happen in that thread pool as well (sharing just 4 threads!). Couple that with most Node.js deployments being fronted with a LB like NGINX which can transparently add compression.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants