<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Apr 26, 2011, at 4:34 PM, Ray Cote wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>----- Original Message -----<br><blockquote type="cite">From: "Luke Marsden" &lt;<a href="mailto:luke-lists@hybrid-logic.co.uk">luke-lists@hybrid-logic.co.uk</a>&gt;<br></blockquote><blockquote type="cite">To: "Twisted general discussion" &lt;<a href="mailto:twisted-python@twistedmatrix.com">twisted-python@twistedmatrix.com</a>&gt;<br></blockquote><blockquote type="cite">Sent: Tuesday, April 26, 2011 2:08:40 PM<br></blockquote><blockquote type="cite">Subject: Re: [Twisted-Python] 100% CPU on high opened descriptors<br></blockquote><blockquote type="cite">On Tue, 2011-04-26 at 17:42 +0200, Juan Antonio Ibaņez Santorum wrote:<br></blockquote><blockquote type="cite"><blockquote type="cite">Hello!<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;I have a Linux box serving my twisted app. All works ok except<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">after some days running (where I can see my CPU going to 100%). I<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">saw<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">that CPU goes 100% usage when the app reaches to 1024 opened<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">descriptors (sockets).<br></blockquote></blockquote><br>I assume that using a reverse proxy (Apache, nginx, etc.) in front of Twisted removes this problem? <br>(or at least displaces it from being Twisted's problem to being the proxies problem.)<br><br>Is it recommended to always run Twisted behind a proxy?<br></div></blockquote><div><br></div><div>No. &nbsp;It's recommended to fix bugs in Twisted that affect you :). &nbsp;And besides, this problem is not specific to HTTP; it affects any Twisted service that runs on a port, so there are lots of uses of Twisted where you <i>can't</i>&nbsp;run Twisted behind a proxy.</div><div><br></div><div>Plus, this affects clients as well; if you have a twisted spidering application, your client connections could get into this same state. &nbsp;It's possible to handle this sort of attack without any changes to Twisted, by carefully monitoring the number of connections you have open.</div><div><br></div><div>Of course most people just crank up their ulimits and forget about it.</div><br><blockquote type="cite"><div>We've been doing that simply to offload delivery to the final client, but I'm thinking it may have a more general need.<font class="Apple-style-span" color="#000000"><font class="Apple-style-span" color="#144FAE"><br></font></font></div></blockquote><br></div><div>If you have to do it anyway then the discussion is somewhat academic, isn't it? :)</div><div><br></div></body></html>