System Collections (page 291) Introduces the internal collections that MongoDB uses to track per-database metadata, including indexes, collections, and authentication credentials. 

Database Profiler Output (page 292) Describes the data collected by MongoDB’s operation profiler, which intro- spects operations and reports data for analysis on performance and behavior. 

Server Status Output (page 296) Provides an example and a high level overview of the output of the serverStatus command. 

Journaling Mechanics (page 308) Describes the internal operation of MongoDB’s journaling facility and outlines how the journal allows MongoDB to provide provides durability and crash resiliency. 

Exit Codes and Statuses (page 310) Lists the unique codes returned by mongos and mongod processes upon exit. 

## 5.3.1 UNIX ulimit Settings 

Most UNIX-like operating systems, including Linux and OS X, provide ways to limit and control the usage of system resources such as threads, files, and network connections on a per-process and per-user basis. These “ulimits” prevent single users from using too many system resources. Sometimes, these limits have low default values that can cause a number of issues in the course of normal MongoDB operation. 

Note: Red Hat Enterprise Linux and CentOS 6 place a max process limitation of 1024 which overrides ulimit set- tings. Create a file named /etc/security/limits.d/99-mongodb-nproc.conf with new soft nproc and hard nproc values to increase the process limit. See /etc/security/limits.d/90-nproc.conf file as an example. 

## Resource Utilization 

mongod and mongos each use threads and file descriptors to track connections and manage internal operations. This section outlines the general resource utilization patterns for MongoDB. Use these figures in combination with the actual information about your deployment and its use to determine ideal ulimit settings. 

Generally, all mongod and mongos instances: 

• track each incoming connection with a file descriptor and a thread. 

• track each internal thread or pthread as a system process. 

## mongod 

• 1 file descriptor for each data file in use by the mongod instance. 

• 1 file descriptor for each journal file used by the mongod instance when storage.journal.enabled is true . 

• In replica sets, each mongod maintains a connection to all other members of the set. 

mongod uses background threads for a number of internal processes, including TTL collections (page 211), replica- tion, and replica set health checks, which may require a small number of additional resources. 

## mongos 

In addition to the threads and file descriptors for client connections, mongos must maintain connects to all config servers and all shards, which includes all members of all replica sets. 

For mongos , consider the following behaviors: 

