[Twisted-Python] Twisted Web at 630k reqs/sec
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/myr... Details, figures and more results are here: https://github.com/crossbario/crossbarexamples/tree/master/benchmark/web Cheers, /Tobias
Hi Tobias,
On Nov 10, 2015, at 4:54 PM, Tobias Oberstein
wrote: 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/myr...
Details, figures and more results are here:
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 Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
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.
Yep, using new style classes is indeed recommended for performance on PyPy. We are using new style classes throughout Autobahn and Crossbar.io, but I haven't measured effects.
Am I correct in stating that SO_REUSEPORT only produces the desired balancing of requests between twisted processes on Linux?
You need Linux kernel 3.9+. DragonFly BSD also claims support, but I haven't tried. We should also be able to make Windows work, after some more things have landed for the Twisted IOCP reactor. Cheers, /Tobias
Thanks,
L. Daniel Burr
Cheers, /Tobias
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
On Wed, Nov 11, 2015 at 9:55 PM, Tobias Oberstein < tobias.oberstein@tavendo.de> wrote:
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.
Yep, using new style classes is indeed recommended for performance on PyPy. We are using new style classes throughout Autobahn and Crossbar.io, but I haven't measured effects.
Am I correct in stating that SO_REUSEPORT only produces the desired
balancing of requests between twisted processes on Linux?
You need Linux kernel 3.9+. DragonFly BSD also claims support, but I haven't tried. We should also be able to make Windows work, after some more things have landed for the Twisted IOCP reactor.
Cheers, /Tobias
Thanks,
L. Daniel Burr
Cheers,
/Tobias
Hi Tobias Have you tried to test crossbar on windows? I heard that stdio performs very bad on windows. I noticed crossbar use pipe to transfer data between process. Regards gelin yan
Hi Tobias Have you tried to test crossbar on windows? I heard that stdio
Yes, I have tried that;) Crossbar.io supports Windows!
performs very bad on windows. I noticed crossbar use pipe to transfer data between process.
Only for control/management: that is traffic between the node controller process and the worker processes. Performance is irrelevant on that. What's required for high-performance on Windows is the Twisted IOCP reactor. For Python 2 that works quite well. For Python 3 some bits are missing in Twisted (Hawkie is working on that). For shared sockets (which Crossbar.io uses for multi-core scaling), more work on the IOCP reactor would be needed. Cheers, /Tobias
Regards gelin yan
2015年11月15日 下午6:09,"Tobias Oberstein"
What's required for high-performance on Windows is the Twisted IOCP reactor. For Python 2 that works quite well. For Python 3 some bits are missing in Twisted (Hawkie is working on that). For shared sockets (which Crossbar.io uses for multi-core scaling), more work on the IOCP reactor would be needed.
Hi tobias 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 iocp with thread pools. Due to GIL, well, use thread pools on python doesn't make any sense for that. regards gelin yan
On Sun, Nov 15, 2015 at 8:25 PM, Gelin Yan
2015年11月15日 下午6:09,"Tobias Oberstein"
写道: What's required for high-performance on Windows is the Twisted IOCP reactor. For Python 2 that works quite well. For Python 3 some bits are missing in Twisted (Hawkie is working on that). For shared sockets (which Crossbar.io uses for multi-core scaling), more work on the IOCP reactor would be needed.
Hi tobias
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 iocp with thread pools. Due to GIL, well, use thread pools on python doesn't make any sense for that.
regards
gelin yan
Hi Finally I found this link https://msdn.microsoft.com/en-us/library/windows/desktop/ms740478(v=vs.85).a... This feature is only available on windows 8.1 or later. It would be great if twisted can support this feature. Regards gelin yan
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-... 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).a...
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
participants (3)
-
Gelin Yan
-
Louis D. Burr
-
Tobias Oberstein