Performance benchmark Mysql vs. MongoDB vs. Memcached.

Date: October 31, 2012 Published by

This benchmarks are tested with an algorithm based on a matrix multiplication where the result is stored in a table. The machines used are: 6 AMD 3.2Ghz processors or 54 cores total. The centralized DB server has 12 AMD cores and 64GB of RAM.

Loading performance is important because loading data takes up a lot of time for many data-driven applications. For some applications, loading could mean take the data from the text file and store it in the disk. For other applications, it could mean to take the data from the disk and load it into memory. For people who might need to process a TB of data or more, storing it in disk using NoSQL for unstructured data and traditional SQL for structured data is maybe sufficient.

For data that is smaller, storing it in memory using Memcached is probably sufficient, assuming that the data is also stored in a text file. Using Memcached, one can easily edit and re-run an algorithm without having to reprocess and reload the data from the text file. How fast is storing the data in Memcached compare to MySQL and MongoDB?

Surprisingly,  MongoDB is much faster than MySQL when inserting 2^14 records. How much faster? About 14 and 7 times faster compare to MySQL and Memcached respectively. One might ask how is it possible that MongoDB is faster than Memcached? When inserting data into Memcached, the least recently used algorithm updates the count to select a victim for deletion once the cache reaches the memory limit.

To sum up, this benchmark demonstrates that in terms of loading data MongoDB is the fastest up to 14 times compared to MySql. Nevertheless, there is a cost on that speed and it is related to the ACID principle. NoSql databases don’t guarantee (Atomicity, Consistency, Isolation, Durability). Therefore you might ask yourself which database is better. The answer is one of the usual answers it computing. It depends on the application that you are building.

Source :