4 ms·
Python network programs, especially ones with many connections, should use Twisted. A benchmark of anything but the best library/tools in each language is poin
by lucian1900 14y ago
Python network programs, especially ones with many connections, should use Twisted.
A benchmark of anything but the best library/tools in each language is pointless.
- TazeTSchnitzel 14y agoOne of the good Twisted WebSocket libraries is called txWS: https://github.com/MostAwesomeDude/txWS https://github.com/MostAwesomeDude/txWS It wraps an existing TCP factory, and makes it work with WebSocket. The entire API is a single function.
- ericmoritz 14y agoExcellent. I wanted to write a twisted implementation. care to take a crack at it and submitting a pull request?
- TazeTSchnitzel 14y agoShould I have time, I'll think about it.
- ericmoritz 14y agoI can implement the server. Is there anything I should know about tuning Twisted for this kind of benchmark?
- TazeTSchnitzel 14y agoI don't know much about tuning Twisted, sorry, but maybe experiment with different reactors, like the libevent one?
- Scramblejams 14y agoIf you haven't yet, hit up #twisted on freenode for any tips you need. Lots of heavy hitters there who are happy to help.
- hogu 14y agothe python ws benchmark uses gevent with ws4py, it's also asynchronous - do you expect twisted to outperform gevent? why?
- lucian1900 14y agoFor trivial cases gevent might be fast, but its design is simply flawed, it doesn't handle all the intricacies of networks. Regardless, using a single library, and not even the mainstream one, makes for a poor benchmark.
- allardschip 14y agoCan you elaborate on what you think is wrong with Gevent? It comes out pretty well in this shootout: http://nichol.as/benchmark-of-python-web-servers http://nichol.as/benchmark-of-python-web-servers
- lucian1900 14y agoA common case where it goes very wrong is disconnection logic. It's rather complex and gevent has a very naive view of it, which means you can get stuck greenlets. Micro-benchmarks rarely are complex enough to expose design problems, my point was that one should at least use the de-facto standard, if not several alternatives too.
- rdtsc 14y agoWhy not gevent or eventlet?