开发者

Where to store the data for a GWT app - GAE data store or XML file

I have a GWT app which is deployed on GAE. One part of my application relies on static data, which is currently stored in an XML file. The application reads this data into a collection of POJOs. The data is sent over to the client using GWT-RPC. Based on the selections made by the user, it applies filters to the collection to get specific objects (the filtering is done on the client side).

The data may开发者_Go百科 contain up to 3000 records, and the total XML file size would be around 1MB. There'll be no updates on this data from the application side (it's read-only), but I may be frequently adding new records or updating/fixing existing records during the initial few months (as the application evolves). The data has no relationship with any other data in the application.

One of my main consideration in fetch performance. I tried using Apache Digester to parse the XML, but noticed that even parsing 600 records and sending them to the client was a bit slow.

Given these requirements which of the following would be better and why - 1. Keep the data in the XML file, or 2. Store the data in the app engine data store?

Thanks.


One alternative would be to load the XML file directly by GWT (without GWT-RPC and server parsing):

  1. Use RequestBUilder to get the data from the server. Example usage: http://www.gwtapps.com/doc/html/com.google.gwt.http.client.html

  2. Then use XMLParser to parse the reply. Example: http://code.google.com/webtoolkit/doc/latest/DevGuideCodingBasicsXML.html#parsing

Here's an example combining both: http://www.roseindia.net/tutorials/gwt/retrieving-xml-data.shtml

The only downside is that you have to manually parse XML via DOM, where GWT-RPC directly produces objects.

Update:

based on the comments I'd recommend this:

  1. Parse XML file with JAXB to create your objects: http://jaxb.java.net/guide/_XmlRootElement_and_unmarshalling.html

  2. Save those to memcache: http://code.google.com/appengine/docs/java/memcache/overview.html

  3. On RPC request, check memcache, if data not there goto 1.


The way I look at things, there are two bottle necks, though interrelated. One is loading the data (reading from XML, parsing). Another is sending it to the client. Instead of sending the whole bunch, you might consider batch sending, like pagination.

Usually I prefer storing such files under WEB-INF.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜