findingmarbles / Retromat

Retromat: Plans for (agile) retrospectives - Create, tweak, print, share
46 stars 25 forks source link

Enable GZIP compression for static assets for better performance #59

Closed technopagan closed 6 years ago

technopagan commented 6 years ago

Several plain text assets are currently not being served gzipped by the Uberspace server. See this table from WebPagetest:

Use gzip compression for transferring compressable responses: 40/100

279.2 KB total in compressible text, target size = 109.7 KB - potential savings = 169.5 KB

FAILED - (111.2 KB, compressed = 35.1 KB - savings of 76.1 KB) - https://plans-for-retrospectives.com/activities.json?locale=en FAILED - (61.8 KB, compressed = 21.1 KB - savings of 40.7 KB) - https://plans-for-retrospectives.com/piwik/piwik.js FAILED - (18.4 KB, compressed = 5.2 KB - savings of 13.2 KB) - https://plans-for-retrospectives.com/en/ FAILED - (13.9 KB, compressed = 3.6 KB - savings of 10.3 KB) - https://plans-for-retrospectives.com/static/functions.js FAILED - (11.4 KB, compressed = 2.7 KB - savings of 8.7 KB) - https://plans-for-retrospectives.com/static/lightbox/lightbox.js FAILED - (11.4 KB, compressed = 3.1 KB - savings of 8.3 KB) - https://plans-for-retrospectives.com/static/retromat.css FAILED - (9.2 KB, compressed = 2.5 KB - savings of 6.7 KB) - https://plans-for-retrospectives.com/static/lang/photos.js FAILED - (4.5 KB, compressed = 1.6 KB - savings of 2.9 KB) - https://plans-for-retrospectives.com/static/images/icons.svg FAILED - (3.7 KB, compressed = 1.1 KB - savings of 2.6 KB) - https://plans-for-retrospectives.com/static/lightbox/lightbox.css

By adding "AddOutputFilterByType DEFLATE" followed by the desired mime types, we can enable GZIP compression for those assets on Uberspace. See this Uberspace Wiki entry on compression: https://wiki.uberspace.de/webserver:htaccess#kompression

technopagan commented 6 years ago

Thank you, @fiddike! It looks much better already for GZIP - many more assets are now being served with GZIP compression during transfer.

There's one last offender that we didn't seem to have covered with the initial PR: https://www.webpagetest.org/performance_optimization.php?test=180307_YN_e2310cee72ead4fa3318d29584ed6b97&run=5#compress_text

I'll try to figure out how we best target this json response so that it becomes GZIPed, too.