When we talk about distributed systems we have to think about availability and load distribution all across our servers. While the replica pattern is important in this matter, to split our services in “shards” is something that can help us to maintain a good level of service for our users.
A use case for the shards pattern
Let’s suppose that we have a service with 3 big components or 3 big parts that compound it. Each component has a different usage load and its performance impacts differently to the app in general.
If we use replicas for this our service, we can improve the availability time but we still have the problem of specific workloads on each of the components mentioned before. If one of those components gets down because of high load, our application will potentially stop working.
Applying the shards pattern
We should keep in mind that the central idea of “shards” is to divide our application into components and make them as standalone as possible so that the entire application doesn’t depend on everything to stay up and running in the same place.
In the scenario proposed before, we could have 3 servers/containers. One for each big component of our application.
We can also set-up replicas for each server/container so that we ensure a high percentage of availability for each component of our application.
In the next diagram, you’ll find a general explanation of how this pattern works. Please don’t confuse it with a common server under a load balancer. The shards are the key point of this pattern.
This pattern is useful when you:
- Have an application with specific components/parts that have high usage
- Have an application with critical parts that need to keep up and running across deploys of other parts of the application
- Have an application distributed where users on specific locations access different resources
We hope this short post is useful for you and your application, ff you want to learn more about this kind of patters, ou can ask for a post about it. We’ll be happy to write it for you.
Regos Dev Studio is a product development company that builds add-ons for Jira and Confluence, combined with the development of custom solutions in a variety of languages.