I use lighttpd
as the webserver, and module mod_fastcgi
is on. So I can fetch php file
with lighttpd
.
Here is a segment of my configure file.
fastcgi.server =(
".php"=>
(
(
"bin-path" => "/usr/local/webserver/php/bin/php-cgi",
"socket" => "/data/online/webim/socket/php-fcgi.socket",
"min-procs" => 100,
"max-procs" => 100,
"check-local" => "disable",
"bin-environment" => (
"PHP_FCGI_CHILDREN" => "10",
"PHP_FCGI_MAX_REQUESTS" => "1000"
),
"bin-copy-environment" => (
"PATH", "SHELL", "USER"
),
"broken-scriptfilename" => "enable"
)
)
)
Once, I made a mistake. A syntax error
is left in the php file.
Then I send many(10000) requests to the webserver.
Soon, the memory used by the php-cgi progresses start to increase crazily
.
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
26829 www 16 0 290m 114m 105m S 0 1.9 0:16.82 php-cgi
25410 www 15 0 287m 112m 105m S 0 1.9 0:17.71 php-cgi
30137 www 16 0 290m 112m 102m S 0 1.8 0:15.38 php-cgi
31099 www 21 0 288m 111m 103m S 0 1.8 0:16.77 php-cgi
30327 www 20 0 287m 110m 103m S 0 1.8 0:22.50 php-cgi
25291 www 16 0 288m 109m 101m S 0 1.8 0:18.26 php-cgi
25413 www 15 0 286m 108m 102m S 0 1.8 0:16.34 php-cgi
30136 www 16 0 288m 108m 101m S 0 1.8 0:15.75 php-cgi
25283 www 18 0 288m 108m 101m S 0 1.8 0:16.29 php-cgi
a single process has 100MB+ memory.. And memory keeps on increasing, the machine becomes slower and slower...
So why this happens? why the memory increase? Any answer, advice or link is welcome. Thanks~