1. The Inherent Scaling Dilemma of BSON and WiredTiger
MongoDB's rise to dominance was powered by developer ergonomics. Storing application entities as natural, nested JSON/BSON documents eliminated the friction of object-relational mapping (ORM) impedance mismatch. However, the storage architecture underneath—the WiredTiger storage engine—was designed around a row-and-document oriented block paradigm.
In WiredTiger, every document is stored as a contiguous binary sequence of BSON keys and values. This design introduces three critical challenges at scale:
- Extreme Disk Overhead from Repeated Keys: Unlike relational databases where column headers are stored once per table schema, every single BSON document embeds the field name strings (e.g.
"created_at","transaction_id","customer_profile") repeatedly. In a collection of 50 million documents, field names alone can consume tens of gigabytes of disk and RAM cache. - The Index Working Set Problem: Because WiredTiger stores documents as opaque blobs, it cannot filter or aggregate on a field without either scanning every byte of the collection from disk or building a dedicated B-Tree index. As collections grow, index sizes frequently exceed physical server RAM, triggering catastrophic disk thrashing and query latency spikes.
- The Analytical Bottleneck: When an aggregation pipeline (
$group,$unwind,$lookup) is executed, MongoDB's query executor must unpack and parse the BSON structure document-by-document in memory. For analytical queries spanning millions of records, CPU utilization spikes to 100%, often causing production timeout errors.