GWT-RPC vs HTTP Call - which is better?

Nirmal Patel picture Nirmal Patel · Jun 2, 2010 · Viewed 7.6k times · Source

I am evaluating if there is a performance variation between calls made using GWT-RPC and HTTP Call.

My appln services are hosted as Java servlets and I am currently using HTTPProxy connections to fetch data from them. I am looking to convert them to GWT-RPC calls if that brings in performance improvement.

I would like to know about pros/cons of each...

Also any suggestions on tools to measure performance of Async calls...

[A good article on various Server communication strategies which can be employed with GWT.]

Answer

Jason Hall picture Jason Hall · Jun 2, 2010

GWT-RPC is generally preferred when the backend is also written in Java because it means not having to encode and decode the object at each end -- you can just transmit a regular Java object to the client, and use it there.

JSON (using RequestBuilder) is generally used when the backend is written in some other language, and requires the server to JSON-encode the response object and the client to JSON-decode it into a JavaScriptObject for use in the GWT code.

If I had to guess I'd say that GWT-RPC also results in smaller transport objects because the GWT team optimizes for this case, but either will work, and JSON can still be pretty small. It just comes down to a matter of developer convenience in most cases.

As for tools to measure request time, you can either use Chrome/Webkit's developer tools, or Firefox's Firebug extension, or measure request time in your app and send that metrics data back to your server in a deferred request for collection and analysis.