Bird
Raised Fist0
Microservicessystem_design~20 mins

Strangler fig pattern 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
🎖️
Strangler Fig Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding the core idea of the Strangler Fig Pattern

Which of the following best describes the main goal of the Strangler Fig Pattern in system design?

ATo replace a legacy system gradually by building new features as separate components that eventually take over all functionality.
BTo immediately rewrite the entire legacy system from scratch to improve performance and scalability.
CTo run the legacy system and new system in parallel indefinitely without integration.
DTo create a monolithic application that handles all legacy and new features in one codebase.
Attempts:
2 left
💡 Hint

Think about how the pattern helps in transitioning from old to new without big risks.

Architecture
intermediate
2:00remaining
Identifying components in a Strangler Fig architecture

In a Strangler Fig Pattern implementation, which component acts as the traffic director that routes requests between the legacy system and new microservices?

AMessage Queue
BLoad Balancer
CAPI Gateway
DDatabase
Attempts:
2 left
💡 Hint

Consider which component controls request routing and can decide where to send each request.

scaling
advanced
2:30remaining
Scaling challenges during Strangler Fig migration

What is a common scaling challenge when running both legacy and new systems simultaneously in a Strangler Fig migration?

AReducing the number of microservices to avoid complexity.
BEnsuring consistent data synchronization between legacy and new components.
CEliminating all legacy system dependencies immediately.
DDeploying the new system on the same hardware as the legacy system.
Attempts:
2 left
💡 Hint

Think about data consistency when two systems handle parts of the workload.

tradeoff
advanced
2:30remaining
Tradeoffs in choosing Strangler Fig Pattern

Which tradeoff is most associated with using the Strangler Fig Pattern for system migration?

ANo need for testing since old system remains untouched.
BFaster migration but higher risk of breaking existing features.
CComplete system rewrite with no backward compatibility.
DLonger migration time but reduced risk of system downtime.
Attempts:
2 left
💡 Hint

Consider the balance between speed and safety in migration strategies.

estimation
expert
3:00remaining
Estimating capacity needs during Strangler Fig migration

You are migrating a legacy monolith to microservices using the Strangler Fig Pattern. The legacy system handles 10,000 requests per second. You plan to migrate 30% of functionality to new microservices initially. What is the minimum expected request load on the new microservices after migration starts?

A3,000 requests per second
B7,000 requests per second
C10,000 requests per second
D30,000 requests per second
Attempts:
2 left
💡 Hint

Calculate the portion of total requests handled by new microservices based on migrated functionality percentage.

Practice

(1/5)
1. What is the main goal of the Strangler fig pattern in microservices architecture?
easy
A. To build all new services from scratch before replacing the old system
B. To merge all services into a single monolithic application
C. To run the old and new systems completely separately without integration
D. To gradually replace parts of a legacy system with new services

Solution

  1. Step 1: Understand the pattern's purpose

    The Strangler fig pattern is designed to replace legacy systems gradually, not all at once.
  2. Step 2: Compare options with the pattern goal

    To gradually replace parts of a legacy system with new services matches the gradual replacement approach, while others describe different strategies.
  3. Final Answer:

    To gradually replace parts of a legacy system with new services -> Option D
  4. Quick Check:

    Gradual replacement = B [OK]
Hint: Strangler fig means gradual replacement, not all at once [OK]
Common Mistakes:
  • Thinking it replaces the whole system at once
  • Confusing it with parallel running without integration
  • Assuming it merges services into one
2. Which of the following is the correct way to route requests in the Strangler fig pattern?
easy
A. Send requests randomly to either legacy or new system without control
B. Direct all requests to the legacy system until the new system is fully ready
C. Route requests step-by-step from the legacy system to new microservices
D. Stop the legacy system completely before routing any requests

Solution

  1. Step 1: Identify routing strategy in Strangler fig

    The pattern routes requests gradually from old to new components, not all at once or randomly.
  2. Step 2: Match options with routing approach

    Route requests step-by-step from the legacy system to new microservices describes step-by-step routing, which fits the pattern best.
  3. Final Answer:

    Route requests step-by-step from the legacy system to new microservices -> Option C
  4. Quick Check:

    Step-by-step routing = A [OK]
Hint: Route requests gradually, not all or random [OK]
Common Mistakes:
  • Routing all requests to legacy until full switch
  • Routing requests randomly causing inconsistency
  • Stopping legacy before new system ready
3. Consider this simplified request flow in a Strangler fig pattern:
Legacy system handles requests for features A, B, C.
New microservice replaces feature A.
Requests for A go to new service; B and C go to legacy.
What happens when a request for feature B arrives?
medium
A. It is routed to the new microservice handling feature A
B. It is routed to the legacy system since B is not replaced yet
C. It causes an error because feature B is missing in new service
D. It is dropped and not processed

Solution

  1. Step 1: Analyze routing rules for features

    Only feature A is replaced by the new microservice; B and C remain in legacy.
  2. Step 2: Determine routing for feature B request

    Requests for B still go to legacy system as it is not replaced yet.
  3. Final Answer:

    It is routed to the legacy system since B is not replaced yet -> Option B
  4. Quick Check:

    Feature B not replaced = legacy route = C [OK]
Hint: Unreplaced features stay on legacy system [OK]
Common Mistakes:
  • Routing all requests to new service regardless of feature
  • Assuming missing features cause errors
  • Dropping requests instead of routing properly
4. A team tries to apply the Strangler fig pattern but routes all requests to the new microservice before it fully supports all features. What is the main problem with this approach?
medium
A. It leads to inconsistent behavior as new service lacks some features
B. It causes downtime because legacy system is stopped too early
C. It improves performance by forcing early migration
D. It simplifies deployment by removing legacy dependencies

Solution

  1. Step 1: Identify issue with premature routing

    Routing all requests early means new service may not handle all features yet.
  2. Step 2: Understand impact on system behavior

    This causes inconsistent or failed responses for unsupported features.
  3. Final Answer:

    It leads to inconsistent behavior as new service lacks some features -> Option A
  4. Quick Check:

    Premature routing = inconsistent behavior = A [OK]
Hint: Route only supported features to new service [OK]
Common Mistakes:
  • Thinking early routing improves performance always
  • Assuming legacy can be stopped immediately
  • Ignoring feature support gaps
5. You are designing a migration plan using the Strangler fig pattern for a large monolithic app with features X, Y, and Z. Feature X is critical and must have zero downtime. How should you apply the pattern to ensure smooth migration?
hard
A. Replace feature X first with a new microservice and route only X requests there, keep Y and Z on legacy
B. Replace all features at once to avoid partial routing complexity
C. Stop the legacy app and start new microservices for all features simultaneously
D. Keep all features on legacy until new system is fully ready, then switch all at once

Solution

  1. Step 1: Prioritize critical feature migration

    Feature X requires zero downtime, so migrate it first carefully.
  2. Step 2: Apply gradual routing for feature X only

    Route requests for X to new microservice while Y and Z remain on legacy to reduce risk.
  3. Step 3: Avoid full switch or stopping legacy abruptly

    The other options risk downtime or complexity by switching all features at once.
  4. Final Answer:

    Replace feature X first with a new microservice and route only X requests there, keep Y and Z on legacy -> Option A
  5. Quick Check:

    Gradual critical feature migration = D [OK]
Hint: Migrate critical features first, route requests gradually [OK]
Common Mistakes:
  • Trying to replace all features at once
  • Stopping legacy before new system ready
  • Delaying critical feature migration