1.

When should data for a sharded cluster be pre-split?

Answer»

Concurrency in MongoDB is different for different storage engines. While WiredTiger uses document level concurrency control for write operations, MMAPV1 has concurrency at the collection level.

In WiredTiger locking is at document level due to which multiple clients can MODIFY documents at the same TIME and so uses optimistic concurrency control for most read and writes. Instead of exclusive locks, it uses only intent locks at the global, database and collection levels. In case the conflict is detected by storage engine between operations, one will incur a write conflict causing MongoDB to transparently retry that operation. 

SOMETIMES global “instance-wide” locks are required for global operations which involve multiple databases. Exclusive database lock incurs for operations such as DROPPING a collection.

MMAPv1 still uses collection level lock meaning if we have 3 applications running against the same collection, 2 would have to wait before FIRST application completes its own as it applies a collection level write lock.



Discussion

No Comment Found