What if you could upgrade your system without ever turning off the lights?
Why Parallel running in Microservices? - Purpose & Use Cases
Start learning this pattern below
Jump into concepts and practice - no test required
Imagine you have a big, old system that needs an upgrade. You try to switch everything at once, turning off the old system and turning on the new one. If something breaks, your whole business stops. It's like changing all the lights in a house at night without a backup flashlight.
Doing this switch manually is risky and slow. If the new system has bugs, customers get stuck. Fixing problems means going back and forth, causing downtime and lost trust. It's stressful and error-prone because you can't test the new system fully while the old one is off.
Parallel running lets you run the old and new systems side by side. Both handle the same tasks at the same time. This way, you can compare results, catch errors early, and switch over smoothly without stopping service. It's like having two cars on the road, testing the new one while the old one keeps driving safely.
shutdown(old_system) start(new_system)
run_in_parallel(old_system, new_system) compare_outputs() switch_when_ready()
Parallel running makes system upgrades safe, smooth, and reliable without interrupting users.
A bank upgrades its transaction system by running the old and new software together. They check that both record transactions identically before fully switching, ensuring no money is lost or misrecorded.
Manual system switches risk downtime and errors.
Parallel running runs old and new systems side by side safely.
This approach enables smooth, reliable upgrades without service interruption.
Practice
parallel running in microservices?Solution
Step 1: Understand the concept of parallel running
Parallel running means running old and new systems side by side to compare their outputs and ensure the new system works correctly.Step 2: Identify the purpose in microservices
This approach helps catch errors and ensures a smooth transition before fully switching to the new system.Final Answer:
To run old and new systems together to ensure smooth transition -> Option AQuick Check:
Parallel running = run old and new systems together [OK]
- Thinking parallel running means immediate replacement
- Confusing parallel running with running unrelated services
- Assuming old system is discarded immediately
Solution
Step 1: Understand deployment in parallel running
Parallel running requires both old and new versions to run simultaneously to compare results.Step 2: Identify correct routing method
Routing a copy of requests to both versions allows output comparison without disrupting users.Final Answer:
Deploy new microservice version alongside old one and route a copy of requests to both -> Option AQuick Check:
Parallel running = deploy both and route requests to both [OK]
- Stopping old service before testing new one
- Ignoring logs from old service
- Running new service only at specific times
Solution
Step 1: Understand output comparison in parallel running
Parallel running compares outputs to detect discrepancies between old and new services.Step 2: Decide action on output mismatch
If outputs differ, the system should log the difference and alert engineers to investigate before switching fully.Final Answer:
Log the difference and alert engineers for investigation -> Option DQuick Check:
Output mismatch = log and alert [OK]
- Ignoring output differences
- Stopping old service too early
- Switching back permanently without investigation
Solution
Step 1: Analyze routing in parallel running
For parallel running, requests must be routed to both old and new services simultaneously.Step 2: Identify why new service gets no requests
If new service never receives requests, routing likely sends all traffic only to old service.Final Answer:
The routing logic is only sending requests to the old service -> Option BQuick Check:
No requests to new service = routing issue [OK]
- Assuming new service crashed without checking logs
- Blaming old service logs
- Thinking speed affects request routing
Solution
Step 1: Understand gradual traffic shifting in parallel running
Gradually increasing traffic to the new service while comparing outputs reduces risk and performance impact.Step 2: Evaluate options for safety and performance
Routing a small portion initially and increasing after validation balances safety and system load.Final Answer:
Route 10% of traffic to new service and 90% to old service, compare outputs, then gradually increase new service traffic -> Option CQuick Check:
Gradual traffic shift with output comparison = safe and performant [OK]
- Switching 100% traffic immediately
- Skipping output comparison
- Stopping old service too early
