Performance test comparison between MongoDB and MySQL
Today, through an experiment, we compared the performance of MongoDB and MySQL. Note that this comparison only reflects the situation in our application scenario, and does not represent the general situation. We want to store some historical video traffic, which needs to be stored for one year, and the daily active videos are on the order of millions, and the traffic can be represented by an integer. In our application, write performance is a priority factor, so the first step of the experiment mainly compares the write performance. Since the stored data is exclusively shared by a single application (process), sqlite also meets our application scenarios. So we also tested the write performance of sqlite. Experimental environment: Single server RHEL 5.5 64bit, dual-core Intel(R) Xeon(R) CPU 5130 @ 2.00GHz CPU, 8G memory, local disk. Test program (python): MySQL: MySQLdb Sqlite: pysqlite2 MongoDB: pymongo DB Schema: 1. MySQL (InnoDB) & Sqlite: CREATE TABLE `inventory` ( `date` DATE NOT NULL, `id` INT(11) NOT NULL, `views` INT(11) NOT NULL, PRIMARY KEY (`date`, `id`)); 2. MongoDB index inventory.create_index([(‘date’,ASCENDING), (‘id’,ASCENDING)], unique=True, dropDups=True) Test method: In our application scenario, today’s traffic on any item will be randomly inserted or updated. Therefore, we test insert and update…