EP7: The Secret Behind High Availability of Cassandra
In this week's edition of System Design Weekly, we dive into the intriguing concept of Hinted Handoffs. It is a technique that is heavily used in distributed database systems like DynamoDB and Cassandra. Used to ensure high availability, Hinted Handoffs guarantee successful writes even during node failures and outages.
As you read on, you will find a brief overview of various types of coding design patterns. Design patterns are often grouped based on their intent to enhance recognition and usability.
Towards the end, in this week's Tech Spotlight, we feature an article from Canva’s Engineering team on building a service designed to Count to a Billion!
✉️ Hinted Handoffs
Hinted Handoffs is a distributed database technique that enables database writes to be processed even when some nodes in the database cluster are unavailable.
Example~ In a three-node distributed database, the coordinator performs writes across all nodes and confirms success. If a node (e.g., Node A) goes down, the coordinator stores hints and delivers them once the node is back online.
Here are some interesting things about Hinted Handoffs ~
Each node maintains a local hint storage.
Logical clocks are used for event ordering with timestamps.
Nodes gossip to share information and maintain a local view of other nodes' statuses.
Hints usually don't count toward quorum in most systems.
Databases with hint-replay manage replay rates to avoid overwhelming nodes.
Cassandra and DynamoDB are the two most popular examples of databases using Hinted Handoffs!
≫ Checkout our Medium Blog for a deep-dive into Hinted Handoffs
🏷️ Classification of Coding Design Patterns
Design patterns are proven solutions to common software development challenges that developers have encountered over time. These patterns provide best practices and guidance on how to structure and write code effectively, ensuring scalability, maintainability, and efficiency.
To simplify the study and application of design patterns, they are typically categorized into groups based on shared characteristics. Below, we explore the most common classification of design patterns into three main groups ~
Creational Design Patterns
Creational Design Patterns address the challenges of object creation, which may initially seem like a straightforward task. However, in large codebases with thousands of classes, complex relationships, and numerous parameters, the process of object creation becomes far more intricate. In such cases, carefully structuring and planning how objects are instantiated is crucial to maintaining scalability, flexibility, and ease of maintenance.
Some popular creational design patterns are Factory, Singleton, and Builder.
Structural Design Patterns
Structural Design Patterns address the challenges involved in composing large structures out of classes and objects. Using these patterns, it is possible to manage complex class hierarchies, reuse existing code, and create scalable architecture.
Some popular structural design patterns are Adapter, Proxy, and Facade.
Behavioural Design Patterns
Behavioural design patterns focus on defining algorithms and determining how responsibilities are distributed among objects.
Some popular behavioural design patterns are Chain of Responsibility, Strategy, and Visitor.
🔦 Tech Spotlight!
In this week’s Tech Spotlight, we feature an article from Canva’s Engineering team, where they dive into the design of their content usage counting service. The service must maintain exceptional accuracy at scale, as the content usage data directly impacts payouts to creators.
They’ve crafted their latest architecture by combining DynamoDB with an OLAP database to handle end-to-end usage data calculations. However, what I found most fascinating is not just the current design, but the evolution that led to it. It’s a must-read for anyone passionate about system design!
And that is it for this week! If you enjoyed what you read, consider clicking the ❤️ button below and leaving a comment.
See you next week in yet another release of System Design Weekly! Till then, happy learning!