|
|
|
|
|
by willbmoss
5197 days ago
|
|
I added an implementation [1] in diesel [2][3], which uses select.epoll (or libev, on non-Linux systems) and got a around 150x speedup [4]. I only repeated the tests a few times (but they were all close) and didn't install the Go compiler so I could test against Go (I'd be interested to see how this stacks up on your machine). Like you say in your post, it's nice to have something wrap up the bother of epoll for you. [1] https://github.com/wmoss/Key-Value-Polyglot [2] diesel.io [3] https://github.com/jamwt/diesel [4] The first run is against the diesel one wmoss@wmoss-mba:~/etc/Key-Value-Polyglot$ time python test.py real 0m0.134s user 0m0.040s sys 0m0.020s wmoss@wmoss-mba:~/etc/Key-Value-Polyglot$ time python test.py real 0m20.164s user 0m0.096s sys 0m0.072s |
|
Here's what I don't understand:
* test.py is sequential: It first does 500 sets then 500 gets, all in one thread, using a single connection to the server.
* The socket handling function (memg.py:handle_con/memg-diesel.py:handle_con) is called once. There is no parallell execution going on.
* So why is the memg-diesel.py code so much faster? What makes the code for sending and receiving data to/from the socket so much faster?
Could someone please explain to me why an epoll-based solution is so much faster?