I am transferring a list of objects to the client with GWT Request Factory. The objects contain only a couple of strings and the list does only contain 20 objects. To transfer this small list of data, it takes over a second. First I thought the query needs to be optimised. But the measurement shows:
The retrieval of the objects from the database only takes
300ms
The transfer to the client takes in total over a second
1136ms
So this seems to be request factory overhead. I already use my own ServiceLayerDecorator
and have overridden the isLive()
function so it always return true
. Are there any other actions I can take to speed this up and bring the performance to an acceptable area?
Update:
I created the logic to copy my entity object data to DTO and transfered them with RPC to compare the RPC and Request factory peformance. As you can see the RPC logic is much faster. Now I am wondering if that is by design or if there is a flaw in my application.
20 transfered objects:
Request factory: 1252 ms
RPC: 420 ms
28 transfered objects:
Request factory: 1654 ms
RPC: 460 ms
78 transfered objects:
Request factory: 3963 ms
RPC: 769 ms
============================================================
Update2
So I wrote a very simple sample application to make sure my application does not have any filters or other interfering components. The applications loads 10 objects with 4 String fields from the server. I did it with Request factory as well as RPC and stopped the time.
The code can be found here: https://github.com/jan10101/requstFactoryVSRPC
A life demo here: http://requestfactorytest.appspot.com/
The test application confirms my observation: The request factory performance is really bad compared to the RPC performance. In dev mode the performance of RPC is about 40 times better, in production mode still 4 times. Am I the first one noticing the performance issues?
The following screenshots show the test results if you don't want to try it yourself.
Results in dev mode:
Results of productive code (on app engine):
onSuccess()
method of the request. I tested in dev mode - I know that the app is slower in development mode, but in production code the request is slow as well. – TortolaRequestFactoryServlet
is the entry point to handling the request. You could set the java system propertygwt.rpc.dumpPayload
to true. Depending on your server logging this may include timestamps. Or override theRequestFactoryServlet.doPost(...)
method. On the client side it is possible to intercept the response by overriding theDefaultRequestTransport
used by yourRequestFactory
class and see the responses as text before they are deserialised into javascript objects (or Java objects in dev mode). See stackoverflow.com/questions/7608235 – DainaRequestFactoryServlet.doPost()
takes up 1s of the 4s total for the 78 object request. So at least it seam there is no single point takes up a lot of time... – TortolaRequestFactory
makes use of reflection (#12978422) to populate theProxys
and this will probably take more time than wtihRPC
. – Hedron