Friday, March 2, 2012

Re: RequestFactory performance issue


On Friday, March 2, 2012 2:35:06 PM UTC+1, Jakob Mar wrote:
Hello,

I'm encountering performance issue in RequestFactory when sending
large complicated object graphs to the server.
After some debuging I found out that the problem is in line 267 in
SimpleRequestProcessor.createReturnOperations

     if (id.isEphemeral()) {
        // See if the entity has been persisted in the meantime
        returnState.getResolver().resolveClientValue(domainObject,
id.getProxyClass(),
            Collections.<String> emptySet());
      }

Request that takes about 20 sec. goes down to 2 sec. if I skip this
code like this:

     if (id.isEphemeral()) {
        // See if the entity has been persisted in the meantime
        //returnState.getResolver().resolveClientValue(domainObject,
id.getProxyClass(), Collections.<String> emptySet());
      }

It dosen't seem to have any other effect on my app.
So I wonder, is it realy necessary to see if the entity has been
persisted in the meantime?

Yes, to assign them "server IDs", so the next time you send the entity to the server (or you find() it using its stableId()), it'll be looked up in the data store (i.e. your Locator's find() will be called, not create()).
 
and if so, why is so slow when working with large object graphs?

It entirely depends what your Locator's find() does here, and whether it can benefit from a local cache (EntityManager's session cache for instance).
Because this is done for each and every entity created on the client side, it becomes slower as the number of entities grows.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/jQ4zxoFd94gJ.
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