0
0
Microservicessystem_design~10 mins

Anti-patterns (distributed monolith, chatty services) 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 identify the anti-pattern where services are tightly coupled and deploy together.

Microservices
if system_architecture == '[1]':
    print("Warning: Services are tightly coupled and not independently deployable.")
Drag options to blanks, or click blank then click option'
Amonolithic
Bevent_driven
Cserverless
Ddistributed_monolith
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing 'monolithic' which is a single app, not distributed.
2fill in blank
medium

Complete the code to detect an anti-pattern where services make too many small calls to each other.

Microservices
if service_calls_per_request > [1]:
    print("Warning: Chatty services detected, consider reducing inter-service calls.")
Drag options to blanks, or click blank then click option'
A10
B100
C50
D5
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing 5 which is too low, or 50/100 which is too high.
3fill in blank
hard

Fix the error in the code that wrongly identifies chatty services by comparing calls incorrectly.

Microservices
if total_calls_per_request [1] 10:
    print("Chatty services detected")
Drag options to blanks, or click blank then click option'
A>=
B<=
C==
D!=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<=' which detects low calls instead of high.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that maps service names to their call counts, filtering only chatty services.

Microservices
chatty_services = {service: calls for service, calls in service_calls.items() if calls [1] [2]
Drag options to blanks, or click blank then click option'
A>
B10
C<
D5
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' which filters low call services.
5fill in blank
hard

Fill all three blanks to create a function that detects distributed monolith by checking if services share the same database and have high coupling.

Microservices
def is_distributed_monolith(services):
    shared_db = any(s['db'] == [1] for s in services)
    high_coupling = any(s['calls'] [2] [3] for s in services)
    return shared_db and high_coupling
Drag options to blanks, or click blank then click option'
A'central_db'
B>
C10
D'isolated_db'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'isolated_db' which means no shared database.