0
0
Microservicessystem_design~10 mins

Data consistency challenges in Microservices - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to choose the consistency model that ensures all nodes see the same data at the same time.

Microservices
consistency_model = "[1]"
Drag options to blanks, or click blank then click option'
AStrong Consistency
BEventual Consistency
CCausal Consistency
DRead Your Writes
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing Eventual Consistency which allows delays in data synchronization.
2fill in blank
medium

Complete the code to select the pattern that helps maintain data consistency across microservices asynchronously.

Microservices
consistency_pattern = "[1]"
Drag options to blanks, or click blank then click option'
ACircuit Breaker
BEvent Sourcing
CTwo-Phase Commit
DSaga Pattern
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing with Two-Phase Commit which is synchronous and blocking.
3fill in blank
hard

Fix the error in the statement about consistency guarantees in microservices.

Microservices
The [1] model allows temporary inconsistencies but guarantees eventual data synchronization.
Drag options to blanks, or click blank then click option'
AEventual Consistency
BLinearizability
CStrong Consistency
DSerializability
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing Strong Consistency which does not allow temporary inconsistencies.
4fill in blank
hard

Fill both blanks to complete the code snippet that defines a distributed transaction using the Saga pattern.

Microservices
def saga_transaction():
    try:
        [1]()
        [2]()
    except Exception:
        compensate()
Drag options to blanks, or click blank then click option'
Astep_one
Bstep_two
Ccommit
Drollback
Attempts:
3 left
💡 Hint
Common Mistakes
Using commit or rollback which are not individual saga steps.
5fill in blank
hard

Fill all three blanks to complete the code that implements a simple eventual consistency check.

Microservices
def check_consistency(data_store):
    for node in data_store:
        if node.[1] != data_store.master.[2]:
            node.[3](data_store.master.data)
Drag options to blanks, or click blank then click option'
Aget_data
Bdata
Csync
Dupdate
Attempts:
3 left
💡 Hint
Common Mistakes
Using sync instead of update which is not a method here.