IBM HTTP Server Performance Tuning
- IBM HTTP Server Performance Tuning
- 1. Determining maximum simultaneous connections
- 1.1. TCP connection states and thread/process requirements
- 1.2. Handling enough simultaneous connections with IBM HTTP Server on Windows / ThreadsPerChild setting
- 1.3. Handling enough simultaneous connections with IBM HTTP Server 2.0 and above on Linux and Unix systems
- 1.4. Handling enough simultaneous connections with IBM HTTP Server 1.3.x on Linux and Unix systems
- 2. Out of the box tuning concerns
- 3. Configuration features to avoid
- 4. Common configuration changes and their Implications
- 5. WebSphere plug-in concerns on Linux and Unix systems
- 6. SSL Performance
- 6.1. ciphers
- 6.2. Server certificate size
- 6.3. Linux and Unix systems, IBM HTTP Server 2.0 and higher: ThreadsPerChild
- 6.4. AIX, IBM HTTP Server 2.0 and higher: MALLOCMULTIHEAP setting in IHSROOT/bin/envvars
- 6.5. Should I use a cryptographic accelerator?
- 6.6. HTTP keep-alive and SSL
- 6.7. SSL Sessions and Load Balancers
- 6.8. Session ID cache limits
- 7. Network Tuning
- 8. Operating System Tuning Reference Materials
- 9. Memory use comparison between IBM HTTP Server 1.3 and IBM HTTP Server 2.0
- 10. Slow startup, or slow response time from proxy or LDAP with IBM HTTP Server 2.0 or above on AIX
- 11. High disk I/O with IBM HTTP Server on AIX
- 12. High CPU in child processes after WebSphere plugin config is updated
- 13. Access logs
- 14. z/OS Considerations
- 1. Determining maximum simultaneous connections
1. Determining maximum simultaneous connections
The first tuning decision you’ll need to make is determining how many simultaneous connections your IBM HTTP Server installation will need to support. Many other tuning decisions are dependent on this value.
For some IBM HTTP Server deployments, the amount of load on the web server is directly related to the typical business day, and may show a load pattern such as the following:
Simultaneous connections | 2000 | | | ********** | **** *** 1500 | ***** ** | **** *** | *** *** | * ** 1000 | * ** | * * | * * | * * 500 | * * | * * | ** * | *** *** 1 |*** ** Time of +------------------------------------------------------------- day 7am 8am 9am 10am 11am 12am 1pm 2pm 3pm 4pm 5pm
For other IBM HTTP Server deployments, providing applications which are used in many time zones, load on the server varies much less during the day.
The maximum number of simultaneous connections must be based on the busiest part of the day. This maximum number of simultaneous connections is only loosely related to the number of users accessing the site. At any given moment, a single user can require anywhere from zero to four independent TCP connections.
The typical way to determine the maximum number of simultaneous connections is to monitor mod_status reports during the day until typical behavior is understood, or to use mod_mpmstats (2.0.42.2 and later).
The information in this document assumes the tuning exercise is occurring on an individual instance of IBM HTTP Server. When scaled horizontally across a farm of webservers, you may need to account for a swelling of connections when some capacity is removed for maintenance or otherwise taken offline.
Monitoring with mod_status |
|
Monitoring with mod_mpmstats (IBM HTTP Server 2.0.42.2 and later) |
|
Note that if the web server has not been configured to support enough simultaneous connections, one of the following messages will be logged to the web server error log and clients will experience delays accessing the server.
Windows [warn] Server ran out of threads to serve requests. Consider raising the ThreadsPerChild setting Linux and Unix [error] server reached MaxClients setting, consider raising the MaxClients setting
Check the error log for a message like this to determine if the IBM HTTP Server configuration needs to be changed. When MaxClients has been reached, new connections are buffered by the operating system and do not consume a request processing thread until the current work can complete. The length of this queue is controlled by the OS and can be influenced by the ListenBacklog
directive.
Once the maximum number of simultaneous connections has been determined, add 25% as a safety factor. The next section discusses how to use this number in the web server configuration file.
As you approach a requirement exceeding 3000-4000 simultaneous connections, you will have to instead fan out to more instances of IHS, generally on different OS instances. Exceeding this soft limit is not recommended and may result in unpredictable/unintuitive behavior.
Note: Setting of the KeepAliveTimeout can affect the apparent number of simultaneous requests being processed by the server. Increasing KeepAliveTimeout effectively reduces the number of threads available to service new inbound requests, and will result in a higher maximum number of simultaneous connections which must be supported by the web server. Decreasing KeepAliveTimeout can drive extra load on the server handling unnecessary TCP connection setup overhead. A setting of 5 to 10 seconds is reasonable for serving requests over high speed, low latency networks.
Looking at output from mod_mpmstats (2.0.42.2 and later) can help see if KeepAliveTimeout is set correctly.
For example:
[Thu Aug 28 10:12:17 2008] [notice] mpmstats: rdy 0 bsy 600 rd 1 wr 70 ka 484 log 0 dns 0 cls 45
shows that all threads are busy (0 threads are ready “rdy”, 600 are busy “bsy”). 484 of them are just waiting for another keepalive request (“ka”), and yet the server will be rejecting requests because it has no threads available to work on them. Lowering KeepAliveTimeout would cause those threads to close their connections sooner and become available for more work.
1.1. TCP connection states and thread/process requirements
The netstat command can be used to show the state of TCP connections between clients and IBM HTTP Server. For some of these connection states, a web server thread (or child process, with 1.3.x on Unix) is consumed. For other states, no web server thread is consumed. See the following table to determine if a TCP connection in a particular state requires a web server thread.
TCP state | meaning | is a web server thread utilized? |
LISTEN | no connection | no |
SYN_RCVD | not ready to be processed | no |
ESTABLISHED | ready for web server to accept and process requests, or already processing requests | yes, as soon as the web server realizes that connection is established; but if there aren’t enough configured web server threads (e.g., MaxClients is too small), the connection may stall until a thread becomes ready |
FIN_WAIT1 | web server has closed the socket; the connection remains in this state until an ACK is received from the client. | A web server thread can be utilized for up to two seconds in this state if FIN is not received from the client, after which the web server gives up and the web server thread is no longer utilized. |
CLOSE_WAIT | client has closed the socket, web server hasn’t yet noticed | yes |
LAST_ACK | client closed socket then web server closed socket | no |
FIN_WAIT2 | web server closed the socket then client ACKed; the connection remains in this state until a FIN is received from the client or an OS-specific timeout occurs; see Connections in the FIN_WAIT_2 state and Apache for more information | A web server thread can be utilized for up to two seconds in this state if FIN is not received from the client, after which the web server gives up and the web server thread is no longer utilized. |
TIME_WAIT | waiting for 2*MSL timeout before allowing quad to be reused | no |
CLOSING | web server and client closed at the same time | no |
1.2. Handling enough simultaneous connections with IBM HTTP Server on Windows / ThreadsPerChild setting
IBM HTTP Server on Windows has a Parent process and a single multi-threaded Child process.
On 64-bit Windows OS’es, each instance of IHS is limited to approximately 2000 ThreadsPerChild. On 32-bit Windows, this number can be closer to 4000. These numbers are not exact limits, because the real limits are the sum of the fixed startup cost of memory for each thread + the maximum runtime memory usage per thread, which varies based on configuration and workload. Raising ThreadsPerChild and approaching these limits risks child process crashes when runtime memory usage puts the process address space over the 2GB or 3GB barrier. The upper limits become even more restrictive when loading other modules such as mod_mem_cache
, or when there are many RewriteCond/RewriteRule directives. When approaching the limits, the server may run for awhile before the memory limit is exceeded and causes the child process to crash. Values even higher than this would probably cause an immediate crash during startup.
No specific limits can be provided, but it is suggested that anything over a value of 2000 for ThreadsPerChild on a Windows operating system could be at risk.
It should be noted that IHS on Windows is a 32-bit application even when running on a 64-bit Windows OS.
The relevant config directives for tuning the thread values described in this section on Windows are:
- ThreadsPerChild
The ThreadsPerChild directive places an upper limit on the number of simultaneous connections the server can handle. ThreadsPerChild should be set according to the maximum number of expected simultaneous connections, but within the restrictions described above. - ThreadLimit (valid with IHS 2.0 and above)
ThreadsPerChild has a built in upper limit. Use ThreadLimit to increase the upper limit of ThreadsPerChild. The value of ThreadLimit affects the size of the shared memory segment the server uses to perform inter-process communication between the parent and the single child process. Do not increase ThreadLimit beyond what is required for ThreadsPerChild.
With PI04922, it’s possible to use nearly twice as much memory (nearly twice as many threads). See PI04922.
Recommended settings:
Directive | Value |
ThreadsPerChild | maximum number of simultaneous connections (within memory constraints) |
ThreadLimit | same as ThreadsPerChild (2.0 and above) |
1.3. Handling enough simultaneous connections with IBM HTTP Server 2.0 and above on Linux and Unix systems
On UNIX and Linux platforms, a running instance of IBM HTTP Server will consist of one single threaded Parent process which starts and maintains one or more multi-threaded Child processes. HTTP requests are received and processed by threads running in the Child processes. Each simultaneous request (TCP connection) consumes a thread. You need to use the appropriate configuration directives to control how many threads the server starts to handle requests and on UNIX and Linux, you can control how the threads are distributed amongst the Child processes.
Relevant config directives on UNIX platforms:
- StartServersThe StartServers directive controls how many Child Processes are started when the web server initializes. The recommended value is 1. Do not set this higher than MaxSpareThreads divided by ThreadsPerChild. Otherwise, processes will be started at initialization and terminated immediately thereafter.Every second, IHS checks if new child processes are needed, so generally tuning of StartServers will be moot as early as a minute after IHS has started.
- ServerLimitThere is a built-in upper limit on the number of child processes. At runtime, the actual upper limit on the number of child processes is
MaxClients
divided byThreadsPerChild
.This should only be changed when you have reason to change MaxClients or ThreadsPerChild, it does not directly dictate the number of child processes created at runtime.It is possible to see more child processes than this if some of them are gracefully stopping. If there are many of them, it probably means that MaxSpareThreads is set too small, or that MaxRequestsPerChild is non-zero and not large enough; see below for more information on both these directives.
- ThreadsPerChildUse the ThreadsPerChild directive to control how many threads each Child process starts. More information on strategies for distributing threads amongst child processes is included below.
- ThreadLimitThreadsPerChild has a built in upper limit. Use ThreadLimit to increase the upper limit of ThreadsPerChild. The value of ThreadLimit affects the size of the shared memory segment the server uses to perform inter-process communication between the parent and child processes. Do not increase ThreadLimit beyond what is required for ThreadsPerChild.
- MaxClientsThe MaxClients directive places an upper limit on the number of simultaneous connections the server can handle. MaxClients should be set according to the expected load.
The MaxSpareThreads and MinSpareThreads directives affect how the server reacts to changes in server load. You can use these directives to instruct the server to automatically increase the number of Child processes when server load increases (subject to limits imposed by ServerLimitand MaxClients) and to decrease the number of Child processes when server load is low. This feature can be a useful for managing overall system memory utilization when your server is being used for tasks other than serving HTTP requests.
Setting MaxSpareThreads to a relatively small value has a performance penalty: Extra CPU to terminate and create child processes. During normal operation, the load on the server may vary widely (e.g., from 150 busy threads to 450 busy threads). If MaxSpareThreads is smaller than this variance (e.g., 450-150=300), then the web server will terminate and create child processes frequently, resulting in reduced performance.
Recommended settings:
Directive | Value |
ThreadsPerChild | Leave at the default value, or increase to a larger proportion of MaxClients for better coordination of WebSphere Plugin processing threads (via less child processes). Larger ThreadsPerChild (and fewer processes) also results in fewer dedicated web container threads being used by the ESI invalidation feature of the WebSphere Plugin.Increasing ThreadsPerchild too high on heavily loaded SSL servers may incur more CPU and throughput issues, as there is additional contention for memory. |
MaxClients | maximum number of simultaneous connections, rounded up to an even multiple of ThreadsPerChild |
StartServers | 2 |
MinSpareThreads | The greater of “25” or 10% of MaxClients integer. Since IHS checks this value approximately once per second, MinSpareThreads should safely exceed the number of new requests you might receive in a second.Setting MinSpareThreads too high with the WebSphere Plugin may trigger premature spawning of new child processes, for which AppServer requests will be distributed over, with no sharing of MaxConnections counts or markdowns. If the ESI invalidation servlet is configured in the WebSphere Plugin, each additional process results in a dedicated web container thread being consumed.Setting MinSpareThreads too low may induce delays of a few seconds if IHS runs out of processing threads. |
MaxSpareThreads | There are multiple approaches to the tuning of this directive:
Set MaxSpareThreads to 25-30% of MaxClients. If it is too small a fraction of MaxClients, child processes will be terminated and recreated frequently. |
ServerLimit | MaxClients divided by ThreadsPerChild, or the default if that is high enough |
ThreadLimit | ThreadsPerChild |
Note: ThreadLimit and ServerLimit need to appear before these other directives in the configuration file.
Default settings in recent default configuration files:
<IfModule worker.c> ThreadLimit 25 ServerLimit 64 StartServers 2 MaxClients 600 MinSpareThreads 25 MaxSpareThreads 75 ThreadsPerChild 25 MaxRequestsPerChild 0 </IfModule>
1.3.1. If memory is constrained
If there is concern about available memory on the server, some additional tuning can be done.
Increasing ThreadsPerChild (and ThreadLimit) will reduce the number of total server processes needed, reducing the per-server memory overhead. However, there are a number of possible drawbacks to increasing ThreadsPerChild. Search this document for ThreadsPerChild and consider all the warnings before changing it. Notably, this increases the per-process footprint which can be detrimental on 32-bit httpds.
On Linux, VSZ can appear very large if ulimit -s is left as a large value or unlimited. Reduce it in bin/envvars to e.g. 512 with ulimit -s if this is a concern. A high VSZ has no real cost, it does not consume memory, but it is sometimes noticed.
Setting and MaxMemFree to e.g. 512, will limit memory retained by each thread.
1.4. Handling enough simultaneous connections with IBM HTTP Server 1.3.x on Linux and Unix systems
IBM HTTP Server 1.3 on Linux and Unix systems uses one single-threaded child process per concurrent connection.
Recommended settings:
Directive | Value |
MaxClients | maximum number of simultaneous connections |
MinSpareServers | 1 |
MaxSpareServers | same value as MaxClients |
StartServers | default value |
2. Out of the box tuning concerns
2.1. All platforms
MaxClients, ThreadsPerChild, etc.
Refer to the previous section.
cipher ordering (SSL only)
The default SSLCipherSpec ordering enables maximum strength SSL connections at a significant performance penalty. A much better performing and reasonably strong SSLCipherSpec configuration is given below.
Sendfile (non-SSL only)
With IBM HTTP Server 2.0 and above, Sendfile usage is disabled in the current default configuration files. This avoids some occasional platform-specific problems, but it may also increase CPU utilization on platforms on which sendfile is supported (Windows, AIX, Linux, HP-UX, and Solaris/x64).
If you enable sendfile usage on AIX, ensure that the nbc_limit
setting displayed by the no
program is not too high for your system. On many systems, the AIX system default is 768MB. We recommend setting this to a much more conservative value, such as 256MB. If the limit is too high, and the web server use of sendfile results in a large amount of network buffer cache memory utilization, a wide range of other system functions may fail. In situations like that, the best diagnostic step is to check network buffer cache utilization by running netstat -c
. If it is relatively high (hundreds of megabytes), disable sendfile usage and see if the problem occurs again. Alternately, nbc_limit
can be lowered significantly but sendfile still be enabled.
Some Apache users on Solaris have noted that sendfile is slower than the normal file handling, and that sendfile may not function properly on that platform with ZFS or some Ethernet drivers. IBM HTTP Server provides support for sendfile on Solaris/x64 but not Solaris/SPARC.
2.2. AIX
With IBM HTTP Server 2.0.42 and above, the default IHSROOT/bin/envvars
file specifies the setting MALLOCMULTIHEAP=considersize,heaps:8. This enables a memory management scheme for the AIX heap library which is better for multithreaded applications, and configures it to try to minimize memory use and to use a moderate number of heaps. For configurations with extensive heap operations (SSL or certain third-party modules), CPU utilization can be lowered by changing this setting to the following: MALLOCMULTIHEAP=true. This may increase the memory usage slightly.
2.3. Windows
The Fast Response Cache Accelerator (FRCA, aka AFPA) is disabled in the current default configuration files because some common Windows extensions, such as Norton Antivirus, are not compatible with it. FRCA is a kernel resident micro HTTP server optimized for serving static, non-access protected files directly out of the file system. The use of FRCA can dramatically reduce CPU utilization in some configurations. FRCA cannot be used for serving content over HTTPS/SSL connections.
3. Configuration features to avoid
IBM HTTP Server supports some features and configuration directives that can have a severe impact on server performance. Use of these features should be avoided unless there are compelling reasons to enable them.
- HostnameLookups OnPerformance penalty: Extra DNS lookups per request.This is disabled by default in the sample configuration files.
- IdentityCheck OnPerformance penalty: Delays introduced in the request to contact RFC 1413 ident daemon possibly running on client machineThis is disabled by default in the sample configuration files.
- mod_mime_magicPerformance penalty: Extra CPU and disk I/O to try to find the file typeThis is disabled by default in the sample configuration files.
- ContentDigest On (1.3 only)Performance penalty: Extra CPU to compute MD5 hash of the responseThis is disabled by default in the sample configuration files.
- setting MaxRequestsPerChild to non-zeroPerformance penalty:
- Extra CPU to terminate and create child processes
- With IHS 2 or higher on Linux and Unix, this can lead to an excessive number of child processes, which in turn can lead to excessive swap space usage. Once a child process reaches MaxRequestsPerChild it will not handle any new connections, but existing connections are allowed to complete. In other words, only one long-running request in the process will keep the process active, sometimes indefinitely. In environments where long-running requests are not unusual, a large number of exiting child processes can build up.
This is set to the optimal setting (0) in default configuration files for recent releases.
In rare cases, IHS support will recommend setting MaxRequestsPerChild to non-zero to work around a growth in resources, based on an understanding of what type of resource is growing in use, and what other mechanisms are available to address that growth.
With IBM HTTP Server 1.3 on Linux and Unix, a setting of a high value such as 10000 is not a concern. The child processes each handle only a single connection, so they cannot be prevented from exiting by long-running requests.
With IBM HTTP Server 2.0 and above on Linux and Unix, if the feature must be used, then only set it to a relatively high value such as 50000 or more to limit the risk of building up a large number of child processes which are trying to exit but which can’t because of a long-running request which has not completed.
- .htaccess filesPerformance penalty: Extra CPU and disk I/O to locate .htaccess files in directories where static files are served.htaccess files are disabled in the sample configuration files.
- detailed loggingDetailed logging (SSLTrace, plug-in LogLevel=trace, GSKit trace, third-party module logging) is often enabled as part of problem diagnosis. When one or more of these traces is left enabled after the problem is resolved, CPU utilization is higher than normal.Detailed logging is disabled in the sample configuration files.
- disabling Options FollowSymLinksIf the static files are maintained by untrusted users, you may want to disable this option in the configuration file, in order to prevent those untrusted users from creating symbolic links to private files that should not ordinarily be served. But disabling FollowSymLinks to prevent this problem will result in performance degradation since the web server then has to check every component of the pathname to determine if it is a symbolic link.Following symbolic links is enabled in the sample configuration files.
4. Common configuration changes and their Implications
4.1. IBM HTTP Server 2.0 and above on Linux and Unix systems: ThreadsPerChild
This directive is commonly modified as part of tuning the web server. There are advantages and disadvantages for different values of ThreadsPerChild:
- Higher values for ThreadsPerChild result in lower overall memory use for the server, as long as the value of ThreadsPerChild isn’t higher than the normal number of concurrent TCP connections handled by the server.
- Extremely high values for ThreadsPerChild may result in encountering address space limitations.
- Higher values for ThreadsPerChild often results in lower numbers of connections which the WebSphere connection maintains to the application server and better sharing of markdown information.
- Higher values for ThreadsPerChild result in higher CPU utilization for SSL processing.
- On older Linux distributions such as RedHat Advanced Server 2.1 and SuSE SLES 8 which use the linuxthreads library, higher values for ThreadsPerChild result in higher CPU utilization in the threads library.Some features may exacerbate this problem, such as RewriteMap or the following modules: mod_mem_cache, mod_ibm_ldap, or mod_ext_filter.
- Higher ThreadsPerChild results in a more effective use of the cache and connection pooling in mod_ibm_ldap.
- Higher ThreadsPerChild results in a more effective use of the cache in mod_mem_cache, because each child must fill its own cache.MaxSpareThreads = MaxClients is also beneficial for mod_mem_cache because it prevents child processes who have built up large caches from being gracefully terminated.
System tuning changes may be necessary to run with higher values for ThreadsPerChild. If IBM HTTP Server fails to start after increasing ThreadsPerChild, check the error log for any error messages. A common failure is a failed attempt to create a worker thread.
apr_thread_create: unable to create worker thread
error message and tuning hints
4.2. IBM HTTP Server 2.0 and above on Linux and Unix systems: MaxClients
This directive is commonly modified as part of tuning the web server to handle a greater client load (more concurrent TCP connections).
When MaxClients is increased, the value for MaxSpareThreads should be scaled up as well. Otherwise, extra CPU will be spent terminating and creating child processes when the load changes by a relatively small amount.
4.3. ExtendedStatus
This directive controls whether some important information is saved in the scoreboard for use by mod_status and diagnostic modules. When this is set to On
, web server CPU usage may increase by as much as one percent. However, it can make mod_status reports and some other diagnostic tools more useful.
5. WebSphere plug-in concerns on Linux and Unix systems
>5.1 Tuning IHS to make the MaxConnections parameter more effective
The use of the MaxConnections parameter in the WebSphere plug-in configuration is most effective when IBM HTTP Server 2.0 and above is used and there is a single IHS child process. However, there are other tradeoffs:
It is usually much more effective to actively prevent backend systmes from accepting more connections than they can reliably handle, performing throttling at the TCP level. When this is done at the client (HTTP Plugin) side, there is no cross-system or cross-process coordination which makes the limits ineffective.
- linuxthreads (traditional pthread library on Linux): ThreadsPerChild greater than about 100 results in high CPU overhead
- SSL on any platform: threadsPerChild greater than about 100 results in high CPU overhead
- WebSphere 5.x plug-in has a file descriptor limitation which will be encountered on Linux and Solaris if ThreadsPerChild is greater than 500
Using MaxConnections with more then 1 child processes, or across a webserver farm, introduces a number of complications. Each IHS child process must have a high enough MaxConnections value to allow each thread to be able to find a backend server, but in aggregate the child processes should not be able to overrun an individual application server.
Choosing a value for MaxConnections
- MaxConnections has no effect if it exceeds ThreadsPerChild, because no child could try to use that many connections in the first place.
- Upper limitIf you are concerned about a single HTTP Server overloading an Application server, you must first determine “N” — the maximum number of requests the single AppServer can handle.
MaxConnections would then be = (N / (MaxClients / ThreadsPerChild)), or N divided by the maximum number of child processes based on your configuration . This represents the worst-case number of connections by IHS to a single Application Server. As the number of backends grows, the likelyhood of the worst-case scenario decreases as even the uncoordinated child processes are still distributing load with respect to session affinity and load balancing.
For example, if you wish to restrict each Application Server to a total of 200 connections, spread out among 4 child processes, you must set the MaxConnections parameter to 50 because each child process keeps its own count.
- Lower LimitIf MaxConnections is too small, a child process may start returning errors because it has no AppServers to use.
To prevent problems, MaxConnections * (number of usable backend servers) should exceed
ThreadsPerChild
.For example, if each child process has 128
ThreadsPerChild
and MaxConnections is only 50 with two backend AppServers, a single child process may not be able to fulfill all 128 requests because only 50 * 2 connections can be made.
To use MaxConnections, IHS should be configured to use a small, fixed number of child process, and to not vary them in response to a change in load. This provides a consistent, predictable number of child processes that each have a fixed MaxConnections parameter.
- MinSpareServers and MaxSpareServers should be set to the same value as MaxClients.
- StartServers should be set to MaxClients / ThreadsPerChild.
When more then 1 child process is configured (number of child processes is MaxClients/ThreadsPerChild), setting MaxSpareServers equal to MaxClients can have the effect of keeping multiple child process alive when they aren’t strictly needed. This can be considered detrimental to the WebSphere Plugin detecting markdowns, because the threads in each child process must discover a server should be marked down. See section 6.2 below.
5.2 Tuning IHS for efficiency of Plugin markdown handling
Only WebSphere Plugin threads in a single IHS child process share info about AppServer markdowns, so some customers wish to aggressively limit the number of child processes that are running at any given time. If a user has problems with markdowns being discovered by many different child processes in the same webserver, consider increasing ThreadsPerChild and reducing MinSpareThreads and MaxSpareThreads as detailed below.
- One approach is to use a single child process, where MaxClients and ThreadsPerChild are set to the same value. IHS will never create or destroy child processes in response to load.Cautions
- A WebServer crash impacts 100% of the clients.
- Some types of hangs may influence 100% of the clients.
- CPU usage may increase if SSL is used and ThreadsPerChild exceeds a few hundred.
- More ramifications of high ThreadsPerChild is discussed here.
- A second approach is to use a variable number of child processes, but to aggressively limit the number created by IHS in response to demand (and aggressively remove unneeded processes). This is accomplished by setting ThreadsPerChild to 25% or 50% of MaxClients, setting MinSpareThreads and MaxSpareThreads low (relative to recommendations here).Cautions:
- MaxSpareThreads < MaxClients causes IHS to routinely kill off child processes, however it may take some time for these processes to exit while slow requests finish processing.
- A lower MaxSpareThread can cause extra CPU usage for the creation of replacement child processes.
- Caches for ESI and mod_mem_cache are thrown away when child processes exit.
See also
5.3 Tuning IHS for efficiency of ESI invalidation servlet / web container threads
As the number of child processes increases (ratio of ThreadsPerChild / MaxClients shrinks), if the ESI Invalidation Servlet is used with the WebSphere Plugin, more and more Web Container threads will be permanently consumed. Each child processes uses 1 ESI Invalidation thread (when the feature is configured), and this thread is used synchronously in the web container.
This requires careful consideration of the number of child processes per webserver, the number of webservers, and the number of configured Web Container threads.
6. SSL Performance
6.1. ciphers
When an SSL connection is established, the client (web browser) and the web server negotiate the cipher to use for the connection. The web server has an ordered list of ciphers, and the first cipher in that list which is supported by the client will be selected.
By default, IBM HTTP Server prefers AES and RC4 ciphers over the computationally expensive Triple-DES (3DES) cipher suite, and tuning of the order of SSL directives for performance reasons is generally not needed.
The following is a table of most of the ciphers IHS supports. The table is sorted in approximate descending cipher strength. For a full list of ciphers IHS supports, refer to the appropriate infocenter for your version of IHS.
SSLV3 and TLSV1 ciphers | |||
shortname | longname | Meaning | |
Available on v8 and later, distributed | |||
C024 | TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 | Elliptic Curve DSA AES SHA2 (256-bit) | |
C02c | TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 | Elliptic Curve DSA AES SHA2 (256-bit) | |
C028 | TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 | Elliptic Curve RSA AES SHA2 (256-bit) | |
C030 | TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 | Elliptic Curve RSA AES SHA2 (256-bit) | |
C00a | TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA | Elliptic Curve DSA AES SHA (256-bit) | |
C014 | TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA | Elliptic Curve RSA AES SHA (256-bit) | |
C008 | TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA | Elliptic Curve DSA Triple-DES SHA2 (168-bit) | |
C012 | TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA | Elliptic Curve RSA Triple-DES SHA2 (168-bit) | |
C023 | TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 | Elliptic Curve DSA AES SHA2 (128-bit) | |
C02b | TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 | Elliptic Curve DSA AES SHA2 (128-bit) | |
C009 | TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA | Elliptic Curve DSA AES SHA (128-bit) | |
C027 | TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 | Elliptic Curve RSA AES SHA2 (128-bit) | |
C02f | TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 | Elliptic Curve RSA AES SHA2 (128-bit) | |
C013 | TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA | Elliptic Curve RSA AES SHA (128-bit) | |
default on v8 and later, distributed | |||
9D | TLS_RSA_WITH_AES_256_GCM_SHA384 | RSA AES SHA2 (256-bit) | |
3D | TLS_RSA_WITH_AES_256_CBC_SHA256 | RSA AES SHA2 (256-bit) | |
9C | TLS_RSA_WITH_AES_128_GCM_SHA256 | RSA AES SHA2 (128-bit) | |
3C | TLS_RSA_WITH_AES_128_CBC_SHA256 | RSA AES SHA2 (128-bit) | |
All versions, all systems | |||
3A | SSL_RSA_WITH_3DES_EDE_CBC_SHA | RSA Triple-DES SHA (168 bit) | |
35b | TLS_RSA_WITH_AES_256_CBC_SHA | RSA AES SHA (256 bit) |
The following configuration directs the server to prefer strong 128-bit RC4 ciphers first and will provide a significant performance improvement over the default configuration. This configuration does not support the weaker 40-bit, 56-bit, or NULL/Plaintext ciphers that security scanners may complain about.
The order of the SSLCipherSpec directives dictates the priority of the ciphers, so we order them in a way that will cause IHS to prefer less CPU intensive ciphers. SSLv2 is disabled implicitly by not including any SSLv2 ciphers
<VirtualHost *:443> SSLEnable Keyfile keyfile.kdb ## SSLv3 128 bit Ciphers SSLCipherSpec SSL_RSA_WITH_RC4_128_MD5 SSLCipherSpec SSL_RSA_WITH_RC4_128_SHA ## FIPS approved SSLV3 and TLSv1 128 bit AES Cipher SSLCipherSpec TLS_RSA_WITH_AES_128_CBC_SHA ## FIPS approved SSLV3 and TLSv1 256 bit AES Cipher SSLCipherSpec TLS_RSA_WITH_AES_256_CBC_SHA ## Triple DES 168 bit Ciphers ## These can still be used, but only if the client does ## not support any of the ciphers listed above. SSLCipherSpec SSL_RSA_WITH_3DES_EDE_CBC_SHA ## The following block enables SSLv2. Excluding it in the presence of ## the SSLv3 configuration above disables SSLv2 support. ## Uncomment to enable SSLv2 (with 128 bit Ciphers) #SSLCipherSpec SSL_RC4_128_WITH_MD5 #SSLCipherSpec SSL_RC4_128_WITH_SHA #SSLCipherSpec SSL_DES_192_EDE3_CBC_WITH_MD5 </VirtualHost>
For IHS V8R0 and later, new ciphers and a new syntax for SSLCipherSpec are supported. This is a require change since new TLS protocols with a disjoint set of ciphers are supported. These same releases of IHS also favor strong ciphers, but also completely disable weak and export ciphers.
To configure weaker, but less CPU intensive ciphers, in V8R0 and later:
SSLCipherSpec TLSv11 SSL_RSA_WITH_RC4_128_SHA SSL_RSA_WITH_RC4_128_MD5 TLS_RSA_WITH_AES_128_CBC_SHA TLS_RSA_WITH_AES_256_CBC_SHA SSL_RSA_WITH_3DES_EDE_CBC_SHA
# TLSv12 is left at the default TLS_RSA_WITH_AES_128_GCM_SHA256 TLS_RSA_WITH_AES_256_GCM_SHA384 TLS_RSA_WITH_AES_128_CBC_SHA256 TLS_RSA_WITH_AES_256_CBC_SHA256 TLS_RSA_WITH_AES_128_CBC_SHA TLS_RSA_WITH_AES_256_CBC_SHA SSL_RSA_WITH_3DES_EDE_CBC_SHA
You can use the following LogFormat directive to view and log the SSL cipher negotiated for each connection:
LogFormat "%h %l %u %t \"%r\" %>s %b \"SSL=%{HTTPS}e\" \"%{HTTPS_CIPHER}e\" \"%{HTTPS_KEYSIZE}e\" \"%{HTTPS_SECRETKEYSIZE}e\"" ssl_common CustomLog logs/ssl_cipher.log ssl_common
This logformat will produce an output to the ssl_cipher.log that looks something like this:
127.0.0.1 - - [18/Feb/2005:10:02:05 -0500] "GET / HTTP/1.1" 200 1582 "SSL=ON" "SSL_RSA_WITH_RC4_128_MD5" "128" "128"
6.2. Server certificate size
Larger server certificates are also costly. Every doubling of key size costs 4-8 times more CPU for the required computation.
Unfortunately, you don’t have a lot of choice in the size of your server certificate; the industry is currently (2010) moving from 1024-bit to 2048-bit certificates to keep up with the increasing compute power available to those trying to break SSL. But there are some SSL performance tuning tips that can help.
The primary cost of the computation associated with a larger server certificate size is in the SSL handshake when a new session is created, so using keep-alive and re-using SSL sessions can make a significant difference in performance. See more about that below.
6.3. Linux and Unix systems, IBM HTTP Server 2.0 and higher: ThreadsPerChild
The SSL CPU utilization will be lower with lower values of ThreadsPerChild. We recommend using a maximum of 100 if your server handles a lot of SSL traffic, so that the client load is spread among multiple child processes. (Note: This optimization is not possible on Windows, which supports only a single child process.)
6.4. AIX, IBM HTTP Server 2.0 and higher: MALLOCMULTIHEAP setting in IHSROOT/bin/envvars
Set this to the value true when there is significant SSL work-load, as this will result in better performance for the heap operations used by SSL processing.
6.5. Should I use a cryptographic accelerator?
The preferred approach to improving SSL performance is to use software tuning to the greatest extent possible. Installation and maintenance of crypto cards is relatively complex and usually results in a relatively small reduction in CPU usage. We have observed many situations where the improvement is less than 10%.
6.6. HTTP keep-alive and SSL
HTTP keep-alive has a much larger benefit for SSL than for non-SSL. If the goal is to limit the number of worker threads utilized for keep-alive handling, performance will be much better if KeepAlive is enabled with a small timeout for SSL-enabled virtual hosts, than if keep-alive is disabled altogether.
Example:
<VirtualHost *:443> normal configuration # enable keepalive support, but with very small timeout # to minimize the use of worker threads KeepAlive On KeepAliveTimeout 1 </VirtualHost>
Warning! We are not recommending “KeepAliveTimeout 1” in general. We are suggesting that this is much better than setting KeepAlive Off. Larger values for KeepAliveTimeout will result in slightly better SSL session utilization at the expense of tying up a worker thread for a longer period of time in case the browser sends in another request before the timeout is over. There are diminishing returns for larger values, and the optimal values are dependent upon the interaction between your application and client browsers.
6.7. SSL Sessions and Load Balancers
An SSL session is a logical connection between the client and web server for secure communications. During the establishment of the SSL session, public key cryptography is used to to exchange a shared secret master key between the client and the server, and other characteristics of the communication, such as the cipher, are determined. Later data transfer over the session is encrypted and decrypted with symmetric key cryptography, using the shared key created during the SSL handshake.
The generation of the shared key is very CPU intensive. In order to avoid generating the shared key for every TCP connection, there is a capability to reuse the same SSL session for multiple connections. The client must request to reuse the same SSL session in the subsequent handshake, and the server must have the SSL session identifier cached. When these requirements are met, the handshake for the subsequent TCP connection requires far less server CPU (80% less in some tests). All web browsers in general use are able to reuse the same SSL session. Custom web clients sometimes do not have the necessary support, however.
The use of load balancers between web clients and web servers presents a special problem. IBM HTTP Server cannot share a session id cache across machines. Thus, the SSL session can be reused only if a subsequent TCP connection from the same client is sent by the load balancer to the same web server. If it goes to another web server, the session cannot be reused and the shared key must be regenerated, at great CPU expense.
Because of the importance of reusing the same SSL session, load balancer products generally provide the capability of establishing affinity between a particular web client and a particular web server, as long as the web client tries to reuse an existing SSL session. Without the affinity, subsequent connections from a client will often be handled by a different web server, which will require that a new shared key be generated because a new SSL session will be required.
Some load balancer products refer to this feature as SSL Sticky or Session Affinity. Other products may use their own terminology. It is important to activate the appropriate feature to avoid unnecessary CPU usage in the web server, by increasing the frequency that SSL sessions can be reused on subsequent TCP connections.
End users will generally not be aware that SSL session is not being reused unless the overhead of continually negotiating new sessions causes excessive delay in responses. Web server administrators will generally only become aware of this situation when they observe the CPU utilization approaching 100%. The point at which this becomes noticeable will depend on the performance of the web server hardware, and whether or not a cryptographic accelerator is being used.
When SSL is being used and excessive web server CPU utilization is noticed, it is important to first confirm that Session Affinity is enabled if a load balancer is being used.
Checking the actual reuse of SSL sessions
First, get the number of new sessions and reused sessions. LogLevel must be set to info
or debug
.
IBM HTTP Server 2.0.42 or 2.0.47 up through cumulative fix PK07831, and IBM HTTP Server 6 up through 6.0.2 writes messages of this format for each handshake:
[Sat Jul 09 10:37:22 2005] [info] New Session ID: 0 [Sat Jul 09 10:37:22 2005] [info] New Session ID: 1
0 means that an existing SSL session was re-used. 1 means that a new SSL session was created.
Getting the number of each type of handshake:
$ grep "New Session ID: 0" logs/error_log | wc -l 1115 $ grep "New Session ID: 1" logs/error_log | wc -l 163
IBM HTTP Server 2.0.42 or 2.0.47 with cumulative fix PK13230 or later and IBM HTTP Server 6.0.2.1 and later writes messages of this format for each handshake:
[Sat Oct 01 15:30:17 2005] [info] [client 9.49.202.236] Session ID: YT8AAPUJ4gWir+U4v2mZFaw5KDlYWFhYyOM+QwAAAAA= (new) [Sat Oct 01 15:30:32 2005] [info] [client 9.49.202.236] Session ID: YT8AAPUJ4gWir+U4v2mZFaw5KDlYWFhYyOM+QwAAAAA= (reused)
To get the relative stats:
$ grep "Session ID.*reused" logs/error_log | wc -l 1115 $ grep "Session ID:.*new" logs/error_log | wc -l 163
The percentage of expensive handshakes for this test run is 163 / (1115 + 163), or 12.8%. To confirm that the load balancer is not impeding the reuse of SSL sessions, perform a load test with and without the load balancer*, and compare the percentage of expensive handshakes in both tests.
*Alternately, use the load balancer for both tests, but for one load test have the load balancer to send all connections to a particular web server, and for the other load test have it load balance between multiple web servers.
6.8. Session ID cache limits
IBM HTTP Server uses an external session ID cache with no practical limits on the number of session IDs unless the operating system is Windows or the directive SSLCacheDisable
is present in the IHS configuration.
When the operating system is Windows or the SSLCacheDisable
directive is present, IBM HTTP Server uses the GSKit internal session ID cache which is limited to 512 entries by default.
This limit can be increased to a maximum of 4095 (64000 for z/OS) entries by setting the environment variable GSK_V3_SIDCACHE_SIZE to the desired value.
7. Network Tuning
7.1 All platforms
Problem Description
Low data transfer rates handling large POST requests.
This problem can be caused by a small TCP receive buffer size being used for web server sockets. This results in the client being limited in how much data it can send before the server machine has to acknowledge it, resulting in poor network utilization.
Resolution
Some data transfer performance problems can be solved using the native operating system mechanism for increasing the default size of TCP receive buffers. IBM HTTP Server must be restarted after making the change.
Platform | Tuning parameter | Instructions |
---|---|---|
AIX | tcp_recvspace |
Run no -o tcp_recvspace to display the old value. Run no -o tcp_recvspace=new_value to set a larger value. |
Solaris | tcp_recv_hiwat |
Run ndd /dev/tcp tcp_recv_hiwat to display the old value. Run ndd -set /dev/tcp tcp_recv_hiwat new_value to set a larger value. |
HP-UX | tcp_recv_hiwater_def |
Run ndd /dev/tcp tcp_recv_hiwater_def to display the old value. Run ndd -set /dev/tcp tcp_recv_hiwater_def new_value to set a larger value. |
Linux | rmem_default |
Run cat /proc/sys/net/core/rmem_default to display the old value. Run echo new_value > /proc/sys/net/core/rmem_default to set a larger value. |
The following levels of IBM HTTP Server contain a ReceiveBufferSize directive for setting this value in a platform-independent manner, and only for the web server:
- 2.0.42.2 with cumulative e-fix PK07831 or later
- 2.0.47.1 with cumulative e-fix PK07831 or later
- 6.0.2 or later
(6.0.2.1 or later on Windows)
Usage:
ReceiveBufferSize number-of-bytes
This directive must appear at global scope in the configuration file.
Making the adjustment
- Check the current system default using the platform-specific command in the previous table.
- Use either 131072 bytes, or twice the current system default, whichever is greater.
Example ReceiveBufferSize directive:
ReceiveBufferSize 131072
If the ReceiveBufferSize directive is not available, use the platform-specific command in the previous table to change the system default. - Restart the web server, then retry the testcase.
- If POST performance did not improve enough, double the receive buffer value and try again.
7.2 AIX
Problem Description
Low data transfer rates running on AIX 5 when handling large (multi-megabyte) POST requests from Windows machines. Network traces show large delays (~150 ms) between packet acknowledgments.
Resolution
This performance problem can be corrected by setting an AIX network tuning option and applying AIX maintenance.
For all releases of AIX, set the tcp_nodelayack network option to 1 by using the following command:
no -o tcp_nodelayack=1
For AIX 5.1, apply the fix for APAR IY53226. For more information, see: IY53226
For AIX 5.2, apply the fix for APAR IY53254. For more information, see: IY53226
Problem Description
Unexpected network latency when the application is somewhat slow. Network traces show a normal HTTP 200 OK message for the first part of the response, then AIX waits ~150ms for a delayed ACK from the client.
Resolution
This performance problem can be corrected by setting an AIX network tuning option.
Set the rfc2414 network option to 1 by using the following command:
no -o rfc2414=1
8. Operating System Tuning Reference Materials
Instructions for tuning some operating system parameters are available in the WebSphere InfoCenter. Many of these parameters, such as TCP layer configuration or file descriptor configuration, apply to IBM HTTP Server as well.
9. Memory use comparison between IBM HTTP Server 1.3 and IBM HTTP Server 2.0
This comparison is not applicable to IBM HTTP Server on Windows, where memory usage is much more similar between 1.3 and 2.0.
Many customers on Unix systems have encountered paging (swap) space or physical memory problems with IBM HTTP Server 1.3 due to the large number of child processes which may be required, and the memory overhead per child process.
On AIX and Solaris, paging space is allocated based on the virtual memory size of the process, even for pages which are shared with the httpd parent process and will never be modified. For IBM HTTP Server 1.3, the majority of the virtual memory in a child process is shared with the parent process and never modified in the child, so while it contributes to the paging space usage (a disk allocation issue) it does not contribute to active paging (a performance issue).
This information can help determine how much paging space is required, as well as show some of the benefits of migrating to IBM HTTP Server 2.0 or later.
Customers should expect high virtual memory use for the entire set of IBM HTTP Server 1.3 processes; customers should check paging space utilization when encountering problems related to virtual memory, and ensure that enough paging space has been allocated to support the maximum configured number of httpd processes.
Scenario 1 for comparison
- IBM HTTP Server versions
- 1.3.28.1 with latest maintenance; 2.0.47.1 with latest maintenance; WebSphere 5.1.1.8 plug-in
- OS
- Solaris 9
- MaxClients
- 500; for IBM HTTP Server 2.0.47.1, two child processes will be required; for IBM HTTP Server 1.3.28.1, 500 child processes will be required
- https transports in WebSphere plug-in
- One https transport will be configured. Note: Additional https transports add around 400KB more memory per child process. A configuration with multiple https transports will see much greater benefits when switching to IBM HTTP Server 2.0 or above.
- SSL-enabled virtual hosts in web server
- One SSL-enabled virtual host will be configured. Note: Additional SSL-enabled virtual hosts add around 400KB more memory per child process. A configuration with multiple SSL-enabled virtual hosts will see much greater benefits when switching to IBM HTTP Server 2.0 or above.
- no memory-based caching enabled
- The WebSphere plug-in ESI cache feature is available with either 1.3.28.1 or 2.0.47.1. There is one copy of the cache per child process, so it is much more memory-efficient with IBM HTTP Server 2.0 or above.
Process management configuration
1.3.28.1
StartServers 5 MaxClients 500 MaxSpareServers 500 MinSpareServers 1 MaxRequestsPerChild 0
2.0.47.1
<IfModule worker.c> ServerLimit 2 ThreadLimit 250 StartServers 2 MaxClients 500 MinSpareThreads 1 MaxSpareThreads 500 ThreadsPerChild 250 MaxRequestsPerChild 0 </IfModule>
Memory use measurements
1.3.28.1
(from ps -A -o pid,ppid,vsz,rss,comm
)
PID PPID VSZ RSS COMMAND 22729 22676 13448 4768 bin/httpd 22721 22676 13448 4768 bin/httpd 22734 22676 13448 4768 bin/httpd 22745 22676 13448 4768 bin/httpd 22737 22676 13448 4768 bin/httpd 22719 22676 13448 4768 bin/httpd 22740 22676 13448 4768 bin/httpd 22731 22676 13448 4768 bin/httpd 22728 22676 13448 4768 bin/httpd 22741 22676 13448 4768 bin/httpd 22720 22676 13448 4768 bin/httpd 22724 22676 13448 4768 bin/httpd 22746 22676 13448 4768 bin/httpd 22717 22676 13448 4768 bin/httpd 22730 22676 13448 4768 bin/httpd 22718 22676 13448 4768 bin/httpd 22722 22676 13448 4768 bin/httpd 22732 22676 13448 4768 bin/httpd 22743 22676 13448 4768 bin/httpd 22739 22676 13448 4768 bin/httpd 22733 22676 13448 4768 bin/httpd 22676 1 13448 8760 bin/httpd 22742 22676 13448 4768 bin/httpd (and 478 more children)
Totals: Total virtual memory size is about 6.7 GB. Total resident set size is about 2.4GB.
2.0.47.1
(from ps -A -o pid,ppid,vsz,rss,comm
. On AIX, use ps -A -o pid,ppid,vsz,rssize,comm
. )
PID PPID VSZ RSS COMMAND 394 390 44240 36696 /home/trawick/testihsbuild/ihsinstall/bin/httpd 390 1 15136 9528 /home/trawick/testihsbuild/ihsinstall/bin/httpd 393 390 44144 36536 /home/trawick/testihsbuild/ihsinstall/bin/httpd 392 390 14552 3328 /home/trawick/testihsbuild/ihsinstall/bin/httpd
Totals: Total virtual memory size is about 117 MB. Total resident set size is about 86MB. Note that IBM HTTP Server 2.0 and above has an extra child process when CGI requests are enabled.
Scenario 2 for comparison
This is the same except for the OS, which is AIX 5.3.
Memory use measurements
1.3.28.1
(from ps auxw
then post-processing and picking the largest child)
USER SZ RSS root 11800 800 nobody 12956 1976 (and 499 more children like this)
Totals: Total virtual memory size is about 6.5 GB. Total resident set size is about 1 GB.
2.0.47.1
(from ps auxw
then post-processing)
USER SZ RSS nobody 32876 32932 nobody 33348 33384 root 632 668 nobody 636 808
Totals: Total virtual memory size is about 68 MB. Total resident set size is about 68MB. Note that IBM HTTP Server 2.0 and above has an extra child process when CGI requests are enabled.
10. Slow startup, or slow response time from proxy or LDAP with IBM HTTP Server 2.0 or above on AIX
In support of IPv6 networking, these levels of IBM HTTP Server will query the resolver library for IPv4 and IPv6 addresses for a host. This can result on extra DNS queries on AIX, even when the IPv4 address is defined in /etc/hosts. To work around this issue, IPv6 lookups can be disabled.
System-wide setting
Edit /etc/netsvc.conf, which configures the resolver system-wide. Add or modify the lookup rule for hosts
so that it has this setting:
hosts=local4,bind4
That will disable IPv6 lookups. Now restart IBM HTTP Server and confirm that the delays with proxy requests or LDAP have been resolved.
IHS-specific setting
Add this to the end of ihsroot/bin/envvars:
NSORDER=local4,bind4 export NSORDER
11. High disk I/O with IBM HTTP Server on AIX
A customer reported that an internal disk mirror showed a high level of write I/O every 60 seconds which was related empirically to client load on the web server and which was determined to be unrelated to logging. AIX support narrowed down the specific web server activity related to the high write I/O and determined that it was due to file access times being updated by the filesystem when the web server served the page.
IBM HTTP Server 2.0 and above can send static files using the AIX send_file() API, which in turn can enable the AIX kernel to deliver the file contents to the client from the network buffer cache. This results in the file access time remaining unchanged, which solved this particular disk I/O problem.
The use of send_file() is controlled with the EnableSendfile directive. Several potential problems must be considered when IBM HTTP Server uses send_file(); thus it is disabled by default in the configuration files provided with the last several releases.
12. High CPU in child processes after WebSphere plugin config is updated
The WebSphere plugin will normally reload the plugin configuration file (plugin-cfg.xml) during steady state operation if the file is modified. When the reload occurs during steady state operation, it must be reloaded in every web server child process serving requests. Initialization of https transports is particularly CPU-intensive so, if there are many such transports defined or many child processes, the CPU impact can be high.
One way to address the issue on Unix and Linux platforms is to disable automatic reload by setting RefreshInterval
to -1
in plugin-cfg.xml, then use the apachectl graceful
command to restart the web server when the new plug-in configuration must be activated. This will result in the reload occurring only once — in the IHS parent process. The new configuration will be inherited by the new child processes which are created by the restart operation.
Another way to address this issue is to utilize WebSphere 6.1 (or later) webserver definitions. This will allow you to have smaller plug-in config files because they are broken down in a way that each plugin-cfg.xml is only generated with the transports relevant to that web server. When the reload occurs, it doesn’t reinitialize all the transports; only the one in the config that changed will be reinitialized.
13. Access logs
Disk writes to the access logs can become a bottleneck at high loads on any operating system. mpmstats output will show many busy threads in log state. Specify
BufferedLogs on
in the IHS configuration file to reduce the disk I/O rate due to access logging.
14. z/OS Considerations
HFS disk syncing
IHS threads can block due to disk filesystem sync activity even with logging disabled. This can be caused by updates to file access times for IHS static content files on an HFS. A mount parameter of SYNC(99999) prevents the metadata updates. zFS uses asynchronous disk writes and should not be affected as much by sync activity.
USS save areas
Currently USS has 14,400 save areas per LPAR in a cell pool. One of these is used for every Unix system call. If the LPAR supports more concurrent web connections than this, the cell pool may become depleted. Once this happens, subsequent system calls will still work, but they must first obtain the local lock and use slower methods of allocating storage. Since the cell pool is an LPAR wide resource, other Unix applications (WAS for example) running on the same LPAR are affected.
If your LPAR needs to support tens of thousands of concurrent web connections, check the mpmstats output in the error log for each IHS server. The bsy count shows the total number of busy threads. Each of the busy threads will typically need a USS save area. The ka count shows the number of threads that are busy due to keepalive reads. With IHS 8.5 and later, the ka count will always be zero because keepalive reads are handled asynchronously and do not tie up a thread. With IHS 8.0 and earlier, you may be able to reduce the KeepaliveTimeout value to lower the number of busy threads. Disabling Keepalive altogether is not recommended due to increased CPU overhead needed to re-establish a connection if the client requests another web object. The additional CPU overhead will be much greater for re-establishing SSL connections.
Default stack size for 31-bit IHS
zEDC compression offload
Compressing large files on the fly with mod_deflate can use significant CPU. IHS 8.5.5.4 (PI24424) and later includes an alternate mod_deflate.so module, mod_deflate_z.so, that can use zEnterprise Data Compression (zEDC) when configured. In future releases, the default mod_deflate.so will contain zEDC support.
In IHS benchmarks, more than 10x CPU can be saved in configurations that use high CPU due to mod_deflate.
Recent Comments