Database / Mnesia intermediate to advanced Interview questions
Why does fragmentation help Mnesia scale beyond what one table replica set can handle?
A normal, fully-replicated Mnesia table means every node holding a copy stores (and, for
disc_copies, durably persists) the entire dataset, and every write must be coordinated and applied
across all of those full copies via two-phase commit. Both the storage requirement and the write coordination
cost scale with the whole table's size, no matter how many nodes you add.
Fragmentation breaks that link: each fragment is its own independently replicated unit, so a write to one key only needs to coordinate with the (smaller) set of nodes replicating that fragment, not the whole logical table. Storage is spread across fragments too, so the effective dataset size the system can hold grows with the number of fragments (and nodes) rather than being capped by what any single node/replica-set can store or coordinate writes across.
More Related questions...