Rachana NV’s Post

View profile for Rachana NV, graphic

Software Engineer | Ex Hyland R&D | Ex Wipro | .NET | Backend Developer | MySQL | AWS | Enhancing Performance & Scalability

Day 11: What I Learnt today! Consistency is negotiable, but at what cost? 💡 Scenario: You like a friend's post on Instagram and the like count shows '100' for you but '99' for them. Annoying, right? That's where consistency in distributed systems comes into play! From banking apps that demand strict accuracy to social media, where eventual consistency suffices, it’s all about trade-offs. 🏦📱 Today, I dived into the 4 types of consistency: Strict, Causal, Eventual, and Quorum. Each has its quirks, some are perfectionists, others prefer speed. The key takeaway is to select the level of consistency that aligns with your system's requirements. While perfection is essential for critical systems like banking, it can be more flexible in scenarios like social media updates where speed and availability take priority. #LearningJourney #Tech

View profile for Raul Junco, graphic

Simplifying System Design

Consistency is negotiable!  The real question is, how much will you pay for it? In Distributed Systems, consistency ensures that changes appear correctly across the board, everywhere, every time. For example, if you like a friend's photo on Facebook, the like count should show "100" for you and your friend, no matter where you are. But, not all systems need perfect consistency. Social features like Facebook likes don't have to be perfect all the time. Yet consistency is crucial for banking systems to avoid errors like duplicate transactions. There are four types of consistency in distributed systems: 𝟭. 𝗦𝘁𝗿𝗶𝗰𝘁 𝗼𝗿 𝗟𝗶𝗻𝗲𝗮𝗿𝗶𝘇𝗲𝗱 𝗖𝗼𝗻𝘀𝗶𝘀𝘁𝗲𝗻𝗰𝘆 This is the strictest type of consistency. Imagine a system that handles one request at a time, like people waiting in line.  Each request is processed completely before the next one starts, making sure everyone sees the same thing at the same time. 𝗣𝗿𝗼𝘀 𝗮𝗻𝗱 𝗖𝗼𝗻𝘀: • Very accurate but slow because each request has to wait its turn. • If a request takes too long, everything else gets delayed. 𝟮. 𝗖𝗮𝘂𝘀𝗮𝗹 𝗖𝗼𝗻𝘀𝗶𝘀𝘁𝗲𝗻𝗰𝘆 This type of consistency is more relaxed. It only makes sure that related actions happen in the right order.  For example, if Alice posts something and then comments on it, the system must keep those actions in the correct order. But if Bob likes a different post, the system can handle that separately. 𝗣𝗿𝗼𝘀 𝗮𝗻𝗱 𝗖𝗼𝗻𝘀: • Faster than strict consistency. • Slightly less accurate since unrelated actions can happen at the same time, which might cause some confusion. 𝟯. 𝗘𝘃𝗲𝗻𝘁𝘂𝗮𝗹 𝗖𝗼𝗻𝘀𝗶𝘀𝘁𝗲𝗻𝗰𝘆 This type focuses on being fast and always available.  It doesn't guarantee that all users will see changes right away, but eventually, everyone will see the same data. Think of a social media-like count that takes a moment to update for everyone. Good for systems where a small delay is okay. 𝗣𝗿𝗼𝘀 𝗮𝗻𝗱 𝗖𝗼𝗻𝘀: • Fast and highly available, but not immediately accurate. • Works well for non-critical updates where some delay is acceptable. 𝟰. 𝗤𝘂𝗼𝗿𝘂𝗺 𝗖𝗼𝗻𝘀𝗶𝘀𝘁𝗲𝗻𝗰𝘆 Quorum consistency lets you choose how many servers must agree before confirming a change.  Imagine you have three servers and decide that at least two of them must agree to consider the data accurate. 𝗛𝗼𝘄 𝗜𝘁 𝗪𝗼𝗿𝗸𝘀: • You can make it stricter or more relaxed based on how many servers need to agree. • More servers agreeing means more consistency. Fewer servers mean more flexibility and speed. 𝗣𝗿𝗼𝘀 𝗮𝗻𝗱 𝗖𝗼𝗻𝘀: • Flexible: You can adjust how much consistency you want versus how fast it should be. • Lets you balance between accuracy and speed. Lower consistency isn’t always bad; it often offers better speed or availability. You have to pick. But, stay Consistent!

  • No alternative text description for this image

To view or add a comment, sign in

Explore topics