sebastian-software / edge

The Lerna Repository for Edge Platform
Apache License 2.0
33 stars 7 forks source link

Replace shrink-ray with compression #28

Closed fastner closed 6 years ago

fastner commented 6 years ago

Purpose of this PR:

  1. Replace native bindings to C code with code that runs entirely in node
  2. Both zopfli and brotli are no good fit for fastest time to first byte and overall request time
  3. shrink-ray caches files in memory which might lead to high memory consumption

On 1.

Having native bindings is an issue when you want to deploy on function as a service engines lika AWS Lambda. node_modules have to be moved to Lambda and Lambda is running on AWS Linux. So this means a deploy can only happen from linux machines with exact same architecture. There is a wasm port of brotli, but this one don't support streaming.

On 2.

Both algorithms are not meant to be done in web request streams. They are more than 80x slower which leads to a big time overhead.

On 3.

In most cases the better architecture is to have a caching CDN in front of the webserver.

Changes

This PR replaces shrink-ray with compression