A couple of days ago, MemSQL, a new generation database from Nikita Shamgunov (
shamg ), spread through the global technology press, which allegedly shows a speed 30 times higher than MySQL and at the same time “reliable by default” them on the site.
MySQL representatives have not condescended to respond to these obvious marketing slogans. But a former MySQL employee, Domas Mituzas, now an expert on databases in Facebook and Wikipedia, still could not resist and
decided to figure out exactly how we were deceived - and answer the same, that is, to show examples where MemSQL works hundreds, thousands and even a million times slower than MySQL.
The main thesis about the "30-fold performance boost," as it turned out, was derived from the MySQL performance tests with default settings versus MemSQL with default settings. Here, cheating is already starting, because the systems have to work perfectly in different environments: for example, the memory buffer in MemSQL, in fact, is not limited by anything, and in InnoDB it is set to 128 MB in MySQL 5.5 (and this is 16 times more than in 5.1 ).
For benchmark entries, MemSQL is compared with 2 GB transaction logs and InnoDB with 10 MB logs.
')
At the same time, for any benchmarks, writes Domas Mituzas, reliability is important. While InnoDB really checks that transactions are saved to disk, “reliability by default” MemSQL means only that the record is logged in the transaction log, but in fact it does not guarantee that it will be saved to disk. The MemSQL transaction buffer works much like the mode
innodb_flush_log_at_trx_commit=2
. If you enable full transaction protection in MemSQL, it will be a
heartbreaking sight : the background process wakes up every 50 ms to record the transaction log.
So, what is the result? MemSQL runs 500 times slower in reliable transaction mode.
In read mode, MemSQL can scan 8 million rows per second for a
SELECT COUNT(*)
query, which is a great result. But here's the query:
SELECT * FROM table ORDER BY id DESC LIMIT 5;
Such a request is found everywhere, it shows the tops of different lists. MySQL performs it, normally moving through the index from record to record, while MemSQL is forced to grind the entire table and sort it again to execute the query. Even a
SELECT MAX(id)
query leads to the entire table being traversed.
So, MemSQL is a thousand times slower than MySQL, or a million times slower. On simple read requests.
In general, Domas Mituzas concludes that MemSQL is an excellent development and the fastest MySQL protocol that exists, for some tasks, but it is not so much ahead of MySQL Cluster, and the developers of NDB Cluster also claim very high performance. However, MemSQL needs proper optimization for more typical usage patterns.