Bird
Raised Fist0
Microservicessystem_design~20 mins

Anti-patterns (distributed monolith, chatty services) in Microservices - Practice Problems & Coding Challenges

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Challenge - 5 Problems
🎖️
Anti-patterns Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Identifying a Distributed Monolith

Which of the following best describes a distributed monolith in a microservices architecture?

AA system where each microservice is fully independent and communicates only via asynchronous events.
BA system where services are tightly coupled and require synchronous calls, causing deployment and scaling challenges.
CA monolithic application running on a single server without any service boundaries.
DA system where microservices use a shared database but have independent deployment cycles.
Attempts:
2 left
💡 Hint

Think about coupling and communication patterns that make microservices behave like a single unit.

Architecture
intermediate
2:00remaining
Reducing Chatty Service Calls

You have a microservices system where Service A calls Service B, which then calls Service C, causing high latency due to many synchronous calls. Which architectural change best reduces this chatty service problem?

ACombine Services B and C into a single service to reduce inter-service calls.
BAdd more synchronous calls between Service A and Service C to balance the load.
CUse a shared database for all services to avoid service-to-service communication.
DIncrease the timeout values for all service calls to handle latency better.
Attempts:
2 left
💡 Hint

Think about reducing the number of calls by merging tightly coupled services.

scaling
advanced
2:00remaining
Scaling Challenges in Distributed Monoliths

In a distributed monolith, what is the main challenge when trying to scale individual microservices independently?

AServices share a database schema, so scaling one service requires scaling the entire database, limiting independent scaling.
BServices communicate only via asynchronous messaging, which simplifies scaling.
CEach service has its own database, so scaling one service does not affect others.
DMicroservices are stateless, so scaling is automatic and independent.
Attempts:
2 left
💡 Hint

Consider how shared resources affect scaling.

tradeoff
advanced
2:00remaining
Tradeoffs of Reducing Chatty Services

What is a common tradeoff when reducing chatty service calls by merging multiple microservices into one?

ASimpler database schema but more complex inter-service communication.
BIncreased network latency but better fault isolation.
CImproved performance but reduced service autonomy and harder independent deployment.
DBetter scalability but increased risk of data inconsistency.
Attempts:
2 left
💡 Hint

Think about what merging services affects besides communication.

estimation
expert
2:00remaining
Estimating Impact of Chatty Services on Latency

Consider a microservices system where each synchronous call adds 50ms latency. Service A calls Service B, which calls Service C, which calls Service D sequentially. What is the total added latency due to these calls?

A200ms
B50ms
C100ms
D150ms
Attempts:
2 left
💡 Hint

Count the number of calls and multiply by latency per call.

Practice

(1/5)
1. Which of the following best describes a distributed monolith in microservices architecture?
easy
A. Services are fully independent and communicate rarely.
B. Services are tightly coupled and require coordinated deployment.
C. Services use asynchronous messaging to reduce latency.
D. Services are stateless and scale automatically.

Solution

  1. Step 1: Understand distributed monolith characteristics

    A distributed monolith looks like microservices but behaves like a single app with tight coupling.
  2. Step 2: Identify deployment and coupling issues

    Such services require coordinated deployment and cannot scale independently.
  3. Final Answer:

    Services are tightly coupled and require coordinated deployment. -> Option B
  4. Quick Check:

    Distributed monolith = tight coupling [OK]
Hint: Distributed monolith means tight coupling, not independence [OK]
Common Mistakes:
  • Confusing distributed monolith with loosely coupled microservices
  • Thinking distributed monolith scales independently
  • Assuming distributed monolith uses asynchronous calls
2. Which syntax correctly describes a common symptom of chatty services in microservices communication?
easy
A. Service A uses event-driven messaging to notify Service B.
B. Service A calls Service B once per user request.
C. Service A calls Service B multiple times per user request.
D. Service A caches data to reduce calls to Service B.

Solution

  1. Step 1: Define chatty services behavior

    Chatty services make many small calls between services per user request.
  2. Step 2: Identify the correct syntax describing chatty calls

    Multiple calls per request indicate chatty communication.
  3. Final Answer:

    Service A calls Service B multiple times per user request. -> Option C
  4. Quick Check:

    Chatty services = many calls [OK]
Hint: Chatty means many calls, not just one [OK]
Common Mistakes:
  • Choosing event-driven messaging as chatty behavior
  • Assuming caching causes chatty services
  • Thinking one call per request is chatty
3. Given a microservices system where Service A calls Service B 5 times and Service B calls Service C 3 times per user request, what is the total number of service calls triggered by one user request?
medium
A. 20
B. 15
C. 30
D. 8

Solution

  1. Step 1: Calculate calls from Service A to B

    Service A calls Service B 5 times per request.
  2. Step 2: Calculate calls from Service B to C triggered by A's calls

    Each of the 5 calls from A causes 3 calls from B to C, so 5 * 3 = 15 calls.
  3. Step 3: Sum all calls

    Total calls = 5 (A->B) + 15 (B->C) = 20 calls.
  4. Final Answer:

    20 -> Option A
  5. Quick Check:

    5 + (5*3) = 20 [OK]
Hint: Multiply nested calls, then add all [OK]
Common Mistakes:
  • Adding 5 + 3 instead of multiplying
  • Ignoring nested calls from B to C
  • Choosing sum as 18 instead of 20
4. You notice your microservices system has high latency due to many small synchronous calls between services. Which change would best fix this chatty service anti-pattern?
medium
A. Use asynchronous messaging or batch requests to reduce calls.
B. Combine tightly coupled services into a single service.
C. Add more synchronous calls to improve data freshness.
D. Increase the number of service instances to handle load.

Solution

  1. Step 1: Identify chatty service problem

    Many small synchronous calls cause latency and network overhead.
  2. Step 2: Choose solution to reduce call frequency

    Using asynchronous messaging or batching reduces calls and latency.
  3. Final Answer:

    Use asynchronous messaging or batch requests to reduce calls. -> Option A
  4. Quick Check:

    Reduce calls with async or batching [OK]
Hint: Reduce calls by batching or async messaging [OK]
Common Mistakes:
  • Combining services creates distributed monolith
  • Adding more sync calls worsens latency
  • Scaling instances doesn't reduce call count
5. A company has a microservices system suffering from both distributed monolith and chatty services anti-patterns. Which combined approach best improves scalability and deployment independence?
hard
A. Merge all services into one large application to simplify deployment.
B. Increase hardware resources and add load balancers to handle traffic.
C. Use synchronous REST calls extensively to keep services tightly connected.
D. Refactor services to reduce dependencies and use asynchronous communication.

Solution

  1. Step 1: Address distributed monolith by reducing dependencies

    Refactoring services to be loosely coupled allows independent deployment and scaling.
  2. Step 2: Fix chatty services by adopting asynchronous communication

    Using async messaging reduces frequent synchronous calls and network overhead.
  3. Step 3: Combine both improvements for better scalability and independence

    This combined approach solves both anti-patterns effectively.
  4. Final Answer:

    Refactor services to reduce dependencies and use asynchronous communication. -> Option D
  5. Quick Check:

    Loose coupling + async = scalable microservices [OK]
Hint: Loose coupling + async communication fixes both issues [OK]
Common Mistakes:
  • Merging services worsens distributed monolith
  • Adding hardware doesn't fix design flaws
  • Using more sync calls increases chatty problems