Seeing 90% memory usage and starting to panic? Hold on — MongoDB is designed to use up every bit of memory it can get its hands on. This post is about telling "normal" apart from "actually a problem," and exactly where to start looking once memory really is running out.
MongoDB's storage engine, WiredTiger, deliberately carves out a large chunk of memory for its own cache — roughly half of (system RAM − 1GB) by default — to hold hot data, indexes, and in-flight operations. That's not a leak, it's the design: idle memory is wasted memory. So before concluding "there's a memory problem," the first job is telling apart whether the cache is doing its job properly, or whether something is actually growing out of control.
MongoDB can answer "where did the memory go" on its own, no extra tooling required.
Three fields matter most: bytes currently in the cache (current usage), maximum bytes configured (the configured ceiling), and pages evicted by application threads (evictions forced directly by app threads — a sudden jump here usually means the working set no longer fits in cache).
It crowds out the OS's own filesystem cache — especially easy to miss in containerized / cgroup-limited environments, where MongoDB may still size its cache off the host's total memory instead of what the container actually has available.
Every connection carries a fixed memory overhead. A poorly sized connection pool, or clients that disconnect abnormally without releasing their connection, multiplies that cost quickly.
An in-memory sort over 32MB gets rejected unless disk spill is explicitly allowed; aggregation stages like $group and $lookup can also accumulate large intermediate results in memory.
A single document that's too large, or one with an array field that keeps getting appended to, can inflate the working set far beyond what you'd expect.
Cache hit rate, memory usage, connection count — these are all metrics WAP tracks continuously. Rather than digging through logs after an OOM kill, it's better to catch these curves climbing abnormally before it happens.
Looking back at most memory incidents, there's almost always a clean, climbing curve you could have seen coming — nobody was just watching it at the time. Continuously tracking these metrics is something Whaleal Platform does every single day.