What does the term "scaling" mean in the context of MongoDB?
Scaling in the context of MongoDB is increasing a system's computing resources so it can handle more data and requests without a drop in performance.
In MongoDB the term covers two approaches:
1. Vertical scaling (scale-up)
Increasing the power of a single machine:
- more CPU
- more RAM
- faster disks
The upside: simple. The downside: there's a limit, you can't keep "beefing up the hardware" forever.
2. Horizontal scaling (scale-out)
Adding new servers to the cluster and distributing data/load across them:
- sharding, data is split across several nodes
- replication, read load is spread across secondary nodes
The upside: it can scale almost indefinitely. The downside: the infrastructure is more complex.
The key idea
MongoDB was built from the start to be easy to scale horizontally, unlike many SQL DBMSs.
Summary
Scaling in MongoDB is a set of ways to expand the system so it can handle larger volumes of data and requests. That can mean either strengthening a single server, or spreading the load across many machines.
Short Answer
Interview readyA concise answer to help you respond confidently on this topic during an interview.