IBM Support

Threads in Apache HTTP Server

Troubleshooting


Problem

This document describes what the Maximum Number of Threads is in an Apache HTTP server configuration and when it should be changed.

Resolving The Problem

What is the Maximum Number of Threads in an Apache HTTP server configuration

The term Threads in this context refers to the Primary Server Job that handles client requests/connections. This is the job with PGM-QZSRHTTP under the Function column in WRKACTJOB. IBM delivers the DG1 product with a default value of 40 in the HTTP Attributes (CHGHTTPA).
In this default configuration, the process starts 40 (from HTTP Attributes) + 7 threads (for logging and other internal tasks). Each thread can handle one connection establishment, or one request, or one response at a time. Upon completion of any of these actions, the thread is freed and can handle a new action from any client.

Example: When the server gets 41 actions in at the same fraction of a second, the first 40 will be handled; the 41st action will wait until a thread becomes available to handle it.

The maximum is really a value the server starts with; however, it never increases.

CHGHTTPA has the following parameters (shown with their default values):

Number of server threads:
Minimum . . . . . . . . . . . 10
Maximum . . . . . . . . . . . 40

The Minimum is ignored.
The Maximum can be overwritten by a server configuration with the directive ThreadsPerChild.

When should the Maximum Number of Threads in an Apache HTTP server configuration be changed

The default amount of "maximum" number of threads is usually enough; however, there can be conditions where this number may have to be increased. The threads usage can be monitored. To monitor, start the Administrative instance, select the HTTP server in question, and select Real Time Server Statistics at the bottom left.

If Idle Threads is close to or at zero, this is a problem. As long as Idle Threads is zero, no new client connections can be established. New clients will be put into a wait status until a thread becomes available. Our recommendation for this condition is to add the directive ThreadsPerChild with an increased value, approximately double the current value if it was in the range of 40 to 100, or plus 50, if it was above 100. The required minimum value (for the maximum parameter) can only be found by trial and error. If after increasing the value, the server runs smoothly, stop testing.

Note: Do not use the *NOMAX value in CHGHTTPA or 9999 in ThreadsPerChild. This will only add overhead by starting too many threads. Most of them will never be used.

In addition to the ThreadsPerChild directive, the AcceptThreads directive can also be used. This has a default value of 4. It pertains to starting connections only. The AcceptThreads are used to accept new connections from the client. This number may need to be changed to reflect the number of concurrent connections which are being accepted. If a large number of connections to the Web server start at approximately the same time, the number of accept threads may need to be adjusted to a higher value.

The difference:
ThreadsPerChild affects all client requests (GET, POST, new connections, and so on).
AcceptThreads affects new connection start up only.

[{"Type":"MASTER","Line of Business":{"code":"LOB57","label":"Power"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SWG60","label":"IBM i"},"Platform":[{"code":"PF012","label":"IBM i"}],"Version":"6.1.0"}]

Historical Number

563991951

Document Information

Modified date:
18 December 2019

UID

nas8N1012213