SOAP Response time for first request is relatively slow

Date: August, 2008
Product/Release: LANSA Integrator
Abstract: SOAP Responses for first request and also for a request after a period of Idle time is relatively slower.
Submitted By: LANSA Technical Support


It is often queried as to why certain SOAP Requests takes a longer time to respond, specifically when it is the first request or after a period of idle time.

For example, a SOAP Server response may take about 7 seconds to complete for all requests, except with the following 2 scenarios:

Scenario 1: The very first time that an Order Request is made.

Scenario 2: Integrator and Apache jobs sit idle for 1 hour causing JVM to cleanup.

In effect, the same JVM behavior is causing both problems in scenario 1 and 2.

First-time load penalty:
The problem is that for the first request, there is extra time taken for the JVM to load classes from the disk ( IFS ) into memory and do bytecode verification.

Lengthy period of idle time:
Additionally, when Java Classes have not been used for 20 minutes, the JVM reclaims these Class objects. So after one hour there are no Classes in memory, so the JVM needs to reload the Classes from disk ( IFS ) again. Thus the first-time Load Penalty applies again


The Solution is to add a simple operation to the SOAPServer service and call this operation every 15-20 minutes.

For example, add an operation to the SOAPServerWizard project called noop. ( noop stands for No operation ), shown below.

Example screen showing how to add an operation to the SOAPServerWizard

Generate the WSDL like before.

Create an RDML function using the SOAPAgentWizard + WSDL to generate our own SOAPAgent code.

Call this SOAPAgent RDML function once when the JSM starts and then one every 15 minutes to keep the necessary Classes in memory, so they will not be Garbage collected.

With IBM i 6.1

With IBM i 6.1, the IBM Technology for Java JDK's can load the Classes a lot faster than the Classic JDK's, so Java Class loading will no longer be a problem.

Also no optimized Java programs are created, so disk space is saved.