MongoDB is a database based on distributed file storage. Written by the C + + language. Designed to provide scalable, high-performance data storage solutions for Web applications.
MongoDB is a product between relational database and non relational database, and is the most powerful and relational database in the relational database. The data structure he supports is very loose and is a JSON-like Bson format, so you can store more complex data types. The biggest feature of MONGO is that the query language he supports is very powerful, and its syntax is somewhat similar to an object-oriented query language, which can almost achieve most of the functions of a single table query like relational database, and also supports indexing of data.
PS First Look.
A total of more than 760G of virtual memory, but the physical memory is only 12.6G. This machine has 64G of memory, which looks like MongoDB completely useless memory.
And look at the results of free.Copy Code code as follows:
Memory is about the same, basically are cached, that is, file system caching. MongoDB is the mmap way for the operating system to handle persistence and caching. Each data file is mapped directly to a virtual memory address. If this page is not in memory during the visit, the system will try to load the page in. These memory are counted into the cache. In the official document of MongoDB, it is said that the rsize segment in top or PS shows the total memory size of the machine, as the MongoDB consumes as much memory as possible. But in fact, these caches are not counted. Therefore, in the top or PS can not see the actual memory usage of MongoDB. While free can see the memory usage of the system, it is impossible to determine how much of this memory is really MongoDB used.
Fortunately someone has done vmtouch this tool. You can check the file's status in the cache, or you can load the file directly into the cache or kick it out. Just check the cache load on all MongoDB data files to see how much data the MongoDB is caching.Copy Code code as follows:
Here-m4g is the Vmtouch check file size limit. MongoDB data files are larger and typically exceed the default 500M. So it looks like the cache is 58G, and that's pretty much it. The number on the left of resident pages is the number of pages, and the number of pages multiplied by the file system page size is memory usage. The size of the page can be passedCopy Code code as follows:
View, usually 4096, which is 4KB.
When MongoDB is running on a NUMA machine and memory is pinned to a node, there is a warningCopy Code code as follows:
Perhaps it is thought that in this case only the memory of the last node can be used. However, the MongoDB cache is managed by the operating system. NUMA does not seem to have any effect on this. And when memory is not too small, MongoDB itself is difficult to use the memory of a node. In this case, whether to open numactl–interleave=all effect is not much. Can do may only add memory, sharding, or change SSD.