question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Brotli compression is very slow

See original GitHub issue

Brotli seems to be extremely slow to compress files, the Umbraco backoffice JS bundle takes a whole 10 seconds to be served when using Brotli. After I overwrote the RequestHelper to instead use gzip when available the time fell to 1-2 seconds.

I realize though that Brotli seems to do a better job at compressing the file (~400 KB vs ~600 KB for gzip), however, 10 seconds seems an unreasonably long time to compress the file, so I’m thinking it could perhaps be a bug somewhere?

I’m guessing at the end of the day it might not be a huge problem if the file is aggressively cached when running in production, but it still seems like something is off to me.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
Shazwazzacommented, Dec 3, 2021

Sounds reasonable. But I wonder based on what @nikolajlauridsen says, if these would need to be configurable per bundle? Just like the cache buster is configurable per bundle. i.e. Global and Bundle level like many of the other options.

We need to find out what the ‘ideal’ level for brotli is and make that the default. I’m unsure if ‘lowest’ is the best. IMO the ‘best’ will be the setting that is faster and smaller than gzip.

1reaction
PhyxionNLcommented, Dec 2, 2021

Brotli is slow to compress at higher levels, while decompression is faster. Some benchmarks are here: https://quixdb.github.io/squash-benchmark/#results-table E: site seems bugged. Here’s an alternative benchmark; https://community.centminmod.com/data/attachment-files/2019/04/7885_compress-benchmarks-010.png

But these files will be cached on disk (unless you use Smidge.InMemory), so it shouldn’t matter too much. It’s just a one time thing that happens.

Read more comments on GitHub >

github_iconTop Results From Across the Web

We took a very detailed look at Brotli performance (both ...
So, Brotli makes sense for things we cache (because we can compress out of band) and for large files delivered over slow connections...
Read more >
'You can't use Brotli for dynamic content'
Brotli is slow for compression. I enabled this on a static asset management tool a while ago and it took several times longer...
Read more >
Brotli Compression: A Fast Alternative to GZIP Compression
Brotli has a better compression ratio (i.e. it produces smaller compressed files) across every level of compression. While GZIP does beat Brotli ......
Read more >
How To Speed Up Your Web Application With Brotli ...
Lossless compression is a great way of lowering the amount of data that users have to download to access your application.
Read more >
Improving website performance with brotli
In this experiment the compression speed of brotli at level 10 is about 100 times slower than gzip at level 6. This characteristic...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found