Performance comparison of mongodb, mysql and redis
Recently, because of the need of work, I have studied mongodb, but I don't know how its real performance is, so I have done some tests compared with mysql. Now I just insert the operation, and I haven't had time to get the update. Post it and share it with you (I have made up the redis part).
1. Database version (find your own place to download, it is not available here, at the same time, for convenience, use the Windows version)
Mongodb:mongodb-win32-i386-1.6.5-rc1
Mysql:mysql-noinstall-5.1.22-rc-win32
Redis:redis-2.0.2
two。 Machine model
Ibm notebook with 2g memory, memory, CPU, T7500, core 2, 2.20GHz, operating system is 32-bit, win7 system
3. Test result
When the number of threads is 10, 10, 20, 50, 100, 200, 500, 800, 1000, 1500, 2000, the insertion performance of mongodb is basically twice that of mysql. Attention, it is only twice, not an order of magnitude, so the insertion performance of mongodb is not very ideal. At the same time, the insertion performance of mysql is similar to that of redis. It seems that redis is not as good as tens of thousands per second as advertised. Of course, it may be that my machine is not good, hehe.
4. Attachment
The attachment includes the source code, as well as the test results (organized into excel)
Efficiency test of three kinds of DB. Rar (14.17 KB, download times: 262)
MongoDBTest.rar (1.27 MB, downloads: 413)