On Monday, former Facebook developers Eric Frenkiel and Nikita Shamgunov launched a startup called MemSQL that aims to speed up relational databases using their experiences at our favorite social media company.
Taking a cue from Facebook who achieves such fast speeds on their close to 1 billion user PHP site by compiling their PHP into C++ with HipHop, MemSQL translates SQL code into C++, bypassing much of the need for an interpreter. Unlike MySQL, which stores data on the disk, MemSQL data is kept in memory where all of the operations such as reading, updating, and deleting take place. Disk writes happen in the background.
At first I was skeptical. While I do not doubt the Facebook team had some very clever individuals, and I know from schooling how fast C++ is, memsql.com‘s claim of being 30x faster than MySQL seemed a little exaggerated. Not so, as it turns out, as http://vimeo.com/44087431 shows us. MemSQL demonstrates the speed of their database in this Vimeo video by comparing MySQL vs MemSQL in a series of 15,000 operations. The MySQL section of the video is sped up 5x, and shows a rate of about 3.5 thousand queries per second. Sounds about right, in my experience. Then they execute the same operations in MemSQL. The series of operations finishes in less than two seconds, showing a rate of slightly more than 80 thousand queries per second.
The downside of MemSQL is the same as what makes it so fast, however. Storing the data in memory allows for lightning fast queries, but requires that you have a lot of memory if you have a massive database. Where MemSQL does support scaling across multiple machines, the cost of adding another server versus adding another hard drive would be too high for many smaller companies and startups.
MemSQL is compatible with MySQL in every way, your favorite flavor of database management software should be able to connect to it no problem. Or if you’re like me and write all your queries by hand, they are all the same too with no syntax differences. This was done intentionally to ease the strain of learning yet another new system in our ever more complicated corporate tech world.
MemSQL is still fresh on the market and probably nowhere near ready for enterprise level deployment, but it is definitely a project I would recommend keeping an eye on for database admins everywhere.