The new JAX-WS engine in WebSphere offers a lot of new capabilities, such as SOAP 1.2 support, MTOM-based attachments and Reliable Messaging. It also performs better in general. For new development projects, I usually use JAX-WS.
However, if you have some existing JAX-RPC client code and do not have the opportunity to migrate them to JAX-WS yet, there are some common techniques you can employ to make it perform better.
These are tips that myself and my web services colleagues in IBM GBS and ISSW have built up over the last 5 years.
Tip #1: Always cache and reuse WebSphere generated JAX-RPC stubs: Initialize and cache JAX-RPC stub and reuse it for subsequent invocations. Stub initialization is both CPU and memory intensive. These stubs are thread-safe and you could use the same initialized instance for all threads.
Tip #2: Remember to specify maximum amount of time the client would wait for a synchronous SOAP response: This setting is per service, defined in ibm-webservicesclient-bnd.xmi (syncTimout attribute). In WebSphere 6.0.2, this defaults to 300 seconds which is usually longer than typical requirements. This reduces the amount of time that the container needs to hold on to a thread in case of outages.
Tip #3: Use WebSphere web services caching for services that mostly provide static data (e.g. lookup tables): This reduces the number of outbound calls required and the need for caching manually inside the application. See this link for details.
Tip #4: Enable the use of Local Transport Channel for intra-JVM service invocations: This eliminates the trip to the network stack for intra-JVM web services calls. (enableInProcessConnections)
Tip #5: Reduce data transmission time by compressing SOAP/http payload using gzip: WebSphere supports the compression of request and responses.
(using Http Transport Property: com.ibm.websphere.webservices.http.requestContentEncoding=gzip)
Tip #6: Send large attachments out of band: If possible, send an URL where the client can pick up the attachment; instead of sending it as part of the SOAP with attachment message.
Tip #7: Use SSL instead of WS-Security (XML-Signature, XML-Encryption) if appropriate: This will improve throughput and lower memory requirement for your JAX-RPC client. SSL at the transport level is much more efficient than doing it inside the XML payload.
Tip #8: Tune WebSphere outbound HttpOutboundChannel: Monitor the usage of the outbound HttpConnection pool by this WebSphere trace settings (com.ibm.ws.webservices.engine.transport.channel.OutboundConnectionCache=fine) and adjust maxConenction accordingly.
Key settings include:
com.ibm.websphere.webservices.http.maxConnection (50)
com.ibm.websphere.webservices.http.connectionIdleTimeout (5 seconds)
com.ibm.websphere.webservices.http.connectionTimeout (300 seconds)
For a more detailed description of these settings, see HttpTransport properties in InfoCentre.
That's all for now... Hope this helps!
Billy.
(thanks to Russell Butek, Jackie Paradis and Greg Truty for reviewing this)
Wednesday, October 14, 2009
Subscribe to:
Posts (Atom)