overhangio / tutor-mfe

This plugin makes it possible to easily add micro frontend (MFE) applications on top of an Open edX platform that runs with Tutor.
GNU Affero General Public License v3.0
22 stars 95 forks source link

feat: enable gzip compression #64

Closed ghassanmas closed 2 years ago

ghassanmas commented 2 years ago

Compressing assests would lead to readuce transfer size. As testing with frontend-app-learning/Olive, the network traffic before was about ~4MB, after this it became ~1MB.

This change was suggested by Google Lighthouse1, there are of course more suggestion but this was one the easiest and one of most impactful.

Lighthouse score before:

image

Suggestion Before

image

Lighthouse score after:

image

Suggestions After

image
regisb commented 2 years ago

This looks like a 100% beneficial change. May I suggest that we add this encode gzip directive to the base proxy directive in the core Caddy config? https://github.com/overhangio/tutor/blob/7453e70fa08943652f72bb7956872ce44e2b1bdf/tutor/templates/apps/caddy/Caddyfile#L25 When loading the LMS dashboard I get the following improvement : 2.39 MB / 651.91 KB transferred Without gzip encoding I get 2.39 MB / 2.39 MB transferred. So it's a ~75% page size decrease!

ghassanmas commented 2 years ago

Make sense!, and then both the lms/cms, can benfit from it. I will open a PR on tutor, and I will add link/info about the defaults.

arbrandes commented 2 years ago

@ghassanmas, can you confirm that after https://github.com/overhangio/tutor/pull/735 this is no longer necessary?

ghassanmas commented 2 years ago

Yes, it no need for it at the tutor-mfe level... It's already in tutor nutmeg/master but for olive I suppose tutor olive branch would at somepoint to pick commits from master i.e rebased