When the Web server load increases due to an increase in Web server access or impact of a business application, a functionality called flow-restricting functionality maintains the efficiency of Web service process by restricting the number of users who access the Web site.
You can use flow-restricting functionality by embedding the mod_hws_qos module in Cosminexus HTTP Server. You can achieve the following by using the flow-restricting functionality. Hereafter, 'number of server processes' refers to the 'number of server threads' for Windows version.
For providing an adequate amount of Web service, you need a sufficient number of server processes that can satisfy the number of users accessing the Web service at the same time. If one Web server is not enough, arrange for multiple Web servers, distribute the access by load distribution functionality, and design the operation for assured Web services.
As mentioned above, prepare the Web service resources, and also use the flow-restricting functionality to prepare for the temporary overloaded status. The following figure shows an overview of flow-restricting functionality using mod_hws_qos:
Figure 4-12 Overview of the flow-restricting functionality using mod_hws_qos
You need to embed the mod_hws_qos module to use the flow-restricting functionality. Specify the following directives in the configuration file (httpsd.conf) to embed the mod_hws_qos module:
LoadModule hws_qos libexec/mod_hws_qos.so |
LoadModule hws_qos modules/mod_hws_qos.so |
Following examples describe the settings of each directive for the flow-restricting functionality:
If the specifications are as follows, and number of server threads being requested is 13, a new request is denied with the status code 503.
MaxClients 15
QOSRejectionServers 2
QOSCookieServers 0
ThreadsPerChild 15
QOSRejectionServers 2
QOSCookieServers 0
The session management performed by using cookies provides the HWS creation mode, in which the cookies generated on Cosminexus HTTP Server are used, and the user creation mode, in which the cookies generated on external modules other than on Cosminexus HTTP Server are used. You can select which mode is to be used by using the QOSCookieName directive.
If you specify the following, and if the number of requested server threads is 10, the server will deny a new session request without cookie, however, the server will process a maintenance session with cookie. If the number of requested server threads is 13, the server will deny the request regardless of the cookie. This example is performed in the HWS creation mode.
MaxClients 15
QOSRejectionServers 2
QOSCookieServers 5
ThreadsPerChild 15
QOSRejectionServers 2
QOSCookieServers 5
When the flow-restricting functionality denies a request process the server returns a response message with the status code 503. However, you can redirect the request to some other Web server by specifying the following. If a request for /index.html is denied from the flow-restricting functionality, index.html of the www1.hitachi.co.jp Web server is set in the response header, and the request is returned with the status code 302:
QOSRedirect /index.html http://www1.hitachi.co.jp/index.html
If you specify the following, the contents of htdocs/busy.html are returned in the response message with the status code 503, as the response for the denied request.
QOSResponse file "text/html; charset=ISO-8859-1" htdocs/busy.html
Set-Cookie: NAME=VALUE; expires=DATE; path=/; domain=DOMAIN_NAME; secure |
When access is denied by the flow-restricting functionality, the Expires header, which stops the response message from being cached, is added to the response header. This is because if the response is cached, the cached message is displayed, and requests might not be sent to the server, even if the server can accept request processing. The server disconnects after sending the denial message.
The other response headers are set as shown below. The character set specified in the AddDefaultCharset directive is added to the Content-Type header.