Mongodb,redis,mysql Brief comparison

Source: Internet
Author: User

Most of the content of this article is not original, reproduced will be affixed with links.

Prepare to learn the database, to the current mainstream database to do a simple understanding of the analysis, the collection of data collated to a piece.

The current mainstream is to count NoSQL databases, with powerful high concurrency capabilities.

Mongodb:

It's an in-memory database, and the data is in memory.

The operation of the data is mostly in memory, but MongoDB is not a pure memory database.

Persistence mode:

All of MongoDB's data is actually stored on the hard disk, and all the data to be manipulated is mapped to an area of memory in a mmap way.

MongoDB then modifies the data in this area to avoid fragmented hard disk operations.

As for the contents of mmap flush to the hard disk is the operating system, so if, MongoDB in memory after modifying the data, MMAP data flush to the hard disk before the system down, the data will be lost.

Mmap Detailed Links: http://www.cnblogs.com/techdoc/archive/2010/12/22/1913521.html

Redis

It is a no-no memory database.

Persistence mode:

All Redis data is in memory and persisted using an RDB or AoF method.

Decrypt Redis Persistence: http://blog.nosqlfan.com/html/3813.html

Mysql:

Both the data and the index are stored on the hard disk. To be swapped into memory when it is to be used. Ability to handle data that is far more than the total amount of memory.

data volume and performance:When the physical memory is sufficient, the Redis>mongodb>mysqlboth Redis and MongoDB use virtual memory when physical memory is not enough. in fact, if Redis is going to start virtual memory, it's obviously either adding a memory bar, or you're changing the database. However, MongoDB is not the same, as long as the business can guarantee that the hot and cold data read and write ratio, so that the thermal data in physical memory, mmap exchange less. MongoDB is still capable of guaranteeing performance. Someone uses MongoDB to store data on the upper T. Mysql,mysql doesn't have to worry about the amount of data that is in memory. However, the amount of memory that is related to thermal data can greatly affect performance. when the physical memory and virtual memory are not enough, it is estimated that you have no choice but MySQL. In fact, from the data storage principle, I prefer to classify MongoDB as a hard disk database, but the use of mmap as a means of acceleration. Jane said Mmap:mmap system calls are not designed entirely for shared memory. It itself provides a different way of accessing ordinary files than normal, and processes can manipulate ordinary files like read-write memory. mmap system calls enable shared memory between processes by mapping the same common file. After the normal file is mapped to the process address space, the process can access the file like normal memory without having to call it again. Read (), write (), and so on. Mmap does not allocate space, it simply maps the file to the address space of the calling process, and then you can write the file with memcpy and so on, instead of writing (). After writing, use Msync () to sync, and the content you write is saved to the file. However, there is no way to increase the length of the file because the length of the map is determined when the mmap () is called. Here's a comparison of Redis and MongoDB:

Mongodb,redis,mysql Brief comparison

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.