-
Website
http://brizzled.clapper.org/ -
Original page
http://brizzled.clapper.org/id/88 -
Subscribe
All Comments -
Community
-
Top Commenters
-
mattbriggs
4 comments · 1 points
-
Ray3
1 comment · 1 points
-
Brian Clapper
55 comments · 1 points
-
breton
2 comments · 1 points
-
andrewziem
1 comment · 2 points
-
-
Popular Threads
-
Brizzled: Scala and Python: An informal TCP performance benchmark
6 days ago · 1 comment
-
Brizzled: Scala and Python: An informal TCP performance benchmark
I am sad that Twisted fared so poorly in this comparison. Twisted isn't really heavily optimized; I wish we had more time to do performance analysis on it.
One thing you might want to try to validate these results, though, would be to re-run the test with httperf. I'm not suggesting that Twisted would fare better as a result, but when doing benchmarks of my own I've found 'ab' to be buggy and sometimes grossly misreport its results. httperf, on the other hand, has been very reliable.
I'm also disappointed at Twisted's performance. Its programming model tends to pervade an application; ripping it out or replacing it could be annoying.
On my machine (MBP-2.4Ghz) I went from 2896 rps to 3759.
Any chance you could try and same recipe and see how the results compare to what you already have?
I was also questioning the checking character by character for the newline, but in the big scheme of things it didn't add any time to the execution time.
Ken
And, yes, a threadpool is a trivial way to speed it up. In fact, the Scala Actor implementation does exactly that: It multiplexes 1,000 lightweight actors across a thread pool. (The Scala library handles that. I didn't have to do that myself.) And I have done exactly that same thing with Java, using java.util.concurrent.
Twisted also does that, to a degree. But there are limits to the scalability of threads in CPython, owing to the GIL. A better solution (one Guido, himself, often recommends, when stating that he refuses to remove the GIL) is to use a process pool, not a thread pool. See the comment by Jean-Paul Calderone, above, for instance.
Yeah, normally I have a small process pool and within each process is a thread pool, usually works out well.
Do I take it that the interpretation is 50% of the queries were delivered in 1ms or less (in TOTAL)... or each of those requests (in the 50%) were delivered in 1ms ? AB always gets me with its terminology.. :)
AB's docs suck. I could not find any documentation telling me how to interpret the percentage stats, and I did not have time to dig through AB's source code to figure it out. I think the second interpretation ("each of the requests in the 50% were delivered in 1ms or less") makes more sense, though, given the data.
As for running it again here, I ran it a number of times, after getting those weird results the first time for the SocketServer implementation. Each time I ran the test, the stats were pretty much the same. I haven't had time to dig into it further--especially since I have no intention of actually using a SocketServer implementation at work. I included it mostly for comparison.
Possibly of interest :
http://jessenoller.com/code/pycon_jnoller_multi...
http://code.google.com/p/unladen-swallow/wiki/P...
http://us.pycon.org/2009/conference/schedule/ev...
fapws3 : 5886.33 / 8.494 / 8 / 9 / 11 / 13
Scala : 5467.53 / 9.145 / 9 / 11 / 12 / 20
SocketServer : 3354.10 / 14.907 / 15 / 15 / 16 / 20
That was done on Ubuntu 9.04 with Python 2.6, Scala 2.7.3 and Java 1.6.0_13 and an Intel Core 2 Duo 1.86 GHz.
[1] http://docs.python.org/library/socketserver.htm...