Five tips for configuring Apache1.3 or Apache2.0 servers

Source: Internet
Author: User
Tags flock ssl connection
The apachectlstatus command is a shortcut for checking the server status. If the output result of the command is not consistently displayed, the available working process is displayed. It is better to increase the value of MinSpareServers or MinSpareThreads (when Apache2.0 adopts thread-based MPM ). You may also need to increase the value of MaxClients. This article provides five tips for configuring Apache 1.3 or Apache 2.0 servers. We will discuss the following configuration plan: adjust Apache's accept () serialization, Apache 2.0 thread, SSL session cache using mod_ssl, optimized keep-alive timeout value, and checked server load to balance the amount of requests that can be processed by the server.
AcceptMutex

AcceptMutex is introduced in Apache 1.3.21 and Apache 2.0, which brings a rare opportunity to adjust the server performance. Configure the Apache accept () processing method. In some systems with only one listener, blocking is not required. This is called Single Listen Unserialized Accept (SLUA ). However, for those configurations with multiple listeners or on the control system that receives the system call function (no matter how many listeners) there is a thundering herd title, the connection receiver must be serialized.

The Sander Temme of Covalent performs a certain degree of performance analysis on the accept () blocking policy. This report summarizes the adjustment policies of Apache 1.3.21 in this aspect, as shown below:

  • Uslock (uslock) of Irix)
  • POSIX cross-process blocking (pthread)
  • SystemV Semaphores (sysvsem)
  • Fcntl () blocking (fcntl)
  • Flock () blocking (flock)
  • OS/2 Semaphores (os2sem)
  • TPF blocking (tpfcore)
  • None (None)

Although using AcceptMutex none is also possible, your system may be troubled by the thundering herd title and death lock in this configuration. These headers will cause the server to slow down the processing speed or even end the response. The none option is not applicable to the actual system. In informal tests, pthread locks should be the best solution. However, pthread cross-process blocking is not available to all systems.

Adopt version 2.0 and thread (worker MPM)

One obvious improvement feature of Apache 2.0 is that it supports threads. Some control systems, such as Solaris, can significantly improve system performance under the conditions of adopting thread techniques. Other control systems, such as Linux, may not have obvious performance improvements.

When Apache 2.0 is adopted, the method for dealing with requests has been theoretically implemented. this is the so-called MPM: Multi Process Model ). The earlier Apache 1.3 mode is represented by prefork MPM, which is the default MPM for 2.0 on Unix platforms. In this mode, there is an independent process to process every request. However, if you include the -- with-mpm = worker option when compiling Apache 2.0, the server request will be handled by the thread. This method will greatly reduce the load of the control system to handle the request when the thread implementation plan is carefully designed.

SSL session cache

If you use mod_ssl plug-in for Apache 1.3 or Apache 2.0 (included in Apache 2.0), you can use session cache to promote system performance. This improvement will significantly reduce the SSL connection load. There are three ways to set session cache:

  • DBM (dbm), a common pattern for storing items on disks (htpasswd can store passwords in DBM format)

  • Shared memory cache (shm or shmcb)
  • Shared memory table (shmht)
  • You must specify the file path when using the above options. When the DBM variable is applied, the file is written into the disk. For shared memory variables, files will be stored and backed up by the preferred shared memory mechanism of the control system. Note that most of the control systems do not allow shared memory segments to be built on a network-mounted drive, such as NFS. Therefore, the server must be supplied with a file path.

    We recommend that you use shared memory. However, you may wish to use the DBM plan on platforms without shared memory.

    For more information about SSL session cache and related syntaxes, see:
    • Modssl.org
    • Apache.org
    KeepAliveTimeout

    Suppose a user browses a webpage on a website, and then click the link of another webpage on a website. If this process is generated within the KeepAliveTimeout period (15 seconds by default), a new TCP server connection is not required. This greatly reduces the load on the computer. However, in this region, the server cannot handle more requests. After the KeepAliveTimeout period, the server can process the latest requests from different clients. Therefore, you must increase the number of pleading processes or threads to meet the need for idle pleading. This value should be adjusted carefully to achieve the best state.

    Mod_status

    You can use mod_status to check the server load and obtain important information about the server performance.

    The apachectl status command is a shortcut for checking the server status. If the output result of the command is not consistently displayed, the available working process is displayed. It is better to increase the MinSpareServers or MinSpareThreads value (when Apache 2.0 adopts the thread-based MPM ). You may also need to increase the value of MaxClients.

    For more information about mod_status and the Apache module mpm_common, see mod_status and mpm_common.
    Summary

    You can use the techniques proposed in this article to maximize the server performance while maintaining the normal operation of the website.

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.