Measure Performance Using IBM i Apache Directives
UPDATED August 21, 2025
Speed is critical when serving APIs and web pages. The IBM HTTP Server (powered by Apache) for i can log the speed of each request.
Here’s how to ensure that the web server will track HTTP request speed at the desired level of precision.
Check for the timing directive
The IBM i’s Create HTTP Server wizard produces a configuration file (httpd.conf) that includes this format string:
LogFormat "%h %T %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
The second directive above is %T. That means time, in seconds, for each complete round-trip request from a browser or API client to your Apache server and back.
If you do not see the %T, you can add it.
I sent a couple of requests to an Apache server that used this LogFormat string. Here’s what was logged:
10.6.4.169 3 - - [01/Jul/2025:12:09:09 -0400] "GET /api/getCustomerList HTTP/1.1" 200 11049946 "-" "AHC/1.0"
10.6.12.58 0 - - [01/Jul/2025:13:36:40 -0400] "POST /api/insuranceApplication HTTP/1.1" 200 107 "-" "AHC/1.0"
To see a precision finer than seconds, you can change the %T
to %{ms}T
for milliseconds, or %{us}T
for microseconds (millionth of a second). (The directive %{ms}T
is equivalent to %D
.) Below, I’ve included all three units of time:
LogFormat "%h secs/millisecs/microsecs: %T/%{ms}T/%{us}T %l %u %t \"%r\" %>s %b microsecs: %D \"%{Referer}i\" \"%{User-Agent}i\"" combined
Here is what the log requests look like after restarting the web server and submitting two more requests::
10.6.4.169 seconds/millisecs/microsecs: 3/324/3249688 - - [01/Jul/2025:14:12:14 -0400] "GET /api/getCustomerList HTTP/1.1" 200 11049946 "-" "AHC/1.0"
10.6.12.58 seconds/millisecs/microsecs: 0/105/105024 - - [01/Jul/2025:14:12:20 -0400] "POST /api/insuranceApplication HTTP/1.1" 200 107 "-" "AHC/1.0"
Find the slowdown, which might NOT be your fault
These timing directives can help diagnose slow performance between Cloud applications (NetSuite, Microsoft Dynamics 365, Salesforce, etc.) that may call an API gateway, which in turn calls your IBM i Apache API endpoint.
If you’re being told your API is slow, review the timing in your Apache access logs. Add more precise timing measurements if needed. If the slowness is on your end, fix it. If not, show them the log that was generated, demonstrating that the issue must be further up the chain.
To eliminate network delays
Because the %T timing directives measure the complete round-trip from browser or API client to your server and back, the response time includes any network delays. To reduce or eliminate network delays in your timing, my trick is to call my IBM i application directly from the IBM i server using curl.
Learn more about Apache Log Directives
For details of each logging option (%h, %T, %l, etc.) in the LogFormat string above, and other logging elements you can add, see the Apache documentation’s Custom Log Formats section.
These directives are another example of how good the Apache Web server is and how its IBM i integration makes things simpler. For additional help in getting the most from your Apache Web Server, see Apache for IBM i: Where to Find Documentation.
Great tip, we’ve started working with IWS and I thinks this could be very helpful, thanks!
Felipe, happy to help! Wishing you success with your IWS projects. If you choose the Apache web server option with IWS, you get all the Apache features, such as the performance timer described here.