Loading...
Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon
TUTORIAL

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

Remember to use compression, at least by using GWT Precompress module to sh

Matti Tahvonen
8 years ago Apr 25, 2014 1:21pm

Hi,

If you are not using gzip to compress you widgetset artefacts, you should. In someway or another. There are multiple ways how this can be achieved like:

These are the options you should use most often.  And the very little you might lose in CPU cycles, you'll win back as your threads are released to serving new requests faster. These "dynamic" compression mechanisms excel as they work for both "widgetset responses" and actual client-server communication.

From those the former is often more important. Doing it significantly reduces startup time, espicially on mobile devices. In Serving the compressed widgetset can also be achieved by "precompressing" widgetset artefacts and serving them instead. This can be slightly more efficient as gzippin happens only once and one can thus use stronger, more cpu intensive settings. Also if for some weird reason you can't setup any of the above, you could use this as a "workaround". 

GWT has a built in linker that can do the gzipping during GWT compilation. Jetty is the only server that I know can automatically serve the precompressed versions (when non compressed are requested), but many web servers can be configured to do the same pretty easily. Too bad most simple Vaadin hosting setups serve static files via VaadinServlet and thus this don't work out of the box, even with Jetty. Luckly one can quite easily customize servlet to serve pre compressed files, on any servlet containers.

Check out this changeset to see the servlet customizations and usage of PreCompress GWT module.

On this topic, Marc's some years old article might also be helpfull.

cheers,
matti

 

Krishna Kotari
8 years ago May 07, 2014 5:41am
Johannes Dahlström
8 years ago May 07, 2014 9:01am
Krishna Kotari
8 years ago May 07, 2014 10:49am