Performance for RESTful Web Services with JAX-WS
By sameert on May 23, 2006
|RESTful web services with JAX-WS show some interesting performance characteristics. I ran some tests with WSTest/Japex. The first graphic shows a comparison of a few different method calls using a RESTful endpoint and a WSDL based SOAP endpoint - both doing the same thing i.e accepting XML, Unmarshalling it with JAXB, doing something and Marshalling results back using JAXB. The client does no work in both cases and uses POST operations. As seen, the performance is more or less the same in the firt tests but tends to do better for the non-rest cases for the medium and larger paylods. This is probably more because of the tight integration in the non-rest case between JAX-WS and JAXB with optimized code paths rather than anything else.|
|In another comparison for the same endpoints (RESTful and WSDL based) with a filp on the client for an HTTP GET/POST each, shows how for the POST operation the performance is slightly better for the REST endpoint and significantly better for the GET operation. This is because the test sends the same XML request data and can leverage the HTTP caching framework provided by the server for GET operations. Glassfish servlet/jsp caching details can be found here but with no config the default is 30sec, enough for our test.|
|So how do endpoints compare when the caching framework is not leveraged (request data is randomized) ? RESTful endpoints perform slightly better but as expected there is almost no difference in GET/POST operations for the same RESTful endpoint.|
Bottom line - if you're building RESTful web services (and you understand the tradeoff's of doing so in the first place) GET operations should be your first choice.