- Administration >
- Production Checklist >
- Development
Development¶
On this page
The following checklist, along with the Operations Checklist, provides recommendations to help you avoid issues in your production MongoDB deployment.
Data Durability¶
- Ensure that your replica set includes at least three data-bearing nodes with w:majority write concern. Three data-bearing nodes are required for replica-set wide data durability.
- Ensure that all instances use journaling.
Schema Design¶
- Ensure that your schema design does not rely on indexed arrays that grow in length without bound. Typically, best performance can be achieved when such indexed arrays have fewer than 1000 elements.
Replication¶
- Do not use secondary reads to scale overall read throughput. See: Can I use more replica nodes to scale for an overview of read scaling. For information about secondary reads, see: Read Preference.
Sharding¶
- Ensure that your shard key distributes the load evenly on your shards. See: Considerations for Selecting Shard Keys for more information.
- Use targeted queries for workloads that need to scale with the number of shards.
- Always read from primary nodes for non-targeted queries that may be sensitive to stale or orphaned data.
- Pre-split and manually balance chunks when inserting large data sets into a new non-hashed sharded collection. Pre-splitting and manually balancing enables the insert load to be distributed among the shards, increasing performance for the initial load.
Drivers¶
- Make use of connection pooling. Most MongoDB drivers support connection pooling. Adjust the connection pool size to suit your use case, beginning at 110-115% of the typical number of concurrent database requests.
- Ensure that your applications handle transient write and read errors during replica set elections.
- Ensure that your applications handle failed requests and retry them if applicable. Drivers do not automatically retry failed requests.
- Use exponential backoff logic for database request retries.
- Use cursor.maxTimeMS() for reads and wtimeout for writes if you need to cap execution time for database operations.
Thank you for your feedback!
We're sorry! You can Report a Problem to help us improve this page.