Tuesday, August 31, 2010

Re: Speed-Optimization of an application (RPCs, Architecture)

Hi Fabian, 

Generally speaking, the fewer rpc calls the better, as browsers generally limit the number of simultaneous (http) calls to the same domain to two. If you make more, they will be queued. Therefore, it is often a good practice to batch these calls (see for example http://stackoverflow.com/questions/236793/how-to-group-gwt-rpc-calls). I think the new RequestFactory, as well as GWT-Platform, allow you to do that more easily. 
That said, if you want to have a tab immediately loaded, and if the other tabs can wait a bit, you could make one call to retrieve the data of this first tab, and a second one where you batch all the other RPCs (needed for the other tabs). It could be useful particularly if these calls take some time to be processed server-side: you don't want to wait for all of them to finish before sending the data of the first tab.
Hope this helps,

-- 
Tanguy

2010/8/31 Fabian <fabi.ginter@web.de>
Hi all,

first of all i am sorry if my english is not always correct, but i'll
do my best.

I'm pretty new to the GWT and just finished writing my first
application and i have a few questions. I couldn't find answers to
them in this group, the GWT docs or with the help of google. If there
are already existing topics i would be thankful for some links.

First a short description of my app:
The UI consists basically of a tabpanel. If there's a change in the
app required, which means new data from server is needed i.e. due to a
new history item typed in the adress bar, each tab of the tabpanel
gets the data from the server with a RPC.
Assume an app which shows a soccer player: The first tab shows his
picture, the second his characteristics like size, weight, etc., the
third tab shows his club history and so on.
The first tab is the one, that i want to be loaded as fast as
possible, because this is what i want to show immediately (while first
tab is loading, i'll show a loading screen). The data of the other
tabs can be loaded afterwards (without loading screen). What's the
best way to do that? At the moment, i have 8 tabs and i call first the
RPC for tab1, then RPC for tab2 etc.
S.th. like that:

loadPlayer(String inputPlayer){
   rpc_loadImage(inputPlayer); // <-- this is what i want to have
high priority
   rpc_loadCharacteristics(inputPlayer);
   rpc_loadClubHistory(inputPlayer);
   etc.
}

1.) But because RPCs are of course asynchronous, it happens that RPC
for tab2 returns before the RPC for tab1. I know i could start the
other RPCs after receiving the first one, but is this the right way to
do it?

2.) Another thing: Is it in general good to have more or less RPCs
which are called at a time (i could merge a few if it would help)?

Hope someone can help me!

Thanks in advance,
Fabian

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.


--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment