简体   繁体   中英

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

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.

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.

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)

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

  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 (ie Async calls), then GWT does some JAXB marshalling/unmarshalling logic in the back end. If you use JSON, much of that is avoided.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM