2 messages in ru.sysoev.nginxRe: nginx + php = timeout
FromSent OnAttachments
Anonymous CowardMar 9, 2007 6:04 am 
Jonathan VanascoMar 9, 2007 6:55 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: nginx + php = timeoutActions...
From:Jonathan Vanasco (jvan@public.gmane.org)
Date:Mar 9, 2007 6:55:20 am
List:ru.sysoev.nginx

On Mar 9, 2007, at 9:05 AM, Anonymous Coward wrote:

hello,

i just moved yesterday a relatively big Wordpress blog from an old box with apache2 to a new one with nginx Everything seemed to work ok until ~30 minutes ago when clients started to complain site is working slow and after few checks i noticed that i was gettting "504 Gateway Time-out" and slow loads on php pages but i had no problem with html pages and i have no clue why this is happening im using lighty's spawn-fcgi to spawn php with the following config lines

PHP_FCGI_CHILDREN=5 PHP_FCGI_MAX_REQUESTS=1000

i don't know how usefull this is but lsof showed me that i had ~1100 established nginx connections (4 workers with 1024 connections per worker so this is not an issue) and ~1000 connections to the php-cgi port (don't know if this should be a problem as i have 5 childrens with 1000 max requests each but maybe i didn't understand how this exactly works)

thanks in advance

You need more FCGI children

the MAX_REQUESTSon FCGI are how many requests a child serves before it restarts. think of it like a memory / variable cleansing ritual - it deals with clearing out memory leaks and allocated unused memory in a persistant state.

your problem is that nginx is queing 1100 fcgi requests across 4 nginx workers , and into 5 php processes

check to see how much memory you have running per php child - see if you can at least double-triple your number of children.

if you're not already -- running a cache like eaccelerator / APC will help with getting things a bit faster.

as a ballpark figure -- you'll want at least the same number of FCGI processes as you had 'max servers' in apache2

| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | SyndiClick.com | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | FindMeOn.com - The cure for Multiple Web Personality Disorder | Web Identity Management and 3D Social Networking | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | RoadSound.com - Tools For Bands, Stuff For Fans | Collaborative Online Management And Syndication Tools | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -