Professional Documents
Culture Documents
Csl526 LSTH: Non-Relational Databases L24 Slides
Csl526 LSTH: Non-Relational Databases L24 Slides
Csl526 LSTH: Non-Relational Databases L24 Slides
Algorithm: Inventory 2. Initi lize n empty list to store v il bility st tuses received from e ch
Av il bility Consensus inventory system.
Algorithm 3. Iter te through e ch inventory system:
- determining product 3.1 Send request to the inventory system to check the v il bility of the
product.
v il bility cross multiple
3.2 Receive the v il bility st tus response from the inventory system.
inventory systems in n e-
3.3 Add the received v il bility st tus to the list.
commerce pl tform
4. Apply the consensus lgorithm to determine the ggreg ted v il bility
Input: Order request for
st tus:
CSL526 LSTH product
4.1 If ll inventory systems report the product s v il ble, set the
Non-Relational Databases Output: Aggreg ted ggreg ted st tus to " v il ble".
L24 Slides v il bility st tus of the 4.2 If t le st one inventory system reports the product s out of stock,
product set the ggreg ted st tus to "out of stock".
4.3 If there re con licting v il bility st tuses:
4.3.1 Resolve con licts b sed on prede ined rules.
4.3.2 Set the ggreg ted st tus ccordingly.
Anil Mokhade 21 March 2024 5. Return the ggreg ted v il bility st tus s the output of the lgorithm.
Th t me ns:
3. It could be p rtitioning: the network is physic lly or logic lly divided into
sep r te segments, preventing nodes in one segment from communic ting with
nodes in nother segment
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
f
a
a
a
a
a
a
f
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
f
a
a
a
CAP Theorem:*
Consistency: All nodes in the distributed system h ve the s me view of the d t t ny In the lgorithm for determining product v il bility cross multiple inventory systems in n e-commerce
given time. pl tform, we c n observe the following spects from the perspective of the CAP theorem:
P rtition Toler nce: The system rem ins oper tion l despite network p rtitions or
communic tion f ilures between nodes.
*The origin l reference for the P xos consensus lgorithm is the p per titled "The P rt-Time P rli ment" by Leslie L mport, which w s published in 1998.
Av il bility (A):
For the Inventory Synchronis tion Ex mple of eCommerce System: the CAP theorem c n be The lgorithm prioritizes v il bility by ensuring th t the e-commerce pl tform c n continue
observed in how the system oper tes under di erent conditions: serving customer requests even in the presence of f ilures or p rtitions in some inventory
Consistency (C): systems.
The lgorithm ims to chieve consistency by ggreg ting the v il bility st tuses from multiple
Av il bility is m int ined by llowing the system to respond to customer queries b sed on the
inventory systems nd determining single, consistent v il bility st tus for the product.
ggreg ted v il bility st tus, even if some inventory systems re tempor rily un v il ble or
Consistency is prioritized by ensuring th t ll inventory systems re ch greement on the in l
experiencing issues.
v il bility st tus before responding to the customer.
However, chieving strong consistency m y introduce del ys in the system's response time, s the However, ensuring high v il bility m y le d to eventu l consistency, where customers m y
lgorithm m y need to w it for responses from ll inventory systems. tempor rily see outd ted v il bility inform tion until the lgorithm upd tes the ggreg ted
st tus.
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
ff
a
P rtition Toler nce (P):
The lgorithm must be p rtition-toler nt to h ndle scen rios where communic tion Ex mple: determining product v il bility in n e-commerce pl tform…contd
between the e-commerce pl tform nd inventory systems is disrupted due to network
p rtitions or f ilures. - di erent scen rios m y rise where the system needs to compromise between consistency, v il bility,
nd p rtition toler nce.
P rtition toler nce is chieved by llowing the system to continue oper ting nd re ching
consensus on product v il bility even if some inventory systems re unre ch ble or Scen rio 1: Network P rtition
experience del ys in responding to requests.
Scen rio 2: High Tr ic Lo d
The lgorithm should be resilient to network p rtitions nd ensure th t the system rem ins
oper tion l despite tempor ry communic tion f ilures.
Suppose one of the inventory systems experiences n out ge or becomes tempor rily Wh t these scen rios illustr te?
un v il ble due to m inten nce or h rdw re f ilure.
To m int in v il bility nd continue serving customer requests, the e-commerce - how the system m y need to compromise between consistency, v il bility, nd p rtition
pl tform m y decide to respond to queries b sed on the v il bility st tus from other toler nce in di erent situ tions.
re ch ble inventory systems.
However, this compromise on p rtition toler nce m y result in inconsistencies if the - By underst nding the tr de-o s involved, the e-commerce pl tform c n m ke informed
un v il ble inventory system h s di erent v il bility inform tion comp red to the decisions to b l nce these spects b sed on the speci ic requirements nd priorities of the
others. business nd its customers.
In this scen rio, v il bility is prioritized over p rtition toler nce, potenti lly le ding to
tempor ry inconsistencies in v il bility inform tion.