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
If you are not using gzip to compress you widgetset artefacts, . In someway or another. There are multiple ways how this can be achieved like:
- Using a servlet filter, like jettys server independent GzipFilter
- 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
- 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.
I have question, on broswers like ie8/ie9 for that matter any of the browsers that dont support WebSockets, we have a fallback option to http streaming when the application uses PUSH mechanism. If we enable Gzip on such applications Vaadin Push doens't seem to work. Can you please confirm this.
Architecture at high level -
App server: Jboss 7.x
Compression Mech - GZip
Vaadin Version - 7.1.x
Browsers Checked - ie8 & ie9
Client OS - Windows 7
Server OS - Windows 7/ Ubuntu Linux 14.04
Please let me know in case you need any addional information.
Hi, unfortunately HTTP streaming is usually incompatible with compression due to the need to buffer the response to compress or decompress it. In Vaadin 7.2 you can use long polling instead of streaming which should also work fine with compression.
You can probably configure your server to selectively enable compression for URIs other than /PUSH/.
We have used Polling for now. But will move to Push once we stop supporting Brwosers that don't support Web Sockets.