RequestFactory performance issue

225 views
Skip to first unread message

Jakob Mar

unread,
Mar 2, 2012, 8:35:06 AM3/2/12
to Google Web Toolkit
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?
and if so, why is so slow when working with large object graphs?

Thanks,
Jakob

Thomas Broyer

unread,
Mar 2, 2012, 8:54:34 AM3/2/12
to google-we...@googlegroups.com
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.

Jakob Mar

unread,
Mar 2, 2012, 11:38:17 AM3/2/12
to Google Web Toolkit
Thanks Thomas for your reply.

My Locator's never get called during this method call and the
performance issue is only on my ValueProxy's (no Locator's on them).
The time is about 1 to 50 millisec. per ValueProxy, increasing in each
loop. Any idea why it's taking so long or what could by wrong?

Thomas Broyer

unread,
Mar 2, 2012, 11:59:15 AM3/2/12
to google-we...@googlegroups.com
Hmm, it's probably a bug if this is being called on ValueProxy-s: because they don't have an "identity", there's no way to ever check if they've been "persisted".

If you can confirm that specific line is called for ValueProxy-s, please file a bug, I'll (try to) look at it this week-end. 

Jakob Mar

unread,
Mar 5, 2012, 10:17:03 AM3/5/12
to Google Web Toolkit
I created an issue: http://code.google.com/p/google-web-toolkit/issues/detail?id=7231

I also tried adding this ValueProxy check to the if statement and it
fixed the problem:


if (id.isEphemeral() && !
ValueProxy.class.isAssignableFrom(bean.getType()))
Reply all
Reply to author
Forward
0 new messages