|
From: <gne...@us...> - 2008-12-27 00:36:46
|
Update of /cvsroot/aolserver/aolserver/tcl In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv24700/tcl Modified Files: pools.tcl Log Message: New configure parameter "spread" for ns_pools: Background: Requests are distributed to idle threads via CondSignal, which delivers subsequent signals to idle threads in a circular manner (i.e. t1, t2, .. tn, then t1 again) determined by the scheduling policy of the operating system. This round robin behavior has the disadvantage that multiple threads terminate about at the same time, based on the maxconnections (or maxconns) value. The idle timeout will never be used on a sufficiently busy server. The mass termination of threads is performance-wise bad, especially when many connections threads are configured, since it is likely that about the same amount of threads will be recreated. The "spread" parameter introduces a random factor into threadtimeout and maxconnections to avoid these termination cycles. It adds +/- the specified percentage to maxconnections and threadtimeout (e.g. a spread of 20 means a random value between 0.80 to 1.20 of the specified value of maxconnections and threadtimeout for every connection thread). Index: pools.tcl =================================================================== RCS file: /cvsroot/aolserver/aolserver/tcl/pools.tcl,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** pools.tcl 1 Aug 2007 22:30:51 -0000 1.4 --- pools.tcl 27 Dec 2008 00:36:39 -0000 1.5 *************** *** 36,41 **** set maxconns [ns_config $cfgsection maxconnections 0] set timeout [ns_config $cfgsection threadtimeout 0] ! ns_pools set default -minthreads $minthreads -maxthreads $maxthreads -maxconns $maxconns -timeout $timeout ns_log notice "default thread pool: [ns_pools get default]" --- 36,42 ---- set maxconns [ns_config $cfgsection maxconnections 0] set timeout [ns_config $cfgsection threadtimeout 0] + set spread [ns_config $cfgsection spread 20] ! ns_pools set default -minthreads $minthreads -maxthreads $maxthreads -maxconns $maxconns -timeout $timeout -spread $spread ns_log notice "default thread pool: [ns_pools get default]" |