3.4 Performance Tuning

Apache 2.0 includes performance enhancements that increase throughput and scalability. Most of these are enabled by default. In addition, on the Performance Tuning page in Apache Manager, you can change the configuration of Apache to best serve the needs for which you are using it.

Figure 3-3 Apache Performance Tuning

Performance Tuning page

For example, you can increase the maximum number of threads allowed to run simultaneously if your Web server is getting a larger number of client visits. You can also disable the Keep Alive feature to restrict persistent connections, which some Web clients request when they connect to your server.

3.4.1 Adjusting Thread Settings

Because Apache is very self-regulating, most sites do not need to adjust the default values of any of the thread directives. However, if you need to make changes to any of the thread settings, continue reading.

For more information about thread directives, see ThreadStackSize directive on the Apache Web site.

NOTE:Because Apache for NetWare is multi-threaded, it does not use a separate process for each request, as Apache does in some Linux/UNIX implementations. Apache for NetWare uses a parent thread and multiple child threads, which handle all requests.

Modifying the Thread Stack Size

A thread stack is a piece of scratch memory that a thread uses to store information temporarily. If there is not enough stack space and the thread requires more in order to continue, the server abends. Intensive applications usually require more stack space. Modules such as mod_perl or mod_php might require a thread to yield more stack space. However, 65,536 bytes is typically large enough.

Keep in mind that increasing the stack size consumes more system resources because each thread requires a certain amount of space. Therefore, increasing the stack size should be done only after considering what is required based on the applications and modules that are being used.

The ThreadStackSize directive tells the server what stack size to use for each running thread. If a stack overflow occurs, you need to increase this number.

  1. On the Performance Tuning page, specify a numerical value in the Thread Stack Size field.

    The default is 65536.

  2. Click Save > Save to save your changes.

    or

    Click Save > Save and Apply to save your changes and restart Apache so your changes are immediately put into effect.

    For information about where configuration information is stored, see Section 2.3.3, Saving Configuration Changes and Restarting Apache in Apache Manager.

Modifying the Number of Start Threads

The StartThreads directive specifies the number of child server processes that are to be created when the Web server is started. Because the number of processes is dynamically controlled according to system load, there is usually little reason to adjust this parameter.

  1. On the Performance Tuning page, specify a numerical value in the Start Threads field.

    The default is 50.

  2. Click Save > Save to save your changes.

    or

    Click Save > Save and Apply to save your changes and restart Apache so your changes are immediately put into effect.

    For information about where configuration information is stored, see Section 2.3.3, Saving Configuration Changes and Restarting Apache in Apache Manager.

Modifying Minimum Spare Threads

The MinSpareThreads directive defines the minimum number of idle threads set aside to process surges in client requests to the Web server.

Different multiprocessing modules (MPMs) deal with this directive differently. On NetWare, the mpm_netware module is used to control all of the threading directives and functionality.

  1. On the Performance Tuning page, specify a numerical value in the Minimum Spare Threads field.

    The default is 10.

  2. Click Save > Save to save your changes.

    or

    Click Save > Save and Apply to save your changes and restart Apache so your changes are immediately put into effect.

    For information about where configuration information is stored, see Section 2.3.3, Saving Configuration Changes and Restarting Apache in Apache Manager.

Modifying Maximum Spare Threads

The MaxSpareThreads directive lets you define the maximum number of idle threads allowed. Again, different MPMs deal with this directive differently. On NetWare, the mpm_netware module is used. Therefore, this directive tracks the minimum spare threads value on a server-wide basis.

  1. On the Performance Tuning page, specify a numerical value in the Maximum Spare Threads field.

    The default is 75.

  2. Click Save > Save to save your changes.

    or

    Click Save > Save and Apply to save your changes and restart Apache so your changes are immediately put into effect.

    For information about where configuration information is stored, see Section 2.3.3, Saving Configuration Changes and Restarting Apache in Apache Manager.

Modifying Maximum Total Threads

The MaxThreads directive specifies the maximum number of worker threads allowed.

  1. On the Performance Tuning page, specify a numerical value in the Maximum Total Threads field.

    The default is 250.

  2. Click Save > Save to save your changes.

    or

    Click Save > Save and Apply to save your changes and restart Apache so your changes are immediately put into effect.

    For information about where configuration information is stored, see Section 2.3.3, Saving Configuration Changes and Restarting Apache in Apache Manager.

3.4.2 Adjusting Keep Alive Settings

Keep Alive provides live HTTP sessions that allow multiple requests to be sent over the same TCP connection. In some cases this has been shown to result in an almost 50% increase in latency times for HTML documents with many images.

To modify Keep Alive settings:

  1. On the Performance Tuning page, click Yes for Enable Keep Alive, then adjust the following settings as needed:

    Maximum Keep Alive Requests: When Keep Alive is enabled, it limits the number of requests allowed per connection. The default setting is 100. For maximum server performance, increase this setting until desired performance is reached.

    Entering 0 (zero) in the Maximum Keep Alive Requests field allows an unlimited amount of connections. (See MaxKeepAliveRequests directive on the Apache Web site.

    Keep Alive Timeout: The KeepAliveTimeout directive lets you specify (in seconds) how long Apache waits for a subsequent request before closing a TCP connection. After a request has been received, the timeout value specified by this directive applies.

    Setting Keep Alive Timeout to a high value can cause performance problems for heavily loaded servers. The higher the timeout, the more server processes are kept busy waiting on connections with idle clients.

    or

    Click No.

  2. Click Save > Save to save your changes.

    or

    Click Save > Save and Apply to save your changes and restart Apache so your changes are immediately put into effect.

    For information about where configuration information is stored, see Section 2.3.3, Saving Configuration Changes and Restarting Apache in Apache Manager.

3.4.3 Using DNS

When enabled, the HostnameLookups directive records the names of clients or their IP addresses, for example www.apache.org (when on, or enabled) or 172.16.5.18 (when off, or disabled).

The default is set to Off. This is because when this directive enabled, every client request would result in at least one lookup request to the nameserver, causing unnecessary congestion on DNS servers and the Internet.

For additional information about DNS issues on Apache, see Issues Regarding DNS and Apache on the Apache Web site.

3.4.4 Additional Performance Tuning Information

You can also adjust the settings of the Mod_Cache module. For more information about Mod_Cache, see Section 5.0, Managing Apache Modules.

For additional information about performance tuning, see Apache Performance Tuning on the Apache Web site.