Mirko Giese - 2002-06-27

diese message in deutsch ist hinter dem englischen teil

while playing a little bit on schulhofchat.de i found the following, maybe interesting for you:
we developed php2.2.x and later for using much less ressources from your webserver, special using much less apache-processes than in earlier versions. well, we did reach this ... in theory.
i found that the count of apache-processes did not decrease very much, infact is was nearly the same value like we had in veresion 2.1. but most of them were in keep-alive-status. this fact told me the solution, why this happened: apache keeps a connection - at default - "alive" for 15 seconds, if wished from browser (and all modern browser wish this feature). but the getlines.php script is executed every 10 seconds. so what happend? every chatter request via getlines.php one process for "himself" since the keep-alive-time is always not reached. in other word: every chatter "blocks" one apache-process. this is a quite bad behavior for our needs.
but there is a easy solution for this: lower the keep-alive-timeout in your httpd.conf (sorry, i do not know how to set this in other webservers)
KeepAliveTimeout 5
is the actual setting for schulhofchat.de what halved the open apche-processes.
you can turn also turn keep-alive also off.
if somebody tries this, please tell us what happen (especially how load was changing)

hope that helped a bit

mirko

jetzt nochmal alles auf deutsch:

nachdem ich auf schulhofchat.de ein wenig rumgespielt habe ist mir folgendes aufgefallen:

als wir phpopenchat2.2x entwickelt haben, war das vor allem, um die server-ressourcen zu schonen, insbesondere um die anzahl der benutzen apache-prozesse zu begrenzen. das hat auch funktioniert - theoretisch.
jetzt hab ich aber bemerkt, das die anzahl derbenutzten apache-prozesse nicht wirklich gesunken ist, eigentlich ist sie genauso hoch wie vor version 2.2, nur sind eigentlich alle im status "keep-alive".
und das verrt auch schon das problem und die lsung: apache ist per default auf ein keepalive-timeout von 5 sekunden eingestellt. getlines.php wird jedoch alle 10 sekunden aufgerufen. also passiert das: das timeout wird nie erreicht und jeder chatter besetzt dank getlines.php einen apache-prozess fr sich allein.
problemlsung: keepalivtimeout reduzieren. ich hab das timeout auf 5 sekunden gesetzt und seitdem ht sich die anzahl der aktiven prozesse halbiert. mglicherweise bringt auch das ausschalten von keepalive noch mehr performance, sollte das jemand machen, kann er uns davon erzhlen, insbesondere ei sich die load dabei verhlt.
also httpd.conf editieren und
KeepAliveTimeout 5
setzen (zum beispiel)

so, ich hoffe das hilft ein wenig

viele gre
mirko