0
0
Microservicessystem_design~10 mins

Traffic management (routing, splitting) 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 define a simple routing rule that directs traffic to the correct microservice.

Microservices
route = {
  "path": "/api/v1/users",
  "service": "[1]"
}
Drag options to blanks, or click blank then click option'
AUserService
BOrderService
CPaymentService
DInventoryService
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing a service unrelated to users, like PaymentService.
2fill in blank
medium

Complete the code to split traffic between two versions of a microservice for canary deployment.

Microservices
traffic_split = {
  "v1": 80,
  "[1]": 20
}
Drag options to blanks, or click blank then click option'
Av2
Bv3
Cv1
Dv4
Attempts:
3 left
💡 Hint
Common Mistakes
Using the same version 'v1' for both splits.
3fill in blank
hard

Fix the error in the routing rule to correctly match the path prefix.

Microservices
routing_rule = {
  "match": {
    "path_prefix": "[1]"
  },
  "service": "PaymentService"
}
Drag options to blanks, or click blank then click option'
A/payments/api/v1
B/api/v1/payments
Capi/v1/payments
Dpayments/api/v1
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting the leading slash in the path prefix.
4fill in blank
hard

Fill both blanks to create a traffic splitting rule that sends 70% to stable and 30% to canary.

Microservices
traffic_policy = {
  "stable": [1],
  "canary": [2]
}
Drag options to blanks, or click blank then click option'
A70
B30
C50
D20
Attempts:
3 left
💡 Hint
Common Mistakes
Splitting traffic unevenly or incorrectly summing to more than 100.
5fill in blank
hard

Fill all three blanks to define a routing rule with path, method, and target service.

Microservices
routing_rule = {
  "path": "[1]",
  "method": "[2]",
  "service": "[3]"
}
Drag options to blanks, or click blank then click option'
A/api/v1/orders
BPOST
COrderService
DGET
Attempts:
3 left
💡 Hint
Common Mistakes
Using GET instead of POST for order creation.