3
votes

as an introduction: I am new to GWT and coding, so my questions may appear basic.

I made web app using GWT, Maven, Hibernate, IntelliJ IDEA. I deployed app on my own Tomcat server (I have separate computer for this: HP ProLiant ML310e Gen8 v2 4-Core 3.1GHz 4GB DDR3 + HDD 2x1TB SATA).

It is simple page with 5 tabs, and it has one .png 48 Kb image as header. The view that is loaded initially has:

  • 2 Labels with few words,
  • CellTable containing 20 rows (content is obtained from database through RPC, from database)
  • 4 Buttons (for table paging)

This view has almost no content, it has following panels just for exact layout I want:

3 VerticalPanels, 6 HorizontalPanels, 1 Tree and 1 Grid

The problem is: . When I run URL first time, it takes 1:09 min to load anything. And every next time I paste URL it takes about second to display app. (after page loading everything goes smoothly, just a second to display widget)

I read this article: http://blog.trifork.com/2007/11/30/optimizing-startup-time-for-gwt-hosted-mode/ , but server runs the app in production mode (GWT.getScript() returns true). I also ran through a few topics on stackoverflow, but I don't see what loading time is "normal" for small size apps.

If time above 30 seconds is required to run anything, then GWT appears unacceptable for typical user, who may think that the link is broken at first time... I don't know how it works - is GWT rebuilding and recompiling the page for every new user request?

3
Are you using the old dev mode or superdevmode? - Chris Hinshaw
Use your developer tools in the browser and look at network transfer times for your rpc calls. If one of them is taking a long time then that is probably where your bottle neck is. - Chris Hinshaw
To give you an idea: I have an app with over 20 different modules, over 100 custom widgets and components, and more than 100 different views ("pages"). The first load in production takes 1-3 seconds depending on the Internet connection speed. Page reloads take less than 0.5 seconds. Obviously, I have used many ways to optimize it, but the initial load time was never anywhere near 1 minute. There must be some specific reason why it loads so slowly. - Andrei Volgin
On a different note, I would use 1 LayoutPanel instead of 9 panels that you use for your layout. - Andrei Volgin

3 Answers

2
votes

I don't know how it works - is GWT rebuilding and recompiling the page for every new user request?

No.

GWT uses caching. The initial loading time is really depends on many factors.

When user/browser requests for the very first time, all the resources related to the page loads. That takes few seconds to load and really depends on your internet speed.

Once the complete page loaded and if you are requesting new page/ reloading the current page, all the resources won't load this time.

Coming to the part that rebuilding and recompiling for each request is wrong. In Gwt there are permutations which are specific to each browser. Every major browser have it's own permutation. If you request from Mozilla for example, permutations related to Mozilla loads. These permutations actually generates at compile time of project which you done in your IDE before deploying the project.

Once the request hit the browser, for very first time these all files related to the specific permutation loads into browser and cached in browser. Form next time on words you won't see any new files loading in to browser (you can see that using your firebug).

Using code splitting, lazy intializations and data compression techniques.

Continue reading .....

2
votes

check yourapp.gwt.xml file if you have inherited some modules that takes time to load.

if so, during first load it takes time and the way gwt works is it loads and maintains a cache for future loads, which answers your problem about taking time to load at first and seconds to load next time.

And gwt does not rebuild or recompile the page, simply displays the page you have compiled

1
votes

Take a look at GWT.runAsync, this will help you to not load everything on startup, just what you need :)