[Twisted-Python] Threaded Twisted?

Bob Ippolito bob at redivi.com
Wed Oct 20 07:07:58 EDT 2004

On Oct 20, 2004, at 6:00, Stefan Behnel wrote:

> I wondered what would be the best way of running Twisted on a 
> multi-processor system.

Multiple processors, multiple processes.  Multiple processes is a good 
model anyways because it scales to clusters of machines.

> I can run multiple instances of my program, but the message passing 
> between them becomes somewhat more expensive than I would like 
> (serialization).

It's probably not as expensive as having a Global Interpreter Lock 
(GIL) that prevents multiple threads from running Python code at the 
same time, diluting any benefits you would see from concurrent 

> Can Twisted run in multiple Threads? Meaning: use two concurrent 
> reactors?
> As far as I understand it, the reactor is implemented as a singleton, 
> but since different reactor types are already supported, I wonder if 
> anyone could think of a way of achieving that...

No it can not use two reactors.  Even if it could, you wouldn't get 
much better performance due to the GIL.


More information about the Twisted-Python mailing list