I am observing really bad performance when using GWT requestfactory. For example, a request that takes my service layer 2 seconds to fullfil is taking GWT 20 seconds to serialize. My service is returning ~100 what will be EntityProxies. Each of these objects has what will become 4 ValueProxies and 2 more EntityProxies (100 root level EntityProxies, 400 ValueProxies and 200 additional EntityProxies). However, I see the same 10x performance degradation on much smaller datasets.
Example of log snippet:
D 2012-10-18 22:42:39.546 ServiceLayerDecorator invoke: Inoking service layer took 2265 ms
D 2012-10-18 22:42:58.957 RequestFactoryServlet doPost: Entire request took 22870 ms
I have added some profiling code to the ServiceLayerDecorator#invoke
method and wrapped the entire servlet in a timer. I have profiled the service by itself, and it is indeed returning results in ~2s.
I am using GWT 2.4, but have tested this on GWT 2.5rc1 and GWT 2.5rc2. My backend is on GAE, but I dont think that is playing a role here.
I found this bug filed against 2.4, which seems to be very related. I have manually applied the patch from this google group without any luck.
My domain models look like:
class Trip {
protected Address origin; // becomes ValueProxy
protected Address destination; becomes ValueProxy
protected Set<TripPassenger> tripPassengers; // Set of ValueProxies
}
class TripPassenger {
protected Passenger passenger;
}
class Passenger {
protected Account account;
}
My question is:
- Have I profiled the code correctly and isolated the problem to the GWT serialization?
- Could I be doing something wrong that would cause this behavior?
- How can I better profile the GWT serialization code to try and figure out the cause?