Re:In-memory key-value store in C, Go and Python
by codeape on Wednesday March 21, 2012 @05:01AM
(#3733621)
I lack knowledge on networking/event-based systems on a fundamental level.
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?
Re:In-memory key-value store in C, Go and Python
by chmike on Wednesday March 21, 2012 @07:47AM
(#3733910)
What is the difference between diesel and gevent ? Note that gevent 1.0 uses libev.
Re:In-memory key-value store in C, Go and Python
by willbmoss on Wednesday March 21, 2012 @12:33PM
(#3735137)
In a nutshell, gevent monkey patches the socket library, whereas diesel doesn't. This means that you can use any (previously) blocking libraries with gevent, whereas, in diesel you have to write them again. The upside of the rewriting is that it creates a more coherent (and opinionated) ecosystem.
[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