Horizontal scalability

Horizontal scalability

Handle larger workloads by adding nodes to your cluster

Being able to scale a distributed system is essential to reliably and efficiently meeting the increasing demands of users, workloads, and data. Scalability is central the design and maintenance of distributed systems. You need it to ensure systems can handle increasing workloads, provide high availability, optimize resource usage, adapt to changing requirements, and accommodate future growth.

Depending on your business, you may need to scale for a variety of reasons:

  • Growing user base. Your application becomes popular, users love your app, and the user base is expanding.
  • Seasonal traffic. Occasionally, you have to handle a lot more transactions per second than usual. Black Friday and Cyber Monday retail traffic, or streaming for special events like the Superbowl or World Cup, for example.
  • Growing datasets. For example, you have an IoT app or an audit database that keeps growing rapidly daily. These systems have to handle a high volume of writes regularly.
  • Changing business priorities. Scaling needs are often unpredictable. To take one example, retail priorities shifted radically when Covid entered the picture. With a database that can scale, you can pivot quickly when the business environment shifts.
  • New geographies. Your user base expands to new regions, and you need to add to your presence globally by adding more data centers in different continents.

Being able to scale seamlessly is as important as being able to scale. Scaling needs to be operationally simple and completely transparent to the applications. With YugabyteDB, you can start small and add nodes as needed. You can scale your data, reads, and writes without disrupting ongoing applications. As your needs grow, YugabyteDB automatically shards data and scales out. You can also scale up your cluster for short-term needs and then scale down after the need is over.

Ways to scale

There are 2 common ways to scale, namely vertical and horizontal. YugabyteDB supports both. In vertical scaling, you enhance the capabilities of your existing nodes by increasing CPU, memory, storage, and so on. With horizontal scaling, you add more nodes of the same type to your cluster. Horizontal scaling is the most common type of scaling in YugabyteDB. As YugabyteDB is distributed, scaling is operationally straightforward and performed without any service disruption.

To learn more about the pros and cons of the two types of scaling, see Horizontal vs vertical scaling.

How scaling works

To get a better idea of the effort and time you will need to scale your systems, it's helpful to understand a few basic concepts that describe how YugabyteDB scales. Let's go over them quickly.

Sharding

Data distribution is critical in scaling. In YugabyteDB, data is split (sharded) into tablets. A tablet is effectively a piece of a table and these tablets are placed on various nodes. The mapping of a row of a table to a tablet is deterministic and the system knows exactly which tablet holds a specific row.

To learn more about the different types of sharding, see Hash and range sharding. For an illustration of how tablets are split, see Tablet splitting.

Rebalancing

As your data grows, tablets are split and moved across the different nodes in the cluster to maintain an equal distribution of data across the nodes. This process is known as Rebalancing. Data is moved automatically, without any interruption in service.

For an illustration of how tablets are rebalanced, see Rebalancing.

Adding nodes

When more nodes are added, some tablets are automatically rebalanced to the new nodes, and the entire cluster can therefore handle more transactions and queries in parallel, thus increasing its capacity to handle larger workloads.

For an illustration of what happens when nodes are added to a cluster, see Adding nodes.

When to scale

To know when to scale, monitor metrics provided for CPU, memory, and disk space. Set up alerts on these metrics to give you ample time to plan and react.

For best results, keep steady state resource usage under 60%, and take strong action at 75%, in particular for disk space. If CPU or memory is high, the system will slow; if disk usage approaches limits, usage on followers also increases, and moving and recovering data takes time.

YugabyteDB Anywhere and YugabyteDB Managed both include metrics dashboards and configurable alerts to keep you notified of changes.

To learn more about the various metrics than you can monitor, see Observability.

Learn more