Thursday, November 10, 2011

To SQL or NoSQL to...

I'm pretty fond of MySQL and I really think that paired with MySQLWorkbench it provides an unbeatable solution for your regular web development needs.
But it's hard to ignore the NoSQL crowd with their stories of sheer heroic victories over latency in deploying and scaling complex online applications. Like only yesterday I was going over this presentation of Jesper Richter Reichhelm of Wooga in which he explained how they got to 1 mil. daily users without cache. With R/W to the database. It's true that they use Redis for the high octane stuff and MySQL for the rest but still it wouldn't work without NoSQL. Much virtual ink has flown since the rise of NoSQL and here is a particularly concise piece from Kristóf Kovács on the various solutions available with their pros and cons.
But now here's Yoshinori Matsunobu of DeNA, ex. MySQL consultant coming up and claiming 750.000 qps on a commodity server using ONLY MySQL. In his investigations of MySQL vs memcached his basic conclusion is that most of the time is consumed in SQL by concurrency controls. In order to circumvent this while still using InnoDB Akira Higuchi wrote the HandlerSocket Plugin:
"HandlerSocket is a MySQL daemon plugin so that applications can use MySQL like NoSQL. The biggest purpose of the HandlerSocket is that it talks with storage engines like InnoDB without SQL-related overheads. To access MySQL tables, of course HandlerSocket needs to open/close tables. But HandlerSocket does not open/close tables every time. It keeps tables opened for reuse. Opening/closing tables is very costly and causes serious mutex contentions so it's very helpful to improve performance. Of course HandlerSocket closes tables when traffics become small etc so that it won't block administrative commands (DDL) forever."
Neat!
It looks that it's almost 2x as fast as using memcached with less CPU usage. And you get to keep all the benefits of InnoDB.
Also fresh from Oracle there is the new preview release of the memcached daemon plugin which implements memcached as a MySQL plugin daemon. This has the memcached and mysql in the same process thus having very low latency and does direct access to InnoDB bypassing the SQL parser. It looks very promising!

Still I'm not saying that you should forget about NoSQL. On the contrary!
I strongly believe that as a developer you should keep all these solutions at hand. It's good to have so many options and so much shared knowledge available and it only makes it more easy to be able to provide your clients with the optimal solutions to their problems.
\m/
Rock on!

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home