MongoDB common optimization settings in Linux

Source: Internet
Author: User
Tags install mongodb mongodb server
Below are some common optimization settings recommended by MongoDB. Selecting an appropriate parameter value in the production environment, such as the pre-read value and the number of default file descriptors, will greatly improve the system performance.

Below are some common optimization settings recommended by MongoDB. Selecting an appropriate parameter value in the production environment, such as the pre-read value and the number of default file descriptors, will greatly improve the system performance.

Below are some common optimization settings recommended by MongoDB. Selecting an appropriate parameter value in the production environment, such as the preread value and the number of default file descriptors, will have a great impact on the system.

** Disable atime of database files

Disabling the system to update the file access time effectively improves the file reading performance. You can add the noatime parameter to the/etc/fstab file. For example:

/Dev/xvdb/data ext4 noatime 0 0

After modifying the file, you can mount it again:

# Mount-o remount/data

** Increase the limit on the number of default file descriptors and processes/threads

The default file descriptor and maximum process count in Linux are usually too low for MongoDB. We recommend that you set this value to 64000. Because the MongoDB server uses a file descriptor for each database file and each client connection. If this number is too small, it may cause errors or fail to respond in the case of large-scale concurrent operations. You can use the following command to modify these values:

Ulimit-n 64000
Ulimit-u 64000

** Disable NUMA

In a multi-processor Linux System Using NUMA technology, you should disable NUMA. MongoDB running performance in the NUMA environment may sometimes slow down, especially when the process load is very high.

** Readahead settings

The pre-read value is an optimization method of the file operating system. When a program requests to read a page, the file system will read the following pages at the same time and return them. This is because I/O is the most time-consuming disk seek. Through pre-reading, the system can return the followed data at the same time in advance. If the program is performing a continuous read operation, this can save a lot of disk seek time.

MongoDB usually performs random access. For random access, this pre-read value should be set to a smaller value. Generally, 32 is a good choice.

You can use the following command to display the pre-read value of the current system:

Sudo blockdev-report

To change the pre-read value, run the following command:

Sudo blockdev-setra 32

SetReplace it with a suitable storage device.

** Use NTP Time Server

When using the MongoDB replica set or sharded cluster, be sure to use the NTP time server. This ensures correct synchronization between MongoDB clusters.

MongoDB 3.0 official version released and downloaded

CentOS compilation and installation of MongoDB

CentOS compilation and installation of php extensions for MongoDB and mongoDB

CentOS 6 install MongoDB and server configuration using yum

Install MongoDB2.4.3 in Ubuntu 13.04

MongoDB beginners must read (both concepts and practices)

MongoDB Installation Guide for Ubunu 14.04

MongoDB authoritative Guide (The Definitive Guide) in English [PDF]

Nagios monitoring MongoDB sharded cluster service practice

Build MongoDB Service Based on CentOS 6.5 Operating System

MongoDB details: click here
MongoDB: click here

This article permanently updates the link address:

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.