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:
- Using a servlet filter, like jettys server independent GzipFilter
[list]
- Example setup in server independent Java EE project:
dependency
+
servlet3 style configuration
gzip is automatically on on all app servers. In addition to Jetty implementation, there are several others available as well
[/list] - Using server specific features like
tuning the http connector in Tomcat
- If you are using a “front proxy” like Apache httpd or nginx, you could
do it there as well
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