0
0
Microservicessystem_design~10 mins

Why resilience prevents cascading failures in Microservices - Test Your Understanding

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

Complete the code to add a retry mechanism in a microservice call.

Microservices
response = call_service()
if not response.success:
    response = call_service()[1]
Drag options to blanks, or click blank then click option'
Aretry()
Attempts:
3 left
💡 Hint
Common Mistakes
Not retrying at all
Retrying infinitely without limit
Ignoring the failure
2fill in blank
medium

Complete the code to implement a circuit breaker pattern.

Microservices
if circuit_breaker.[1]():
    return fallback_response()
Drag options to blanks, or click blank then click option'
Atrip
Bclose
Creset
Dis_open
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'close' instead of 'is_open'
Calling reset prematurely
Using 'trip' as a method
3fill in blank
hard

Fix the error in the code that limits concurrent requests to a service.

Microservices
semaphore = Semaphore([1])
with semaphore:
    call_service()
Drag options to blanks, or click blank then click option'
ANone
B'10'
C10
D-1
Attempts:
3 left
💡 Hint
Common Mistakes
Using string '10' instead of integer 10
Using None or negative values
4fill in blank
hard

Fill both blanks to create a timeout wrapper for a service call.

Microservices
try:
    result = call_service(timeout=[1])
except [2]:
    result = fallback()
Drag options to blanks, or click blank then click option'
A5
BTimeoutError
CConnectionError
D10
Attempts:
3 left
💡 Hint
Common Mistakes
Using too high timeout values
Catching wrong exception types
5fill in blank
hard

Fill all three blanks to implement bulkhead isolation in microservices.

Microservices
bulkhead = Bulkhead(max_concurrent_calls=[1], queue_size=[2])
with bulkhead.[3]():
    call_service()
Drag options to blanks, or click blank then click option'
A10
B20
Cacquire
Drelease
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'release' instead of 'acquire'
Setting queue size too low or too high