Seems switching back to UNIX sockets helps performance a bit, at least
by closing the "closed" connections immediately without TIME_WAIT. The
problem of connections to the fastcgi still appears though. And it
seems it has something to do with cherokee eating up CPU..
When the number of connections backlogged (and thus wanting access to
the UNIX socket) rises above some limit, cherokee goes ballistic
eating all CPUs it can get to, while nginx closes the offending
connections. While cherokee might be right in waiting to eventually
answer those connections, this is still inherently a problematic case
that might need looking into..

Is there a limit on conenctions per UNIX socket ?
Is there a way to use a small amount of php connections and push
requests through them, waiting for them to free up instead of opening
them by thousands?

--
 silvio

On Sun, May 30, 2010 at 6:58 PM, Silvio Ventres
<[email protected]> wrote:
> Helo again, All, Alvaro !
>
> Wanted to add that both lighttpd and nginx seem to exhibit this
> behavior - opening N tcp sockets to the php cgi/fpm where N = number
> of outstanding requests.
> Was kinda hoping that there exists some kind of a buffered backlog
> where the queries are given to php when it frees up instead of opening
> a heckload of sockets, which php has trouble coping with, not using
> epoll etc.
>
> Another thing noticed, though, is that cherokee seems to close
> connections during the test much more often than both nginx and
> lighttpd. Is there some parameter that is not exposed in config file
> regarding this ? Talking about cherokee just sending FIN+RST packets,
> seen through sniffer log. Weighttp shows these in status after test as
> "failed" connections.
>
> Thanks!
>
> --
>  silvio
>
> On Sun, May 30, 2010 at 6:07 PM, Silvio Ventres
> <[email protected]> wrote:
>> Hello !
>>
>> Using cherokee 1.0.1 with php 5.3.0 with php-fpm using mysql through
>> php-mysql/mysqlnd.
>> After moving cherokee from UNIX-sockets to TCP port 9000, seeing
>> cherokee creating lots and lots (to the amount of total requests) of
>> connections to php-fpm port 9000 when doing benchmarking.
>> Is that the FastCGI spec ?
>> The php that is served only does mysqli_connect("p:dbname",u,p,db)/
>> benchmarking with weighttp gives ~2000req/s when doing 300 concurrent
>> connections, but looking at netstat, you can see that the connections
>> are being backlogged (number of connections grows nearly to the number
>> of total requests done). Benchmarking with more concurrent connections
>> fills up the backlog faster and completely stalls the server and
>> execution, since the server has to deal with lots of TIME_WAIT
>> connections. Also, it seems that the file-descriptor limit set in
>> cherokee.conf is being imposed here, thus, cherokee having ~1000
>> client connections and additional ~39000 php-fpm connections brings
>> the total to 40000 which is the limit in the local config here.
>>
>> Is this a known behavior ?
>> This might also be the problem with the UNIX sockets - if cherokee
>> tries to open 40000 connections to UNIX sockets stuff will go bad...
>>
>> Benchmark cmdline:
>> weighttp -k -c 2000 -n 16000 <url>
>>
>> ...at some point about 4 seconds into the benchmark..
>> r...@solid:~# netstat -an|wc -l
>> 16288
>>
>> p.s. Behavior with UNIX sockets is a bit better, until it goes to
>> 200%. The benefit of UNIX sockets here is that they don't have
>> TIME_WAIT state which takes up from the fd limit and might affect
>> epoll_wait performance of cherokee.
>> Setting tcp_tw_reuse doesn't help. Setting tcp_tw_recycle helps
>> immediately but eventually over 60% of the connections get dropped.
>>
>> References:
>>
>> Weighttp = http://redmine.lighttpd.net/projects/weighttp/wiki
>>
>> php file (doesn't have error checking as the error was checked for before):
>> <?php
>> $link = mysqli_connect('p:localhost','user','pass','tests');
>> //printf("Host info: %s\n", mysqli_get_host_info($link));
>> echo test_echo;
>> ?>
>>
>
_______________________________________________
Cherokee mailing list
[email protected]
http://lists.octality.com/listinfo/cherokee

Reply via email to