MySQL as a KVS vs. MongoDB: MySQL Beats Mongo by 62K Rows/Sec.
The first 8 articles:
http://architects.dzone.com/articles/simple-comparison-kvss
http://java.dzone.com/articles/some-corrections-and-additions
http://java.dzone.com/articles/mysql-key-value-store-kvs-some
http://java.dzone.com/articles/mysql-key-value-store-kvs-some
http://java.dzone.com/articles/mysql-cluster-ndb-key-value
http://java.dzone.com/articles/mysql-cluster-performance
A few days ago, I wrote a bit
on my first results of comparing MySQL with MongoDB as a Key-Value
Store, something that has been going on for way to long, but I am not
finished yet. The last time I used MySQL Embedded Library to bypass the
MySQL Client Server protocol to see what the overhead was, and the
result was that it is big (and again, note that the same networking was
used with MongoDB and I was also using Unix Domain Sockets, as well as
plain TCP/IP, so don't ask me to fix any network issues I might have).
Using Embedded Server with InnoDB was actually faster than using
MongoDB, some 3 times faster compared to using the client / server
protocol.
That one out of the way, I now wanted to see what I could get if I used
the storage engine that was fastest in Client / Server mode, MEMORY.
That took a while to fix, as to have an Embedded Server application,
like my test application here, use the MEMORY engine, I have to load the
data into the MEMORY table somehow each time I run the application. No
big deal but a slight update to my benchmarking application was needed,
as well as some debugging as embedded server is pretty picky with you
doing things the right way and in exactly the right order, and is much
less forgiving than the MySQL Client library. Anyway, I now have it
fixed, and the result. Fast. Real fast and furious: 172 k rows read per second!
Compared to 110k rows read per second with MongoDB (but that is MongoDB
in Client Server mode of course). Using the MySQL Client, the MEMORY
engine achieved 43 k row reads per second, which means that libmysqld is
400% faster! How is that for a performance improvement.
Which is not to say that we all should start building libmysqld
applications right now. But what I want to say is that if you want to
improve the performance of MySQL, looking into the Client / Server
protocol would be a good starting point, there is a lot of performance
to get there. The results noted could be interpreted as at least 75% of
the time that MySQL processes a query, excluding disk I/O (this is the
MEMORY engine after all), is spent in the Client / Server protocol. And
looking at it differently: A key value store such as MongoDB might not
be as fast as we think, but MongoDB sure does have a more efficient C/S
protocol!
/Karlsson
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)






Comments
Andrei Sfat replied on Wed, 2012/08/29 - 6:44am
Interesting article. I did myself some performance tests on MySQL and some NoSQL dbs (MongoDB, HBase, Neo4j) and I want to know details about this test. What I mean by this is:
- Configuration of the machine on which the tests were made
- What data is being stored in the db (the model that you are using, possibly specifying how big is one row which is inserted in Kb)
- Did you do only read operations or insert operations?
- What was the whole amount of data you were doing your tests on? 100k? 1mil? 10, maybe?
ThanksBrice Laurencin replied on Wed, 2012/08/29 - 10:32am
Will Soprano replied on Wed, 2012/08/29 - 12:09pm
Hey Brice,
Would you like to take this test and test it against Redis?? email me: williams@dzone.com
Octavian Covalschi replied on Wed, 2012/08/29 - 3:02pm