Home  |  Linux  | Mysql  | PHP  | XML
From:Robert Russell Date:Tue Jan 26 17:14:13 2010
Subject:php-cgi recycling every couple of minutes causing delays
I run a fairly busy site with a Wordpress blog and vBulletin forums. I
recently dumped Apache and and using nginx for everything (which has been
incredible and I would never go back). I'm using PHP as fastCGI and have a
wrapper script to start the process. We average about 1,000 concurrent users
at any given time. Usually anywhere from 800 to 1200+.

This is the script I found to start php-cgi:



#!/bin/sh

PHP=/usr/bin/php-cgi
PHP_PID=/tmp/php.pid
FCGI_BIND_ADDRESS=127.0.0.1:8888
PHP_FCGI_CHILDREN=4
PHP_FCGI_MAX_REQUESTS=1000

env -i PHP_FCGI_CHILDREN=$PHP_FCGI_CHILDREN \
PHP_FCGI_MAX_REQUESTS=$PHP_FCGI_MAX_REQUESTS \
$PHP -b $FCGI_BIND_ADDRESS &

echo $! > "$PHP_PID"
This has been working great and PHP hasn't completely died on me yet.

The problem that I'm having is that while viewing TOP, php-cgi seems to die
and restart about every 2-3 minutes, sometimes as often as every minute. At
least it restarts itself, but that can take a couple of seconds, causing a
delay if you happen to be browsing the site during this time.

In the above script, I've tried increasing the PHP_FCGI_MAX_REQUESTS, even
as high as 1,000,000. I've also tried completely omitting that value. No
matter what, php-cgi reacts the same way.

I know it needs to recycle itself to prevent memory leaks, but I don't think
it should be happening that often. Any ideas on how to fix this?


Navigate in group php.install at sever news.php.net
Previous Next


Your recent visits
Re: [PHP] 64 Bit IIS 6 ( 32 Bit mode ) + 32Bit php connect with MS-SQL Server
RE: [PHP-WIN] is ZendStudio IDE necessary????
Re: [PHP-INSTALL] What need to do for supporting a new extension?)
subscribe to the PHP installation mailing list
Build fails on Debian Lenny



  
© No Copyright
You are free to use Anything, but please consult your advocate before doing so as this website
also list content from other sources which may be copyrighted.
Site Maintained by Zareef Ahmed
Powered By PHP Consultants