MongoDBExplainer
Diagnosing MongoDB Search Performance with Atlas Metrics
Summary
Elevated disk I/O, high search CPU, increasing query latency, or rising search max replication lag in MongoDB Atlas can stem from two distinct problems: index-size pressure, where the search index exceeds available memory, or resource contention, where search and database workloads compete for CPU and memory on co-located nodes. Scaling the database tier provides only temporary relief because it does not separate the two workloads. Dedicated search nodes run mongot on separate infrastructure, giving each workload its own memory budget, CPU capacity, and scaling lifecycle. Correct diagnosis requires comparing Search Page Fault, Search Process Memory, Search Index Size, Search Normalized Process CPU, and Search Process Throttling metrics together. If page faults persist after migration, the search tier may still be undersized or require index-mapping changes such as static mapping or vector quantization.
Context
MongoDB Atlas clusters running both mongot (search process) and mongod (database process) on the same nodes can experience elevated disk I/O, high search CPU, increasing query latency, or rising search max replication lag. Scaling the database tier provides only temporary relief because it does not separate search and operational workloads. The correct fix depends on whether the search index does not fit in available memory (index-size pressure) or the two workloads contend during traffic spikes (resource contention). Dedicated search nodes run mongot on separate infrastructure, providing workload isolation and allowing each tier to be sized independently.
Approach / What changed
Use Atlas metrics (Search Page Fault, Search Process Memory, Search Index Size, Search Normalized Process CPU, Normalized System CPU, Search Process Throttling, query latency, Search Max Replication Lag) to determine whether the bottleneck is index-size pressure (index larger than available memory) or resource contention (search and database competing for CPU/memory). If index-size pressure is the cause, size a larger Search tier with enough memory; if contention is the cause, deploy dedicated search nodes to give mongot separate CPU, memory, and disk resources. After migration, monitor the same metrics to confirm the fix and adjust tier size as needed.
Takeaways
Index-size pressure occurs when the search index is larger than the memory available to mongot, causing queries to page data from disk even when database activity is low; a larger Search tier with enough memory addresses this.
Resource contention occurs when the index fits in memory but search latency rises because database reads, writes, or replication compete for CPU; dedicated search nodes resolve this by giving mongot separate resources.
Search Max Replication Lag measures index staleness (how far behind mongot is in applying oplog changes) and is distinct from replica set replication lag; isolation removes CPU competition as a cause but does not reduce indexing work from write-heavy workloads.
FAQ
What does Search Max Replication Lag measure?
Search Max Replication Lag measures how far behind mongot is in applying changes from the mongod oplog to a search index. It is different from replica set replication lag, which measures how far secondary mongod members are behind the primary. Isolation removes CPU competition as a cause of this lag, but does not reduce the indexing work itself.
How do dedicated search nodes improve memory isolation?
Dedicated search nodes give mongot a separate memory budget; approximately 90% of search node RAM is available for index data. This prevents search queries from competing with WiredTiger and the OS for memory. If page faults remain high after migration, the search tier may still be undersized or the workload may have another bottleneck.
How does parallel segment search work on search nodes?
For $search queries, parallel segment search can search multiple Lucene segments concurrently when enabled with the query's concurrent option. For $vectorSearch queries, concurrent segment search is on by default on search nodes. The search tier's CPU count limits the parallelism available, and MongoDB Search may fall back to single-threaded execution when too many concurrent queries are queued.
Source and freshness
- Source
- mongodb.com
- Published
- Added to Yomu
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.