aia Posted February 10, 2020 Posted February 10, 2020 Suggestion for future IPS vertions. Put .gz files (with maximum compression level = 9) near all minified static assets. Add some rules to .htaccess in order to serve this precompressed files for clients who supports compressed assets. It saves processor time because there is no need to compress assets each time on the fly. It increases the speed of page loading because precompressed files are much smaller than compressed on the fly. We can use maximum compression without any downsides because files compressed only once they changed.
sudo Posted February 10, 2020 Posted February 10, 2020 Level 9 may be a bit of an issue as its more work for the client to decompress.
Makoto Posted February 10, 2020 Posted February 10, 2020 I've actually looked into this before, but the benefits you gain are microscopic. Like, really, really small. Fractions of a millisecond small. Static resources are also only served once and then cached. Ideally, they're also served over a CDN, not your origin server. Dynamic pages are always compressed on-the-fly and account for most request traffic. So it sounds like a nice idea and theory, but this is severe micro-optimization and not worth coding into the core software itself. Just use a good CDN like Cloudflare that will take care of doing this for you. Also, use Brotli if you can. Brotli > GZip. In regards to compression level, using level 9 generally provides no benefit or further compression compares to level 6 and just increases CPU time for decompression as well as compression, so it's not worth using. 6 is the default and the best sweet spot from a practical standpoint.
bfarber Posted February 10, 2020 Posted February 10, 2020 If you use S3, we do actually pre-compress assets already...
aia Posted February 11, 2020 Author Posted February 11, 2020 @bfarber, why only for S3? I hope to see this available for any environment. Thanks. In my experience benefits of this approach are huge for users with slow connection, especially mobile users.
bfarber Posted February 11, 2020 Posted February 11, 2020 It's been a long time since that was implemented and my memory can only hold so much. As I recall, the reasoning was that most server software (i.e. Apache) can handle dynamically gzipping content, but when you store a static asset on S3 it is served as-is, so we had to do it manually ourselves.
aia Posted February 11, 2020 Author Posted February 11, 2020 But apache and nginx could be easily configured to use pre-compressed files instead of dynamic gzipping, so i hope it will be changed. Thank you!
Recommended Posts
Archived
This topic is now archived and is closed to further replies.