You are here: Home > News > To improve the performance of the Apache server

News

To improve the performance of the Apache server

The Apache server is deployed on Linux system a best choice to the HTTP server. Not only because of its stability and security, but it can also provide more superior performance. But in order to improve the performance of the Apache server Linux system administrators need to adjust some parameters related to performance, specifically in the Apache server have a module used to carry out related adjustment. As a systems administrator, at the time of deployment of Apache server application, need to understand the meaning of these parameters, and according to the actual situation of site application for relevant adjustments.
1,set up the number of connections. In order to ensure every client performance of connections, is often needed in the server Settings at the same time allow client number of upper limit. Such as on the server to deploy the application services such as email or FTP, in order to be able to guarantee the speed of the download, you need to connect the client with the highest number of restrictions. In the Apache server has a "most connection number" column, is used to set the values. Also can use MaxClinets parameters to be set in the configuration file. With this parameter, the system administrator can limit the number of the client's connection and the connection time, to save bandwidth to provide other services or to improve the efficiency of the existing connection. When the client after the the highest limit the number of connections, all new connection will be rejected; , of course, refused to false information server will be asked to return to the customer. In this setting, the need to pay attention to two questions. One is when configure Xinetd service on Linux operating system can also be a similar Settings. Such as through configuration Xinetd service instances parameters can be set in the configuration file is a single service at the same time provides the maximum amount of client connection requests. Then the parameters with the number of connections in the Apache server Settings are what relation? If the instance parameter is set to 100; The MaxClients parameter is set to 120. So finally can be connected to the Apache server client number for how many? Note that due to the client's Internet connection request is first by the Linux operating system, so on the Linux operating system configuration tend to have higher priority. Therefore, when the instance parameter less than MaxClients parameter, the former shall prevail; When the instance parameter is greater than the MaxClients parameter, the latter shall prevail. Therefore, sometimes the client prompts on the number of connections over limit, the system administrator often need to check these two parameters at the same time, to find the causes of the problem. The second is to consider under what circumstances need to enable this limitation. In general, if the HTTP server application is mainly applied in the enterprise internal network, because the bandwidth is ideal, don't need to set the limit for this purpose. But, if it is geared to the needs of Internet users are often need to set the limits. Such as enterprise deployed an FTP server for Internet users to download. Due to its bandwidth is fixed, when the more users to download, it can get the download speed will be lower. Therefore for the existing user to provide a better rate, often need to set up a number of connections at the most. So as not to connect users have too much influence to download rate.
2, to allow each connection can have unlimited requests. If it is on Solaris on Linux Apache server deployment, best to set this parameter. This option indicates that when the client and server connection is established, every child can accept before the end cap on the client request. When reach the ceiling, the child process will interrupt. This is mainly in order to avoid some of the child process takes up too much of server resources and led to a decline in server performance. "Set up the number of connections" option is mainly used to limit the number of the client's connection; And each client can use when connect with the server connected to the server for more child process. Such as FTP connection to a client by default 5 child process can be used to connect. And the client to download the total rate of is the sum of 5 child process. So when the deployment of Apache server, you need to limit this option. To prevent the same client opens the more process, takes up a lot of server hardware resources. But it is important to note that the parameters with another keepalive is very similar, but they are very different. KeepAlive, as the name implies, is mainly used to ensure a continuous connection between client and server. If the Apache server is mainly used to do video conference or provide watch online movies, then this parameter is very valuable. If this parameter is set to OFF, at this time, the client browser may have to be in the web page contains multiple components, set up many connection request. And in the process of connecting each component must be individually. And these additional requests and connection will increase the burden of server and network bandwidth consumption.
3, reasonable configured timeout This option refers to the client connection requests and when a connection is established the largest free time. If more than this time, between the client and the server is still not any action of sending or receiving information, break the connection. In fact, this option is a double-edged sword for visitors. On the one hand, time limit of useless links (the client to the server without any request action) can reduce the waste of bandwidth, can guarantee the bandwidth of the other visitors; But on the other hand it also easy to cause the client is not convenient to use. As visitors may be temporary have something to go away for a while will interrupt the client connects to the server. Client need to connect to the server, which requires a new connection request, the identity authentication and so on, it will also consumes server resources and bandwidth. So, the timeout for both sides, are both advantages and disadvantages. Therefore, the system administrator in the configuration options, needs assessment, determine whether or not you need to set up this option, and to determine a reasonable timeout. In general, if set the maximum number of client connections, and configure the timeout time is the best. Such as server sets the maximum number of client connection is 100, and now has 100 client connection on the Apache server. But there are 20 clients haven't action for 1 hour. Is likely to be its forget to shut down web page to have a meal, or for other reasons, connected to the server without interrupt. The 20 client connection at this time is a waste. If set the timeout time right now, such as more than 10 minutes without any data transfer action will automatically shut down the client connection. Clearly it can improve the efficiency of the connection points. In the Apache server configuration file, there is a KeepAliveTimeout parameters, compare with the timeout. This parameter is used to set the client and the server after the connection is established, the client the time interval between two requests are put forward. If over a certain time interval, the client has not yet put forward another request, is that interrupts the connection statement. Is the function of these two options is very similar, but there is a very important distinction. Because the client and the server connection when roughly divided into two stages. The first stage is put forward for the client connection but no server response; The second phase has been established between the client and server connection. This parameter applies it in front of the two phases of any one phase. While behind this parameter is only suitable for the second stage, the connection of control. Basically there is no difference in other ways. So in most cases, these two options can be universal. In short, whether to need to use this option to set according to the application server. As a systems administrator, need the server performance and achieve a balance between user convenience. This balance is often difficult to achieve. Need to test many times the system administrator, adjustment, user feedback, finally able to get a reasonable answer.
4,careful to allow persistent connections. The server performance tuning TAB, the content of the "persistent connections are allowed". If selected the content, it means the connection between the client and the server always effective, unless the client manually breaks the connection between the server (such as closing pages or restart the client). If the KeepAliveTimeout parameters in the configuration file is set to true, also can have a similar effect. Need to be careful for this option, the system administrator. Because according to experience, the average user won't initiative to shut down the page. In other words, does not take the initiative to breaks the connection between the client and server. They are likely to be in the computer when it is need to turn it off with interruption of the connection. At this time on the server side although there are a lot of client number of connections, but many were probably die "connection", in a long period of time will not have a data transfer action. For the server, it is a kind of waste on the performance. For this is the author's opinion, rather than the long free time between the user and the server Settings, such as 2 hours or longer, also try not to use persistent connections.