EP6: Clocks in Distributed System
Welcome to the 6th episode of the System Design Weekly!
In this week’s edition, we talk about an interesting topic called Logical Clocks. Clocks and timestamps are one of those things that are just so easy to reason in a centralised system but quickly become complex in distributed systems’ design. Specifically, we talk about Lamport Clocks and Vector Clocks here!
Next, we dive into one of the most essential topics in bash scripting—Exit Codes. These numerical indicators help us understand the result of executing a command, which can be used for debugging and building robust scripts. Whether you're a beginner or a seasoned scripter, understanding how exit codes work can elevate your workflow.
Finally, in this week's Tech Spotlight, we feature an insightful white paper from Amazon, diving into the design of its DynamoDB.
⏰ Logical Clocks
First introduced by Lamport in 1978, logical clocks provide a method for capturing the order of related events in a distributed system using counters. The numerical value of a logical clock is independent of real-time, focusing solely on event ordering.
In a distributed system, each process starts with its own logical clock set to 0, which increments by 1 with each event it processes. When one process sends a message, it first increments its clock and includes the updated value in the message. Upon receiving the message, the receiving process increments its own clock by 1, compares it with the value in the message, and updates its clock to the maximum of the two values, ensuring correct event ordering.
Vector clocks are an extension to the Lamport clocks. Instead of maintaining a single counter, each process maintains a vector of numbers. The length of the vector is equal to the number of nodes in the distributed system. Each event is now timestamped with the entire vector V.
≫ A deep-dive into logical clocks soon releasing on our Medium Blog
🏃 Exit Codes in Bash
The exit code is an integer value returned by a Bash command or script upon its termination. These codes indicate the outcome of the program’s execution.
Generally, a non-zero exit code indicates unsuccessful execution of a program while an exit code of 0 denotes a successfully executed program.
The value of exit codes can range from 0 to 255 and some of these values hold special meaning and are more prominent than others. The table above summarises some of the most popular exit codes!
≫ Checkout the complete blog on System Design Weekly
🔦 Tech Spotlight!
Amazon's DynamoDB is a highly available and high-performance distributed key-value store. Initially developed for Amazon's internal use, it rapidly gained popularity as a top database solution after being made available to a broader audience through AWS.
In this week’s tech spotlight, we feature the white paper discussing the design of this amazing technology.
➥ Dynamo: Amazon’s Highly Available Key-value Store
The paper explores how key distributed database concepts such as Consistent Hashing, Hinted Handoffs, Sloppy Quorums, and Replication are leveraged to create a highly available system. It’s a must-read for all System Design enthusiasts!
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!