[Twisted-Python] network server on multiprocessor hardware

Bokhan Artem art at academ.org
Sat Sep 5 07:56:34 EDT 2009


Glyph Lefkowitz пишет:
> On Fri, Sep 4, 2009 at 4:59 PM, Bokhan Artem <art at academ.org 
> <mailto:art at academ.org>> wrote:
> 
>     Hello.
> 
>     Is there right (standard) way to write twisted network server
>     (tcp/web/mail/etc) which could use several cpu cores? For example,
>     master+workers model, where every worker doing the same job.
>     If so, may somebody help to wrap the sample code below?
>     May be some well-known twisted based software can do that?
> 
> 
> The sample code you've provided doesn't do anything;

Yes, it's just a dummy sample.

> no CPU consumption of its own (it's all in the framework) and no network I/O of its own.

> So it's hard to come up with a realistic example.  There's no way to 
> tell Twisted itself to spread itself out over multiple CPU cores, but 
> then, Twisted itself is rarely the chief CPU consumer in an application.

This dummy sample can serve about 1k req/s on one cpu core. I want to find 
standard ways to make it serve 1k*ncpu req/s.

I see only one way: run master which listen network and balance requests between 
several forked twisted processes. I'm not very familiar with twisted so I want 
to see somebody's opinion and may be examples.
> 
> If you want to take advantage of multiple CPU cures though, have a look 
> at Ampoule: <https://launchpad.net/ampoule>.

Thanks, I'll take a look.

> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> 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