GWT Best practice to send huge amount of data from server to client
Asked Answered
V

4

8

Which are the Best practices to send huge amount of data from server to client in GWT?

Right now we are facing performance issue in GWT 2.3.0.

Our server side is sending huge xml (Size in MB/GB) to client side, our client side parses that xml and using parsed data, list of beans are formed for populating data in Celltable grid.

We are filling 1k + / 10k+ records in CellTable grid.

Is there any effective way/ Best practices followed while dealing with such a huge data? If we parse the data at server side and formed the beans at server side, Is this good? or any alternative way..

Any help or guidance in this matter would be appreciated.

Virchow answered 9/8, 2011 at 11:36 Comment(1)
How well does the data compress? Perhaps compress - send - decompress may be faster if the delay is in the network.Graphemics
C
6

Basically you only request as much data (and a little more) than is currently viewed by the user, not the whole data set.

See Adding Paging Controls for further details.

Charlatanry answered 9/8, 2011 at 11:45 Comment(0)
H
3

Two practices when dealing with large data for your case:

1) Use JSON instead of xml, that way the client doesn't need to parse the data but can directly use the data. In GWT via the GWT-JSNI interface you can write data objects accessing these JavaScript objects, see: http://code.google.com/webtoolkit/doc/latest/DevGuideCodingBasicsJSNI.html. With a JSON REST library you can generate the JSON on the server instead of sending xml to the client. But you can also use GWT-RPC on both client/server, which makes programming easier because the whole data conversion to and from JSON is handled by GWT, but adds some type information to the objects send.

2) Use paging: only get data that is visible to the user and cache it in the client. If you have a table presentation it's not likely the user needs all the data at once. GWT cell panels have support out of the box (see the link Oliver mentions about Adding Paging Controls)

Holley answered 9/8, 2011 at 17:14 Comment(0)
U
3

As in the other answers, return only the data that can usefully be used by the user and lazily fetch other data when the user requests it (or Predictive Fetch).

See AsyncDataProvider section here: http://code.google.com/webtoolkit/doc/latest/DevGuideUiCellWidgets.html#data-provider

Unaccomplished answered 10/8, 2011 at 23:54 Comment(0)
L
2
  1. Use paging. GWT cell widgets support paging out-of-the-box. So implement server side paging so that each time you click 'next' a server call is made. That way, the client only deals with say 10 or 20 records at a time.

  2. Use Javascript Overlay types as the display beans. And to populate these beans, use JSON as the transport model instead of XML. If you use XML (i.e. Async calls), then GWT does some JAXB marshalling/unmarshalling logic in the back end. If you use JSON, much of that is avoided.

Lannie answered 9/8, 2011 at 17:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.