Professional Documents
Culture Documents
Internals
Hey, I am Uddeshya 👋
SDE-2 @ GTF (GoTo Finance), OSS Enthusiast, Occasional database
tinkerer, Manchester United Masochist
Twt - @uds5501
Github - @uds5501
Email - singhuddeshyaofficial@gmail.com
Agenda (Broadly)
● An endorsement of MongoDB
○ Choice of databases is very subjective, choose yours as per
your use case.
● An exhaustive walkthrough of MongoDB features.
● A guide on mongoDB best practices.
MongoDB
Famous NoSQL database with highly flexible data modelling support
● Supports Transactions.
● Loosely supports ACID properties.
● Supports sharding and fault tolerance.
● Amazing database for side projects [personal opinion]
General
databases?
WiredTiger Storage Engine
The Good
● Default mongoDB on-disk storage engine since MongoDB 3.2
● Document level concurrency.
● Snapshot and Checkpoint durability.
● Supports Journaling.
● Supports on-disk compression algorithms.
● Good ol' plug and play.
WiredTiger Storage Engine
The Bad
● Can't pin documents in cache.
● No separation for reads and writes in cache.
● It doesn't allocate cache on a per-database or per-collection level.
Architecture Overview
Act - 1
Gateways to engine
APIs
Act - 2
The building blocks
Schema
● Block manager:
○ Skip lists usage
○ When to use first fit vs best fit.
● Eviction process:
○ Early exits from cache walks when using eviction threads.
○ Keeping a small thread pool for eviction.
○ Not interrupting application threads' transaction duties.
○ Prioritizing cache eviction only when in dire state.
Arigato!