Pergunta

When I create even a simple "hello world" application for Vaadin, deploy it to the server, and type application URL in the browser, I have to wait about 5-10 seconds for the application to appear. Next runs are fast, but when I redeploy or hot-swap classes, I have to wait again. When I add it to database startup time, server startup time, etc, it takes too long.

Is there any way to eliminate this slowness of Vaadin startup? It's important, because each extra slowness makes modify+run+test programming cycle more frustrating - not all code can be unit-tested, the only way to test some things is manual modify+run+test.

Similar problem exists with GWT debug mode. Because Vaadin is based on GWT, perhaps the reason of this slowness is not in Vaadin but in GWT?

My environment: IntelliJ 9 + Tomcat 6 + Windows 7 64-bit + fast Core 2 Duo

Foi útil?

Solução

If it is slow when the Vaadin application is restarted: Check that your Application.init() method is not making anything too heavy - database connections, loading lot of data etc. You can force this session restart in Vaadin with URL parameter ?restartApplication

If the hot deployment is slow even when the application is not restarted (UI state remains): This has something to do with the client-side (GWT) part of Vaadin. Might be that caching is somehow completely ignored. Widgetset opimization might help.

Outras dicas

Vaadin spend most of this time here com.vaadin.terminal.gwt.server.AbstractApplicationServlet#serveStaticResourcesInVAADIN (actually servlet container, not vaadin itself)

I think it's because vaadin.jar is too large.

So You can just extract VAADIN dir from vaadin.jar to your webRoot and application startup time will reduce.

Other very good (but paid) solution is http://zeroturnaround.com/jrebel

The problem is caused by all the Java classes being loaded for the first time, subsequent calls can use the cached classes.

However 5-10 seconds is, imho, really not that bad, I've had much worse.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top