预先派生模型有一些优点,例如健壮性以及可靠性。如果子进程异常退出,那么服务器就会丢失一个连接,而且仅仅丢失一个连接。服务器的其余部分还将继续运行,并且可以为请求提供服务。唯一可以注意到问题出现的用户就是不幸地进行了导致问题地请求的用户。
不过预派生模型也有自己的缺点,比如扩充性。
这种设计的最后问题就是它会消弱某些优化。因为每个请求都会在它自己的进程中运行,所以进程之间很难共享任何信息。
http://archive.netbsd.se/?ml=apache-httpd-dev&a=2004-02&t=44730
hmmm, looks like the httpd parent is trying to shut down a child process gracefully after a decrease in traffic.
write(6, "!", 1) means it's using the pipe of death. Since waitpid() is returning 0, it looks the child processes aren't responding to the pipe of death. Could it be that network traffic is totally dried up during these periods? or could the child processes be in the middle of some long running request?
Could it be that network traffic is totally dried up during these periods? or could the child processes be in the middle of some long running request?
从这两句来看,似乎 parent write(6, "!", 1) 之后, child 需要等到有一个请求之后才会知道这个消息。child 在 idle 的时候,应该处在:
accept_mutex_on();
accept();
accept_mutex_off();
被阻塞在 accept ,这个时候尽管 parent 写 pod ,但是不能把 child 从 accept 中唤醒过来。
http://www.webmonkey.com/webmonkey/97/49/index3a_page4.html?tw=backend
This effectively locks those children into serving requests from that one socket and no other sockets, and they'll be stuck there until enough new requests appear on that socket to wake them all up.