This article translates MongoDBProductionNotes in MongoDBManuel. This section focuses on considerations that affect performance and reliability in the production environment,
This article is to translate the MongoDB Production Notes section in MongoDB Manuel. This section focuses on considerations that affect performance and reliability in the production environment,
This article is to translate the MongoDB Production Notes section in MongoDB Manuel. This section focuses on considerations that affect performance and reliability in the production environment, and deserves the attention of those who are deploying MongoDB. This article describes in detail the key system configurations that affect MongoDB, especially the production environment. The following is the text.
Installation Package
Make sure that you have installed the latest stable version. This is the best place to learn about the latest version, even if you choose to install it from the package manager later.
The production environment always uses the 64-bit version. The 32-bit version is designed for testing and deployment environments and is not suitable for production environment deployment because it can only store data of less than 2 GB. For more information, see 32-bit limits.
The 32-bit version is applicable to informal environments.
Operating System
The MongoDB release is currently applicable to the Max OS X, Linux, Windows Server 2008 R2 64-bit, Windows 7 (32-bit and 64-bit), Windows Vista, and Solaris platforms.
NOTE: If possible, MongoDB uses the gnu c library (glibc ). MongoDB requires a version at least in the glibc-2.12-1.2.el6 to avoid a known Bug in earlier versions. For the best results, use at least version 2.13.
Concurrency
All write operations in earlier versions of MongoDB use the only read/write lock in the instance. Starting from 2.2, each database has an independent read/write lock, which allows a database to read concurrently, and each database has an independent write control. View the concurrency page for more information.
Logs
MongoDB uses the method of writing logs to disks in advance to ensure that MongoDB can quickly recover write operations from crashes or other serious errors.
To ensure that mongod can recover from the crash and continue to be available, you should enable the log. View the log page to learn more.
Network
Use a trusted network environment
Always run MongoDB in a trusted environment and enable network policies to prohibit access to unknown machines, systems, and networks. Like any sensitive system that relies on network access, your MongoDB environment should be designated for system development that requires access, such as application servers, monitoring services, and other MongoDB components.
Note: The authentication function is disabled by default. mongod assumes that you are in a trusted environment. Enable the Security Authentication mode if necessary.
For more information, see the Security Section. In particular:
● Configuration options
● Firewall
● Configure Linux iptables firewall for MongoDB
● Configure Windows netsh firewall for MongoDB
For Windows users, consider the content in the Windows Server TCP Technical article when deploying MongoDB on Windows.
Connection Pool
To prevent a single mongod or mongos instance from loading resources, ensure that the client maintains a reasonable number of connection pool configurations.
The connPoolStats database command can return information about the connection of the current database in the mongos and mongod instances in a sharded cluster.
Hardware considerations
MongoDB is designed based on compatibility with most hardware and has almost no special requirements or restrictions. The core components of MongoDB can run on the hardware with the smallest byte priority, mainly x86/x86_64 processors. Client-side class libraries (such as drivers) can run on large-end or small-end priority systems.
Hardware requirements and restrictions
The hardware that enables MongoDB to run most efficiently should include the following features:
Allocated enough memory and CPU
As with all software, more memory and faster CPU clock frequencies are important to performance.
Basically, the database is not limited by the CPU. Therefore, although increasing the number of cores is helpful, it does not provide a significant return.
SSD)
MongoDB uses sata ssd for good results and cost effectiveness.
Use SSD if the cost is sufficient. Traditional hard disks may also be very efficient, But SSD's good support for random I/O access is more in line with the mongod data update model.
Traditional hard disks are also a good choice, because the use of more expensive hard disks to improve random I/O performance is not so effective (only twice each time ). Using SSD or increasing RAM capacity may improve IO efficiency.
Avoid using remote file systems
The remote file storage system may cause performance problems for MongoDB. View Remote File Systems