Lesson 5 · Selective scaling

One entry point. Extra capacity only where needed.

The API Gateway routes every request by path. User and Order go directly to one service, while the busier Catalog path goes through an L7 Load Balancer and reaches one of two replicas.

API Gateway Selective scaling L7 Load Balancer Catalog replicas

Interactive architecture lab

Compare a direct route with a scaled route.

Send User, Product, and Order requests through the same gateway. Only Product requests should enter the Load Balancer.

Choose an APIAll use one gateway
Gateway URL http://localhost:7512/api/users
You can run the selected request in Postman.
Start the lesson, then execute a request.
Execute a request to inspect the original response.
Execute a request to inspect the response headers.
One public address
Gateway statusSTOPPED
Current decision/api/users → User Service
Direct route/api/users
Gateway forwards directly
Scaled route/api/products
Gateway selects Catalog
Direct route/api/orders
Gateway forwards directly

Observe the two decisions

Did this route need a Load Balancer?

The gateway always chooses a service. Only the Catalog route requires a second decision to choose a replica.

Latest request path WAITING Execute a request to compare the paths.
Gateway selectedUser Service
Load Balancer usedNo
Catalog historyNo requests yet
  1. 1
    Start the lessonThe trace will reveal whether the request needs one routing decision or two.
API Gateway logall requests
Start Lesson 5.
Load Balancer logProducts only
Only Catalog requests enter this node.

What this teaches

Scale only the services that need it.

We can use the API Gateway as the main entry point for all client requests. Not every service needs a Load Balancer, so we add one only in front of a service that receives high traffic or needs multiple instances.

Client→API Gateway→User Service
Client→API Gateway→L7 Load Balancer→Catalog Replicas
1

API Gateway

Owns the external entry point, selects a service, and can centralize authentication, rate limiting, TLS termination, and API policies.

2

Load Balancer

Exists only on the scaled Catalog path and distributes Product requests between its healthy replicas.

3

Application Services

Focus on business logic while infrastructure components handle external routing and traffic distribution.

What this gives us

  • One stable public API address
  • Independent scaling per service
  • No unnecessary Load Balancers
  • Catalog traffic distributed across replicas
  • Clear separation between service and instance selection

What still remains

  • The single API Gateway remains a Single Point of Failure (SPOF)
  • The Catalog Load Balancer is also one infrastructure instance
  • User and Order still have one application instance each
  • Gateway capacity cannot yet scale horizontally

The next design pressure

How do we remove the API Gateway SPOF?

Run multiple API Gateway instances and place an Edge/L4 Load Balancer above them.

Next: scale the API Gateway layer →