domain platform Commons: 3/5

Gateway Routing Pattern

Also known as: API Gateway Routing

1. Overview

The Gateway Routing pattern is a design pattern used in software architecture to route requests to multiple services or multiple service instances using a single endpoint. This pattern is particularly useful in microservices architectures where a client needs to consume multiple services. Instead of the client having to know about and connect to each individual service, it communicates with a single gateway. The gateway then routes the requests to the appropriate backend service based on the request details. This simplifies the client application, decouples it from the backend services, and allows for greater flexibility in the backend architecture.

2. Core Principles

The Gateway Routing pattern is based on the following core principles:

  • Single Entry Point: All client requests are directed to a single entry point, the gateway. This simplifies the client application as it only needs to know the address of the gateway.
  • Routing: The gateway is responsible for routing incoming requests to the appropriate backend service. This routing can be based on various criteria such as the request path, headers, or method.
  • Abstraction: The gateway abstracts the backend services from the clients. This means that the client does not need to know the details of the backend services, such as their addresses or how they are partitioned.

3. Key Practices

When a client application needs to consume multiple services, it typically needs to know the endpoint of each service. This can lead to a number of problems:

  • Client Complexity: The client application becomes more complex as it needs to manage connections to multiple services.
  • Coupling: The client application is tightly coupled to the backend services. If a service’s API changes, or if a service is refactored, the client application must be updated.
  • Scalability: When scaling the number of instances of a service, the client must be updated to be aware of the new instances.
  • Deployment: When deploying new versions of a service, the client must be updated to route traffic to the new version.

4. Implementation

The Gateway Routing pattern solves these problems by placing a gateway in front of the backend services. The client application communicates with the gateway, which then routes requests to the appropriate service. This has a number of benefits:

  • Simplified Client: The client application is simplified as it only needs to communicate with a single endpoint.
  • Decoupling: The client application is decoupled from the backend services. Changes to the backend services, such as API changes or refactoring, do not require changes to the client application.
  • Centralized Concerns: The gateway can handle cross-cutting concerns such as authentication, authorization, and rate limiting, which simplifies the backend services.

5. 7 Pillars Assessment

Pillar Score (1-5) Rationale
Purpose 3 Serves a clear technical purpose in system design
Governance 3 Can be governed through standard engineering practices
Culture 3 Supports engineering culture of reliability and quality
Incentives 3 Aligns incentives toward system stability
Knowledge 4 Well-documented pattern with extensive community knowledge
Technology 4 Directly applicable to modern technology stacks
Resilience 4 Contributes to overall system resilience
Overall 3.4 A valuable technical pattern that supports commons infrastructure

While the Gateway Routing pattern has many benefits, there are also some trade-offs and considerations to keep in mind:

  • Single Point of Failure: The gateway can become a single point of failure. It is important to ensure that the gateway is highly available and resilient.
  • Bottleneck: The gateway can become a bottleneck if it is not able to handle the load of all incoming requests. It is important to ensure that the gateway is scalable.
  • Increased Complexity: The gateway adds an extra hop to each request, which can increase latency. It also adds another component to the system that needs to be managed and maintained.

6. When to Use

  • Netflix API Gateway: Netflix uses an API gateway to handle requests from its various client applications. The gateway routes requests to the appropriate microservice and also handles concerns such as authentication and rate limiting.
  • Amazon API Gateway: Amazon API Gateway is a managed service that makes it easy to create, publish, maintain, monitor, and secure APIs at any scale.
  • Nginx: Nginx is a popular web server and reverse proxy that can be used to implement the Gateway Routing pattern.

7. Anti-Patterns & Gotchas

In the cognitive era, the Gateway Routing pattern can be used to route requests to different AI/ML models based on the request. For example, a gateway could route a request to a sentiment analysis model if the request contains text, or to an image recognition model if the request contains an image. The gateway could also be used to A/B test different models or to route traffic to different versions of a model.

8. References

  • Shared Resource: The gateway is a shared resource that is used by multiple client applications and backend services.
  • Democratic Governance: The gateway can be configured to route requests based on a set of rules that are agreed upon by the community.
  • Equitable Access: The gateway can be used to provide equitable access to backend services by routing requests based on factors such as the user’s location or device.
  • Sustainability: The gateway can help to improve the sustainability of the system by routing requests to the most efficient service.
  • Community Benefit: The gateway can benefit the community by making it easier to develop and consume services.

References

[1] Microsoft. (n.d.). Gateway Routing pattern. Azure Architecture Center. Retrieved February 10, 2026, from https://learn.microsoft.com/en-us/azure/architecture/patterns/gateway-routing [2] Richardson, C. (n.d.). Pattern: API Gateway / Backends for Frontends. Microservices.io. Retrieved February 10, 2026, from https://microservices.io/patterns/apigateway.html