On Mar 19, 2011, at 8:39 AM, Michael Thompson wrote:

> I agree that threads and processes is going to be the first step to
> scaling but I don't think there's much advantage putting that in
> twisted given that there are other solutions for this.

Other solutions for what?  If Twisted is going to be a WSGI container, it 
should (eventually) be a multiprocess container, since that approach scales 
better to the number of CPUs.  Other options in the arena of single-machine 
load-balancing require lots of tedious setup and usually subtly affect the 
semantics of your application (you have to do work to make sure the application 
gets the correct idea of what URL it's being visited at and who the client is).

It would be even better if Twisted could automatically scale your WSGI 
application up to multiple hosts, even.  This is exactly the sort of thing that 
Twisted is good at.

> I was hoping that changing the reactor would give an easy way to make
> Twisted look better, from a PR point of view. To check I ran a
> benchmark on two EC2 m1.small machines using

Changing the reactor typically affects applications with a high degree of 
concurrency (more than 1000 concurrent connections) where the bottleneck is the 
multiplexing mechanism.  It can affect other things sometimes, but that's the 
usual problem it's meant to address.

The benchmark we're discussing is handling only a few requests at a time.  
Itamar's approach to widening the threadpool is a better way to increase 
concurrency than changing the reactor, since the number of concurrent requests 
will be bottlenecked on the maximum number of threads anyway.

> So looks like the reactor has nothing to do with it. Here some profile 
> results for the select reactor.

If you want to turn this profiling project into some optimizations, add a 
simple WSGI requests-per-second benchmark to a branch of 
<https://code.launchpad.net/~exarkun/+junk/twisted-benchmarks>, tell exarkun 
about it, and then submit a patch which makes that benchmark's number go up.

Thanks for following up on it!

_______________________________________________
Twisted-Python mailing list
[email protected]
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Reply via email to