Sharded Services

Understand the sharded services pattern for distributed systems.

So far, we have seen how replicating the same service in multiple nodes can help scale our system. The gist of the idea is that each node will have the whole application hosted in it. As a result, each node can serve any request coming from any client.

In this lesson, we will learn about the sharded services pattern. In this pattern, replication is still there but in a more conditional format.

What is a shard?

We already discussed what a shard is during the discussion on data partitioning in distributed systems. We can define the term as follows.

A shard is a node that only serves a subset of the requests coming to a system.

The sharded services pattern

When we use sharded services, we have shards instead of multiple replicas of the system. Each shard serves a portion of the requests from the users.

The difference between replicated load-balanced services and sharded services is that in sharded services, each node can only serve a subset of requests, not all of them. In replicated load-balanced services, each node can serve any request coming to the system.

In the sharded services pattern, there is naturally a load balancer which is capable of balancing the load among the nodes. It decides which shard the request should reach.

An example

Get hands-on with 1200+ tech skills courses.