<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.2769" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=843084009-07122005></SPAN><FONT face=Arial><FONT size=2>I<SPAN 
class=843084009-07122005> am running Twisted 1.3 server with a fairly&nbsp;large 
number of clients.</SPAN></FONT></FONT></DIV>
<DIV><FONT><FONT size=2><SPAN 
class=843084009-07122005></SPAN></FONT></FONT><SPAN 
class=843084009-07122005></SPAN><FONT face=Arial><FONT size=2>T<SPAN 
class=843084009-07122005>he hardware is two 64 bit 3.0 GHz Xeons with HT, 4GB 
RAM, and it's on 2.6.11 kernel.</SPAN></FONT></FONT></DIV>
<DIV><FONT><FONT size=2><SPAN 
class=843084009-07122005></SPAN></FONT></FONT><SPAN 
class=843084009-07122005></SPAN><FONT face=Arial><FONT size=2>I<SPAN 
class=843084009-07122005> am using poll reactor.</SPAN></FONT></FONT></DIV>
<DIV><FONT><FONT size=2><SPAN 
class=843084009-07122005></SPAN></FONT></FONT><SPAN 
class=843084009-07122005></SPAN><FONT face=Arial><FONT size=2>C<SPAN 
class=843084009-07122005>urrently, when the number of clients approaches 5000, 
the "top" shows 99% CPU load for twistd process, the event loop slows down and 
weird racing conditions show up. </SPAN></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT size=2><SPAN 
class=843084009-07122005></SPAN></FONT></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial><FONT size=2><SPAN class=843084009-07122005>My clients 
basically do nothing: they connect and just sit there, sending application-level 
keep-alives (null character string)&nbsp;to the server every 90 sec, which are 
echoed back. The connections/ disconnections for clients are rare- about 4-5 per 
sec. So I am mostly dealing with 5000 clients in the ESTABLISHED state. Very 
rarely&nbsp;(5x per second on average)&nbsp;one of the&nbsp;clients gets a 
message from the server, but I am sure that this is not what keeps the load so 
high (I slowed down message rates, and the CPU load did not 
change).&nbsp;&nbsp;</SPAN></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT size=2><SPAN 
class=843084009-07122005></SPAN></FONT></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial><FONT size=2><SPAN class=843084009-07122005>What are your 
thoughts on this performance? Is this load mainly due&nbsp;to poll() overhead, 
polling a large number of file descriptors? </SPAN></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT size=2><SPAN class=843084009-07122005>I would love 
to try an epoll reactor, but as I understand, it's not yet 
available?</SPAN></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT size=2><SPAN 
class=843084009-07122005></SPAN></FONT></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial><FONT size=2><SPAN class=843084009-07122005>Additionally, 
the process leaks about 100MB memory per day. I made the garbage collector print 
out the number of objects traced by it every 30 min, and this number stays more 
or less constant. When the memory held by the process becomes larger, the event 
loop further slows down, and the performance with the same number of clients 
degrades, as the memory footprint increases. </SPAN></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT size=2><SPAN 
class=843084009-07122005></SPAN></FONT></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial><FONT size=2><SPAN class=843084009-07122005>Thanks for any 
advice.</SPAN></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT size=2><SPAN 
class=843084009-07122005></SPAN></FONT></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial><FONT size=2><SPAN 
class=843084009-07122005>Alec.</SPAN></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT size=2><SPAN 
class=843084009-07122005></SPAN></FONT></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2></FONT><BR></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV></BODY></HTML>