🔮 Sanity Create is here. Writing is reinvented. Try now, no developer setup

Discussion about adding brotli compression to Sanity's CDN

24 replies
Last updated: Mar 4, 2021
Any thoughts about supporting brotli as well as gzip?
Mar 2, 2021, 2:13 AM
I’ll have a look at how we can support it, thanks for the tip!
Mar 2, 2021, 6:27 AM
Sweet, could be as easy as your CDN settings :)
Mar 2, 2021, 6:31 AM
You would think that 😄 Of course Google CDN leaves compression to the servers behind it, and my particular server version is still waiting for brotli support. I'll keep an eye on it though!
Mar 2, 2021, 9:25 AM
Cheers Nicolas :)
Mar 2, 2021, 9:26 AM
Especially funny since Brotli is from google 😂
Mar 2, 2021, 9:27 AM
Hm our apicdn might be able to support brotli, would that be interesting? Or are you on the api primarily?
Mar 2, 2021, 10:10 AM
Yeah we’re on CDN :)
Mar 2, 2021, 10:33 AM
Mar 2, 2021, 10:43 AM
*content-encoding:* br
Mar 2, 2021, 10:44 AM
Holy crap, fastest feature request I ever saw.
Can you do draft ref draft and inline new referenced document next
😂😂😂❤️❤️❤️
Mar 2, 2021, 10:45 AM
Thanks y’a legend Nicolas :)
Mar 2, 2021, 10:45 AM
We’re starting a performance bash in 12hrs and you’re already getting wins on the board for us ❤️❤️❤️
Mar 2, 2021, 10:46 AM
Haha! Nice 😄 ❤️
Mar 2, 2021, 10:46 AM
Love to be distracted by nice shiny features 😉
Mar 2, 2021, 10:47 AM
🏃‍♂️💨
Mar 2, 2021, 10:47 AM
Well if it was that easy to speed up sanity CDN by up to a quarter I’d say it’s a pretty sweet distraction!
Mar 2, 2021, 10:48 AM
and it's live! Look for
*content-encoding:* br
in the response headers 😄
Mar 3, 2021, 8:34 AM
Nice!!! Thanks Nicholas.
Mar 3, 2021, 8:34 AM
Let me know if there are more infra features we can do 😉
Mar 3, 2021, 8:35 AM
You know it :) <3
Mar 3, 2021, 8:39 AM
ooooh, can we do it for SVGs too? Definitely already compressing more on the graphql CDN 🙂, a random example query i just did got 6% smaller
Mar 3, 2021, 10:04 PM
Also interested in what kind of perf timing diff you’re seeing. Its possible it could be a slower first call and faster subsequent calls, very interested in how it impacts your times 🙂
Mar 3, 2021, 10:19 PM
I added brotli for svg's too!
https://cdn.sanity.io/images/qtzcw0t9/production/11f5bbfe343cb8371f867403de78ba05a13c213b-604x640.svg?h=240&q=80&fit=max&auto=format&dpr=1
https://cdn.sanity.io/images/qtzcw0t9/production/fcfc79bf6bd24ac15a0f1e70dc3d05ed4237ba29-306x240.svg?h=240&q=80&fit=max&auto=format&dpr=1 Perf timing is negligible, this is solved when our varnish cache fetches upstream, so you're really getting an image transformation at the same time, the extra 1 ms at that point is nothing. It's stored as brottli compressed inside varnish, and transcoded to gzip if client does not support brottli.
Mar 4, 2021, 11:22 AM
Very cool. Seeing a range of not much to 15% smaller depending on the svg for us in prod. Thanks again Nicholas!
Mar 4, 2021, 11:36 AM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?