Improving SOAP API Performance for Large Payloads with Apache Commons
Written on
Chapter 1: Understanding SOAP API Limits
When developing an API, it’s crucial to determine the maximum request size your system can handle. Typically, for online requests, the standard upper threshold is around 1 MB. If requests exceed this limit, alternative strategies must be considered, such as breaking down the requests or utilizing different protocols instead of HTTP to manage such loads. However, the reality of implementation often diverges from our initial plans.
In many cases, we may not have the authority to dictate these specifications. While we can discuss the implications of exceeding these limits, we must find practical solutions that work under the circumstances.
Section 1.1: TIBCO BusinessWorks and SOAP Services
By default, exposing a SOAP service in TIBCO BusinessWorks relies on various third-party libraries for request management, parsing, and content access. One such library, developed by the Apache Foundation, is Apache Commons.
For instance, when I send a hefty request—an 11 MB SOAP request to my system—I encounter specific performance issues: the service fails to respond, and there is a noticeable spike in CPU and memory usage as the HTTP Connector threads handle the request prior to passing it to the actual service.
Subsection 1.1.1: Analyzing Performance Bottlenecks
To address these performance issues, we must delve deeper into the elevated CPU usage. By examining the stack trace of the HTTP Connector threads, we can gain insights into what is causing the delays.
Section 1.2: Identifying the Cause of Delays
In our analysis, we find that the bottleneck occurs at the logging method. Interestingly, this occurs despite not configuring logging in BusinessWorks. The reason for this is straightforward: Apache libraries utilize a separate logging system that is independent of the logback configuration used by BusinessWorks.
To mitigate this issue, you can disable the logging with the following JVM property:
-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.NoOpLog
This adjustment has significantly reduced the response time from 120 seconds for the 11 MB request to less than 3 seconds, which is quite remarkable.
Chapter 2: Conclusion and Further Assistance
If you are grappling with similar issues, I hope you find this information valuable. Should you have any questions or require assistance, feel free to reach out through one of the following channels:
- Twitter: Mention me @alexandrev or use the hashtag #TIBFAQS.
- Email: Send your inquiries to [email protected].
- Instagram: DM me at @alexandrev.