Hitachi

uCosminexus Application Server HTTP Server User Guide


4.1.2 Architecture of HTTP Server process (UNIX version and worker MPM module)

Organization of this subsection

(1) Process architecture

The following figure shows the architecture of HTTP Server process.

Figure 4‒4: Architecture of HTTP Server process (UNIX version and worker MPM module)

[Figure]

When you start HTTP Server, the control process starts. The control process starts the server process to process the request, and monitors the server process operations. The server process starts the main slot, a listener slot, and server threads for the number specified in the ThreadsPerChild directive. Use the ServerLimit directive to specify the maximum number of server processes.

The OS receives the TCP connection of client, from the IP address and port specified in the Listen directive, and reserves the connection in the Listen queue of OS. You can specify the size of the Listen queue in the ListenBacklog directive. The TCP connection that cannot be stored in the Listen queue is not established. The listener thread of the server process picks up a TCP connection stored in the Listen queue, and then registers this connection in a queue in the server process. Then, the server thread picks up the TPC connection from the queue in the server process and performs processing. The maximum number of queues that can be registered in a server process is specified in the ThreadsPerChild directive.

The control process is granted the user and group privileges with which the HTTP Server was started. The server process is granted the user and group privileges specified by using the User and Group directives. Both the control process and server process have the same process name, httpsd (the name of the executed program). The process ID of the control process is output to the file that is specified by the PidFile directive.

(2) Transition of number of processes

To avoid the load concentration on the server, the maintenance generates 2n-1 server processes (n is the number of continuous maintenance executions, where n = 6 if number of processes is more than or equal to 6) in one second. Server processes are generated until the number of server threads in the waiting state reaches the number specified in the MinSpareThreads directive or until the total number of server threads reaches the number specified in the MaxClients directive. When 8 or more server processes are generated in a single maintenance, an error is logged (info level).

If the request processing ends, the state of the server process changes to the waiting state. If the number of server threads in the waiting state increases, exceeding the value of the MaxSpareThreads directive, the server processes are terminated during maintenance.

(a) Notes

  • For worker MPM, increase in the cost of CGI process generation processing and performance degradation are proportional to the number of server threads. Therefore, we recommend that you use prefork MPM when running CGI programs.

  • Specify a large value in the StartServers directive, in the cases such as you must process a large number of requests immediately after starting or restarting the Web server.

  • The number of the processes generated after the Web server starts are controlled depending upon the MaxSpareServers and the MinSpareServers directives, and hence the specified value in the StartServers directive becomes irrelevant (except when the HWSKeepStartServers directive is set to On). Specify the MinSpareServers and the MaxSpareServers directives for preparing the processes in waiting state such that they can handle the sudden increase in number of requests. If error logging (info level) occurs frequently in the maintenance process, adjust the values of these directives to increase the number of waiting processes.

  • If many server processes are always kept in the waiting state, concurrent connection requests from many clients can be received. However, you need to take precaution because that much server resources will be consumed.

  • When the queues in all server processes become full, a TCP connection will be reserved in the Listen queue according to the specification of the ListenBacklog directive.

  • A server process ends after processing the number of requests specified in the MaxRequestsPerChild directive. However, if the MaxRequestsPerChild directive is set to 0, the server process does not end with the request process count. If there are chances of memory leakage in the application programs created by the end-user, the specification of the MaxRequestsPerChild directive is applied.

  • When an abnormal termination signal is sent to the server process (even when a failure occurs in API connection module), the process outputs information about the abnormal termination to the error log (notice level). An error log of notice level is output regardless of the LogLevel directive specification.

  • When you want to keep running the number of server processes specified in the StartServers directive regardless of the specification of the MaxSpareThreads and MinSpareThreads directives, specify On in the HWSKeepStartServers directive. If the number of server processes becomes less than the number specified in the StartServers directive, new processes are generated until the number of server processes reaches the specified value.

  • If you stop HTTP Server, the files specified in the PidFile directive are deleted. However, when HTTP Server is forcibly stopped by something other than the program, for example, the machine is shut down without stopping HTTP Server, the files specified in the PidFile directive remain undeleted. Starting HTTP Server again might result in a failure. If the files specified in the PidFile directive are present while HTTP Server is not running, delete the files before restarting HTTP Server.

(b) Example transition of the number of processes and the number of threads

Figure 4-5 shows an example transition of the number of processes and number of threads.

  • Specified values of directives

    ServerLimit 3
    StartServers 1
    MinSpareThreads 4
    MaxSpareThreads 12
    ThreadsPerChild 5
    MaxClients 15
    Figure 4‒5: Example transition of the number of processes and number of threads

    [Figure]