IBM WebSphere DataPower SOA Appliance is a purpose-built device which usually acts as a Gateway and/or Enterprise Service Bus (ESB) to help secure, accelerate, transform, enrich and route messages. This article provides the how-to knowledge of tuning WebSphere DataPower to reach the desired performance results.
The article is will go through the journey of performance tuning starting from profiling to tuning and finally performance testing prerequisites, approaches and some tips.
All information, steps and diagrams in this article are based on the WebSphere DataPower Integration Appliance XI50 device, firmware 18.104.22.168.
Before you start tuning WebSphere DataPower you need to gather some runtime statistics and data for your deployed solution.
Each part of your deployed code (XSLTs), configuration objects (ex:MQ Object), inbound/outbound connections and processing rules should be isolated and profiled to decide which part is most affecting the performance (that is using most of the device resources).
XSLTs is probably the most thing you will find affecting the performance since it is the place where you write your business (sometimes complex) transformation logic, specially if you are using url-open extension function.
WebSphere DataPower provides XSLTs profiling feature, below are the steps needed to enable profiling for all XSLT files executed in any call.
- Go to Objects > XML Processing > XML Manager > default (unless you are using another one)
- In the Main tab, choose a Compile Option Policy (or create another one)
- Edit the selected Compile Option Policy
- Choose the default (or create a new) Profile rule
After saving this new configuration and re-running your client application you can find the profiling results in the following location:
Open Status > XML Processing > Stylesheet Profiles
Figure 1. Profiled Stylesheets
As you can see, it is quite clear from both Count and Time columns which XSLT file is taking more time to execute, also note that the Time value aggregates the time consumed in all execution attempts (shown in Count).
Service Objects such as Web Service Proxy or XML Firewall can be profiled as follows:
This step enables statistics collection, which will be very useful in profiling different objects.
- Open Administration > Device > Statistics Settings
- Enable it – if it is not enabled - and Click Apply
Viewing Profiling Information
Open Status > Connection > Transaction Times
Figure 2. Transaction Times
Now you can see the average transaction time for each of your services.
The message flows are categorized in 4 types:
- Message: The time taken to process the request message received from client, plus processing time by the server, plus time taken to process the server response by the device (The full transaction cycle).
- Request: The time taken by DataPower to process the request message before sending it to the server.
- Server: The time taken by the server to process the request message sent to it by WebSphere DataPower.
- Response: The time taken by WebSphere DataPower to process the message received from the server before sending it back to the client.
Follow the following steps to profile the flow of the message in the device:
Create Message Duration Monitor
- Open Objects > Monitoring > Message Duration Monitor.
- Click Add.
- Choose the measure, which is one of the four types described above.
- Complete the form and Apply.
- Open Control Panel > Status.
- Click on Messages (duration).
- You will find the duration monitor that you have just created.
Figure 3. Message Duration Monitor
You can get a snapshot of inbound, outbound and internal TCP connections, you can also watch services listening on specific ports as shown in Figure 4.
Open Status > IP-Network > TCP Port Status or TCP Port Summary
Figure 4. TCP Port Status
Please note that more connections means more memory and also note that opening/closing a connection consumes CPU time.
In addition to running the performance test on WebSphere DataPower you can re-run the test directly on the backend and compare the latency in the two tests.
This will show if the latency is because of the device or the Backend, this can also be achieved by using a message duration monitor of type "server" as discussed in Message Flows section above.
It is so beneficial to watch the device metrics (CPU, Memory and System Usage) under different situations. This is usually done via periodic SNMP polling in most environments. Monitoring System Load/Usage provides a better metric of appliance load than CPU usage.
CPU and Memory
Open Control Panel > View Status > System Information (memory and CPU usage)
Figure 5. Memory Usage
The System Usage gives you an overview of the load on the Device including CPU, memory, pending messages in processing queue (Work List), file/connection handles and a total load indicator.
Open Status > System > System Usage
Figure 6. System Usage
Note: System Usage is more important and more accurate when compared with CPU usage, since CPU usage can show momentarily spikes while System Usage takes duration into account.
Once you have profiling information, you can create your tuning plan, the next section will discuss and describe the most important tuning steps that will directly affect the performance.
Caching is the most important option for performance tuning, think of the time used for network communication, retrieval of WSDL documents or compiling XSLT files.
WebSphere DataPower provides many options for caching, you can cache XSLT files, documents (specifically remote documents), WSRR WSDL retrieval, LDAP/TAM responses and others, below I will describe the steps to cache the objects mentioned earlier.
XSLTs and Documents
XSLs are cached by default. You can set the number of XSLs to be cached by specifying this option in the XML Manager:
Open Objects > XML Processing > XML Manager > Your XML Manager (or default)
Set XSL cache size to the desired number.
To cache documents, open the Document Cache tab in the XML Manager and set the Document Cache Count to an appropriate number and Document Cache Size to an appropriate positive number.
To cache remote documents do the following:
- Open the Document Cache Policy tab
- Click Add
- Enter the URL Match expression which is any URL either internal or external to the device (ex: WSRR REST Calls)
- Complete the rest of the form
- Apply and Save
Figure 7. Document Cache Policy
WSRR WSDL Retrieval
If you are using WSRR WSDL subscription, the WSDL Retrieval is cached by default, make sure you have selected the appropriate refresh interval.
- Open Control Panel > Web Service Proxy > Your Proxy
- Open WSDL tab
- Expand you WSDL subscription
- Enter an appropriate value for Refresh Interval (note: the default value is ok if you do not have any other preferences)
Figure 8. WSDL Refresh Interval
In the AAA object, the authentication and authorization Cache is set to 3 seconds by default, unless you have a requirement or a logical reason for leaving it low (increasing cache time can lead to weaker security) it will be beneficial - from performance perspective - to increase this value.
Open Objects > XML Processing > AAA Policy > Your Policy
In the Authenticate tab increase the value of Cache Lifetime, in Authorize tab increase the same value.
Figure 9. TAM Authorization Cache Lifetime
HTTP Persistent Connections
HTTP Persistent connections means reusing opened connection for sending multiple messages instead of opening/closing a connection for each message, this option decreases CPU cycles, network traffic and latency. For more information check HTTP Persistent Connections in the Resources section.
WebSphere DataPower supports Persistent connections for inbound/outbound calls as part of HTTP/1.1 specs, it is enabled by default in HTTP related services such as HTTP front side handler, Web Service Proxy and XML Firewall, below is an example of how to control this option in the Web Service Proxy.
- From the Control Panel Open the Web Service Proxy > Your Proxy
- Open the Advanced Proxy Tab
- You can set Persistent Connections "On" or "Off" and specify persistence timeout
Figure 10. Persistent connection settings
Processing Rules are the flows which contains the processing nodes (Action Nodes) that will be applied on incoming messages.
PIPE and NULL Contexts
Whenever applicable use PIPE as Input and Output between two contiguous action nodes, this will prevent extra context processing and will keep memory usage down.
Use NULL as Input or Output of any action that doesn't need to produce or use predecessor actions' results (ex: using a Transform Action to set context variables only), this is beneficial because you will save the time of creating and parsing contexts and the action becomes more readable and self describing, plus the solution will consume less memory.
Limit the usage of asynchronous rules because as you can imagine parallel processing will increase CPU Utilization (Context Switching) and will use more memory, also note that this applies to asynchronous actions too.
Reusable rules are often called many times from parent rules, this may introduce redundancy in action node execution, when using reusable rules, make sure you include only actions that needs to be called many times, other actions (such as Transform Action to set a variable) may be moved to the parent flow to avoid redundancy.
Code for performance from the beginning, below are some XSLT Performance tips.
- Avoid using "//"; specify the node you are targeting using its absolute tree path
- Do not retrieve the same information twice, if you are using dp:variable function or selecting a value from a document <xsl:value-of select="document(/path)"/> more than one time in the same file, it will be better to save it in a variable once and use the variable for later references
WebSphere MQ Queue Manager
When connecting to MQ, use "dpmq://" (which uses a configurable MQ Queue Manager Object) instead of direct MQ connection "mq://", using direct MQ connection will create a queue manager object at runtime and will open a new connection with MQ for each call, instead if you used the MQ Queue Manager Object you will have connection pooling and many other good options.
You can create the MQ Manager Object by doing the following:
- Open Objects > Network Settings > MQ Queue Manager
- Click Add, complete the form and Apply
- You can then use the name of this object in "dpmq://" urls
Figure 11. MQ Queue Manager
WebSphere DataPower supports many types of streaming such as execution streaming (using SAX when executing XSLTs), attachment streaming, message streaming and context streaming (as described in Processing Rules section when using PIPE).
These options provides many advantages, one of which is decreasing memory usage.
For more information about streaming in WebSphere DataPower, you can access the "Optimizing through Streaming" documentation in the Resources section.
This section is a guide for conducting performance tests on WebSphere DataPower devices.
- Set the logging level to error, do not use debug
- Disable any Probe
- Make sure there are no other activities occurring in the device (may be in other domains)
- Before running the test do some warm up calls, this is beneficial in-case you are using caching and also to be sure that the call is successful
- Make sure the environment you are using is similar to that of your customer (specially Network speed and Device type)
- If you are using XML Threat protection, make sure it does not block your test (because of suspecting XML-DOS Attack)
- Use incremental concurrency approach that is starting with small number of threads say 10 and then increasing (30, 50, 80, etc), at a certain level the performance will start to degrade, this way you know the point where you get best performance results (the capacity of your solution).
- Use appropriate thread delay(wait time) in-case you are testing with high concurrency, since by not doing so you are stressing the device and it will affect the performance
- Use different scenarios and datasets in your test, it would be also better if they match real production scenarios
- Try to re-run the test for a long period of time (Endurance Testing), since some problems like memory leaks may only appear in such test
- When generating huge load, make sure you select the appropriate Testing tools and Operating Systems (ex: Linux or Windows Server) since some testing tools and OSs may not be capable of generating load to saturate the device
The below list is a sampling of testing tools available:
- IBM Rational Performance Tester for SOA Quality
- SOAP UI
- Apache Bench
Tips and tricks
Always check the latest firmware and tech-notes through IBM support site for WebSphere DataPower (found in Resources section), they may include fixes and workarounds for performance issues such as memory leaks.
Device Processing Queue
If the client application is sending a large number of messages to the device, and these messages are processed and sent to the server asynchronously and the server wasn't tuned enough to consume these messages with the rate that WebSphere DataPower process and sends them; this may lead to a situation which is similar to Memory Leak as the device queue the messages in memory until the server is able to consume them.
The solution for this situation is to tune the server to accept more messages at any given point in time.
Throughout this article you have learned how to Profile, Tune and Test WebSphere DataPower for Performance, in-case you are using features and objects other than those described in the article; you can still use the provided techniques and examples to reach your tuning objectives.
I would like to thank Bill Hines and Arif Siddiqui for reviewing this article and for their valuable comments.
- Learn more in the IBM WebSphere DataPower SOA Appliances Support , the official support page for DataPower where you can find latest news, support information and tech notes
- Read further about HTTP Persistent Connections.
- Check out "Performance analysis for Java" by Stacy Joines, Ruth Willenborg, and Ken Hygh, on Google Books.
- Check out the "IBM WebSphere DataPower SOA Appliance Handbook" by Bill Hines, John Rasmussen, Jaime Ryan, Simon Kapadia, Jim Brennan, on Safari Books Online.
- "Optimizing through Streaming " is a supplemental document from IBM describing all types of streaming support in WebSphereDataPower.
- In the SOA and Web services area on developerWorks, get the resources you need to advance your skills.
- Browse the technology bookstore for books on these and other technical topics.
Get products and technologies
- Download IBM product evaluation versions or explore the online trials in the IBM SOA Sandbox and get your hands on application development tools and middleware products from DB2®, Lotus®, Rational®, Tivoli®, and WebSphere®.
- Participate in the discussion forum.
- Check out developerWorks blogs and get involved in the developerWorks community.