Building a Reactive System is all about the balance between consistency and availability and the consequences of picking one over the other. This article mainly focuses on consistency and availability and how they impact the scalability of a system.
2. Lack of etiquette and manners is a huge turn off.
KnolX Etiquettes
Punctuality
Respect Knolx session timings, you
are requested not to join sessions
after a 5 minutes threshold post
the session start time.
Feedback
Make sure to submit a constructive
feedback for all sessions as it is
very helpful for the presenter.
Mute
Please keep your window on mute
Avoid Disturbance
Avoid leaving your window
unmuted after asking a question
5. Introduction
Building a Reactive System is all about
the balance between consistency and
availability and the consequences of
picking one over the other.
In this session, we’ll mainly focus on
consistency and availability and how
they impact the scalability of a system.
8. Concerns regarding Scalability
Service-Oriented Architecture
02
01
How does the scalability of a system
differs from the performance of the
system?
03
How can we measure scalability and
performance of a system?
How can we explain consistency in
distributed systems?
10. What is Eventual Consistency?
● When a system stops receiving updates at least for some period of time, we
can guarantee that all parts of the system will eventually converge on the same
state.
● Common source control tools rely on a later merge operation in order to bring
things back into alignment.
11. What is Strong Consistency?
● When all members of a system agree on the state, before it becomes available.
● We can achieve strong consistency by introducing mechanisms like locks.
● Distributed system problem occurs when we have multiple things which are
responsible for the same piece of data. We can resolve the distributed system
problem by using a non distributed resource(lock).
● Introduction of lock causes overhead in the form of contention.
13. What is Contention?
● When any two things contend for a single limited resource and are in
competition with each other.
● That competition can only have one winner, others are forced to wait in line for
the winner to complete.
● As the number of things competing increases, the time to free up the resources
increases.
14. What is Coherency Delay?
● In a distributed system, multiple nodes want to reach a state of coherence
where they all agree on the state of the system.
● To reach the state of coherence each node in the system have to send
messages to each other node informing about any state changes.
● Over time all of the nodes will reach that state of coherence.
● The time reach this synchronization is coherency delay.
● As the number of nodes increases, coherency delay also increases.
16. What are Laws of Scalability?
● Explains the after effects of
scaling up a distributed system.
● The two laws of scalability are:
Amdahl’s Law and Gunther’s Law
17. Amdahl’s Law of Scalability?
● Shows the effect of contention on a
distributed system.
● Recognizes that contention limits
parallelization.
● Defines the maximum improvement gained by
parallel processing.
● Demonstrates that when we have contention,
and we try to add concurrency, or scale up the
system, we start to see diminishing returns.
18. Gunther’s Law of Scalability?
● Shows the effect of coherency delay on a
distributed system.
● Demonstrates that scaling up requires more
communication and coordination between all
the nodes, cost of that this exceeds any
benefits gained from scaling up.
● Shows that increasing concurrency can cause
negative returns due to contention and
coherency delay.
● This reduces our ability of parallelization.
20. How can we reduce the Impact of Laws of
Scalability on Reactive Systems?
Reactive systems can reduce contention by following ways:
● By isolating locks. Isolated lock creates less contention.
● By eliminating transactions.
● By avoiding blocking operations.
21. How can we reduce the Impact of Laws of
Scalability on Reactive Systems?
Reactive systems can mitigate coherency delay by ways:
● By embracing eventual consistency.
● By building autonomy.
23. What is CAP Theorem?
● CAP Theorem states that in a
distributed system we cannot
provide more than two of the
following:
● i. consistency,
● ii. availability
● iii. partition tolerance.
24. What is CAP Theorem?
When a partition occurs, a distributed
system has 2 options:
● AP: System needs to sacrifice
consistency by allowing writes to both
sides of partitions.
● CP: System needs to sacrifice
availability by disabling or terminating
one side of the partition.
25. What is CAP Theorem?
● We can use technique like Sharding to
balance the need for consistency along
with the need for scalability.
● We can use technique like Conflict-Free
Replicated Data Types(CRDTs) to balance the
need for availability along with the need for
scalability.
27. We need to consider various factors before making a choice:
● What’s is the impact on revenue if system is unavailable v/s eventually consistent?
● What’s going to have a bigger impact on the business?
● What’s going to have a bigger impact on the customer?
● How is it going to affect them in the long run?