Discussion:
[Twisted-Python] Twisted Web at 630k reqs/sec
Tobias Oberstein
2015-11-10 22:54:23 UTC
Permalink
Hi,

maybe it's of interest how far it's possible to drive Twisted Web on
modern multi-core CPUs.

Here are 2 data points from measuring:

* 627990 HTTP requests/s at 360 us avg latency
* 12.6 GB/s HTTP reply traffic

This is using 40 Xeon cores and serves HTTP over loopback TCP to 8
threads of wrk. The Twisted Web resource served was

https://github.com/crossbario/crossbarexamples/blob/master/benchmark/web/myresource.py

Details, figures and more results are here:

https://github.com/crossbario/crossbarexamples/tree/master/benchmark/web

Cheers,
/Tobias
Louis D. Burr
2015-11-10 23:34:38 UTC
Permalink
Hi Tobias,
Hi,
maybe it's of interest how far it's possible to drive Twisted Web on modern multi-core CPUs.
* 627990 HTTP requests/s at 360 us avg latency
* 12.6 GB/s HTTP reply traffic
This is using 40 Xeon cores and serves HTTP over loopback TCP to 8 threads of wrk. The Twisted Web resource served was
https://github.com/crossbario/crossbarexamples/blob/master/benchmark/web/myresource.py
https://github.com/crossbario/crossbarexamples/tree/master/benchmark/web
Those are some nice numbers, to be sure! Twisted really benefits from running in a pypy vm. I have read that pypy still doesn’t optimize old-style classes as efficiently as new-style classes; I wonder if there would be any meaningful change in the metrics if resource.Resource was a new-style class instead of an old-style class.

(Note that mixing in object, e.g., class Foo(resource.Resource, object), to produce a new-style class apparently makes pypy unhappy. See http://pypy.org/performance.html for details.)

Am I correct in stating that SO_REUSEPORT only produces the desired balancing of requests between twisted processes on Linux?

Thanks,

L. Daniel Burr
Cheers,
/Tobias
_______________________________________________
Twisted-Python mailing list
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
Tobias Oberstein
2015-11-16 20:11:42 UTC
Permalink
Are you sure IOCP is able to share sockets between process? It
would be great if you can share some info about this. I only use
No, I am not sure. But this SO reply seems to suggest

http://stackoverflow.com/questions/14388706/socket-options-so-reuseaddr-and-so-reuseport-how-do-they-differ-do-they-mean-t/14388707#14388707

But: there are actually 2 things required (which Linux does):

a) able to share sockets (without communicating a socket descriptor over
some channel)
b) have the kernel load-balance incoming connections over all processes
listening

E.g. FreeBSD does only a) currently, not b)
https://msdn.microsoft.com/en-us/library/windows/desktop/ms740478(v=vs.85).aspx
This feature is only available on windows 8.1 or later. It would be
great if twisted can support this feature.
Interesting! But that's not what Linux does, as it requires to
communicate WSAPROTOCOL_INFO over to other processes.

AND: it's not clear from the MS docs if the Win kernel will actually
load-balance incoming connections.

Cheers,
/Tobias

Loading...