[Twisted-Python] 100% CPU on high opened descriptors

Luke Marsden luke-lists at hybrid-logic.co.uk
Thu May 19 14:08:00 MDT 2011


Hi Juan,

You could try:

        print reactor.__class__

This should allow you to check that the twistd command-line argument is
working.  Example:
        
        luke at pow:~$ twistd -noy foo.py |head -n 1
        <class 'twisted.internet.selectreactor.SelectReactor'>
        
        luke at pow:~$ twistd -r poll -noy foo.py |head -n 1
        <class 'twisted.internet.pollreactor.PollReactor'>
        
        luke at pow:~$ cat foo.py
        from twisted.internet import reactor
        from twisted.application import service
        print reactor.__class__
        application = service.Application("nothing")

-- 
Best Regards,
Luke Marsden
CTO, Hybrid Logic Ltd.

Web: http://www.hybrid-cluster.com/
Hybrid Web Cluster - cloud web hosting

Phone: +447791750420


On Thu, 2011-05-19 at 21:57 +0200, Juan Antonio Ibañez Santorum wrote:
> Is there any way to check if it is using the the poll/epoll reactor?
> 
> 
> Regards
> 
> 2011/4/26 Luke Marsden <luke-lists at hybrid-logic.co.uk>
>         On Tue, 2011-04-26 at 17:42 +0200, Juan Antonio Ibañez
>         Santorum wrote:
>         > Hello!
>         >    I have a Linux box serving my twisted app. All works ok
>         except
>         > after some days running (where I can see my CPU going to
>         100%). I saw
>         > that CPU goes 100% usage when the app reaches to 1024 opened
>         > descriptors (sockets).
>         
>         
>         You can also switch to using the "poll" reactor, which will
>         allow you to
>         sustain more than 1024 connections.  You should still figure
>         out what is
>         keeping your connections open and find a way to reap them
>         however, as
>         this will just delay the problem.  As Glyph suggested an
>         application
>         level "ping" may help here.
>         
>         In the mean-time you can switch to the poll reactor by adding
>         "-r poll"
>         to your twistd command.
>         
>         --
>         Best Regards,
>         Luke Marsden
>         CTO, Hybrid Logic Ltd.
>         
>         Web: http://www.hybrid-cluster.com/
>         Hybrid Web Cluster - cloud web hosting
>         
>         Phone: +447791750420
>         
>         
>         
>         _______________________________________________
>         Twisted-Python mailing list
>         Twisted-Python at twistedmatrix.com
>         http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
> 
> 






More information about the Twisted-Python mailing list