Blog

Is your Vaadin application becoming sluggish?

By  
Sami Ekblad
Sami Ekblad
·
On Sep 16, 2009 1:36:00 PM
·

(by Matti Tahvonen)

Yes, this can happen - it is no secret. This can happen for every application, with every programming language, with every UI library and with all hardware platforms. Make it a web application and it is not even hard. For end users this is not acceptable, especially when building applications for frequent use.

All developers have heard the phrase premature optimization is the root of all evil, coined by software guru Donald Knuth. There is a wisdom in that clause. Still I want to motivate you (Vaadin developer) to read this article, even if you currently have no performance issues. I'd say it is not that bad to know what will inevitably make your application slow. You might subconsciously avoid the worst pitfalls (but still not be subjected to premature optimization) and avoid optimization task totally.

Resolving performance issues in Vaadin-based applications may be a bit tricky in some situations. Performance issues are one of the most common issues why project managers in IT Mill come and disturb our "peace" in the RnD team. Usually we'll end up modifying the application, not Vaadin. Vaadin abstracts away the browser environment, and the abstraction may make it hard to figure out what is the actual cause for a slow UI.

The first step is to detect whether to optimize the server side or the client side. You can use all standard profiling tools with Vaadin apps like Firebug for the client side and JProfiler for the server side. For a quick look for what is taking so long it is easy to use "?debug" query parameter in application. It will show you a small floating console in the browser. Inspecting messages there, one can see server visit time (includes both network latency and server processing time) and the actual time spent handling the response in client.

If the problem is on server side, it is most commonly in the back-end system or how it is connected to Vaadin components. The server side code of Vaadin is pretty well optimized by the JVM. If the server side is your problem, I'd bet you will end up optimizing SQL queries. Optimizing tricks for server side are very similar to any other Java application.

If it is the client side processing that takes a long time, optimizing methods are more Vaadin specific. There are several tricks one can perform to optimize the client side processing time. Some of them are more or less generic to ajax applications in common, others are purely Vaadin specific. If you belong to the large group of Java developers who hate browser programming, you don't need to get worried at this point. Although the processing time is long on client, you will be mostly modifying the pure server side Java code when optimizing your application.

Read top optimization tips and tricks from Vaadin Wiki

 

Sami Ekblad
Sami Ekblad
Sami Ekblad is one of the original members of the Vaadin team. As a DX lead he is now working as a developer advocate, to help people the most out of Vaadin tools. You can find many add-ons and code samples to help you get started with Vaadin. Follow at – @samiekblad
Other posts by Sami Ekblad