i use php over localhost TCP and it works great - and fast - not sure
why it's slow to you...
perhaps ensure its "127.0.0.1" and not "localhost" ... i don't know.
It seems there are two problems that make this behavour possible, one is in
linux kernel and second is in nginx. When the backlog for a listening unix
socket is full (when all workers are busy for some reason) the kernel returns
EAGAIN on next connect() attempt (not EINPROGRESS as you would expect for tcp
sockets). It seems that nginx cannot handle this situation normally and just
drop connection to a backend returning error to the client:
http://www.ruby-forum.com/topic/132314
Can you check nginx' error_log file for exact message when it issues an
error ?
> static html pages are served very quickly at any time. mysql database
> is
> also very fast... there are no great table locks or something that
> would
> slow up php.
> anyway.. php slows down without mysql connections.
>
> cpu idle is about 60% when php slows down... so there is enough power.
It might be shared file locks or something like that. You may try to attach to
php worker process with strace and see what happening inside single php
request - this might give you an idea where to dig next.
> so i had the idea that there could be a problem with the amount of
> connections on tcp and/or the socket. is there a limit for socket or
> tcp
> connections?
> how can i figure out if i reach this limits and how could i solve
> this
> problem?
>
> thanks a lot
> greets, alex
--
Andrei Nigmatulin
GPG PUB KEY 6449830D
Now I lay me down to sleep(3)
Pray the OS my core to keep
If I die before I wake
Pray the Disk my core to take
that could be why - it's waiting for the engines to process so it can
process... have you tried setting more engines up?
this would be where the statistics in php-fpm would be a good help
you'd know how many engines you have being called on average and know
if you're hitting your limits
On 7/2/08, Mr_Vista <style...@googlemail.com> wrote:
>
Yes, exactly. TCP sockes behave differently at this point.
> i read the thread you posted. could you tell me anything about that?:
> "Try to increase backlog in the fcgi spawn utility."
To set a backlog to higher value:
$ echo "4096" > /proc/sys/net/core/somaxconn
and restart php-fpm or spawn-fcgi.
But this will not solve your problem with hanging php. This should only reduce
a probability of error occurrence.
To solve problem completely you have to found the reason why php executes too
slow on your server while cpu is not fully loaded.