ipfs / infra

Tools and systems for the IPFS community

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Gateway: Support Brotli Compression

lidel opened this issue · comments

Something I discovered when playing with http-compression-check.sh : when asking for the same HTML file (Vincent_van_Gogh.html) from ipfs.io and cloudflare-ipfs, the latter will consume less bandwidth:

ipfs.io/ipfs/

Checking https://ipfs.io/ipfs/QmT5NvUtoM5nWFfrQdVrFtvGfKFmG7AHE8P34isapyhCxX/wiki/Vincent_van_Gogh.html
Content-Encoding: gzip
compressed:	    102115
uncompressed:	482198

cloudflare-ipfs.com/ipfs/

Checking https://cloudflare-ipfs.com/ipfs/QmT5NvUtoM5nWFfrQdVrFtvGfKFmG7AHE8P34isapyhCxX/wiki/Vincent_van_Gogh.html
Content-Encoding: br
compressed:	     86049
uncompressed:	482198

I wonder, how gateway cpu/bandwidth utilization would change if we added support for brotli?
Are we able to enable it on some gateways to evaluate the impact?

References

Are we able to enable it on some gateways to evaluate the impact?

We are. Looks like it will involve compiling a custom nginx build, but not too difficult. Alternatively, OpenResty (which we have briefly used in the past as a drop-in replacement for nginx) comes with Brotli pre-installed.

good and bad news.

Good news: It appears the brotli nginx module is under active-ish development again, after being in hiatus for a while.

Bad news: OpenResty no longer ships brotli support out of the box. We will have to build our own.

Although, asking them to include brolti support upstream is also an option.

status: