Database Reference
In-Depth Information
Understanding scaling
When you are using MongoDB in a production environment and under high throughput,
you may face a lack of server resources. Storing large datasets on a single machine can be
the biggest problem. In addition, responding to a lot of read/write requests from different
clients can be a concern because these kinds of processes are resource-consuming and can
exhaust the server's resources.
To address these problems, scale your database system to support more clients. Basically,
there are two ways to scale a system, vertical scaling and horizontal scaling .
In the vertical scaling approach, the system administrator will add more resources and ca-
pacities to an existing server. However, adding more capacity to an existing system has
some limitations, making this approach less useful. Adding more CPU cores or RAM capa-
city to a machine can be more expensive than setting up a new smaller machine. Mean-
while, some cloud-based service providers don't offer very large capacity machines so you
have to use smaller instances. On the other hand, using separate machines reduces the risk
of failure of a single instance.
On other hand, the horizontal scaling method increases the capacity of the entire server by
merging smaller instances together. For instance, in order to have an entire server with 4
GB of RAM, we need four different machines each with a 1 GB RAM capacity.
Despite the difficulty in maintaining independent machines, this approach costs less than
vertical scaling and protects the entire system from failure if a single server encounters a
hardware crash.
The following diagram shows the difference between vertical and horizontal scaling:
Search WWH ::




Custom Search