
2
Contents
MongoDB Performance Tuning 3
Essential techniques 4
• Ten Recommendations for Running Your MongoDB Environment ���������������������������������������������������������������������������������������������� 5
Indexing 14
• MongoDB Indexes Explained ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������15
• The Pros and Cons of Wildcard Indexes on MongoDB ����������������������������������������������������������������������������������������������������������������������������� 27
Conguration 33
• 5 Conguration Options That Impact Performance and How to Set Them �����������������������������������������������������������������������34
• MongoDB Best Practices: Security, Data Modeling, & Schema Design ������������������������������������������������������������������������������������40
• Tuning MongoDB for Bulk Workloads ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������51
Query optimization 55
• MongoDB Queries Slow Due to Flow Control but No Replication Lag? ������������������������������������������������������������������������������������ 56
Data partitioning 60
• Dealing With Chunks That “Lost Weight” in MongoDB ��������������������������������������������������������������������������������������������������������������������������������61
• Merging Empty Chunks in MongoDB ������������������������������������������������������������������������������������������������������������������������������������������������������������������������� 64
• Rening Shard Keys in MongoDB 4.4 and Above ������������������������������������������������������������������������������������������������������������������������������������������ 68
Memory/resource allocation 78
• How to Tune Your MongoDB Conguration After Upgrading to More Memory ���������������������������������������������������������������79
Conclusion 85
评论