Backend Development 9 min read

Understanding Service Gateways: Routing, Filters, and Technical Stack Selection

The article explains what a service gateway is, why it is needed in microservice architectures, its core functions such as routing and filtering, and provides a practical technology stack selection including Java, Spring Boot, Netflix Zuul, Consul, JWT, Prometheus, Grafana, and ELK.

Top Architect
Top Architect
Top Architect
Understanding Service Gateways: Routing, Filters, and Technical Stack Selection

服务网关 = 路由转发 + 过滤器

Routing forwarding receives all external requests and forwards them to the appropriate backend micro‑services.

Filters implement cross‑cutting concerns such as authentication, rate limiting, monitoring, etc.; even routing itself is realized through filters.

Three possible locations for permission‑check logic are discussed: (1) each service implements it individually, (2) a shared common service is used, and (3) the gateway’s pre‑filter handles it. The first approach is inefficient, the second inflates each service’s JAR and makes upgrades difficult, while the third centralises the logic without increasing service size.

Using a service gateway solves these problems: permission checks live in the gateway filter, backend services stay lightweight, and updates only require modifying the gateway.

The architecture after introducing a gateway consists of three parts: the service gateway, an open‑service layer, and individual services, all of which register themselves with a service registry.

Overall flow : a user request hits the gateway, which performs intelligent routing (including service discovery and load balancing), authentication, monitoring, and rate limiting, then forwards the request to the open‑service. The open‑service aggregates responses from internal services and returns the result to the gateway, which finally responds to the user.

Key operational considerations include the added latency of an extra hop, the potential single‑point‑of‑failure (mitigated by placing an Nginx in front of the gateway), and the need to keep the gateway lightweight.

Basic gateway functions include intelligent routing, authentication (only for external requests), API monitoring, rate limiting, unified logging, and optional A/B testing.

Technical stack recommendation :

Programming language: Java + Groovy (Groovy allows dynamic addition of filters without restarting the gateway).

Microservice framework: Spring Boot.

Gateway component: Netflix Zuul.

Service registry: Consul.

Authentication: JWT.

Monitoring: Prometheus + Grafana.

Logging: Logback + ELK.

Load testing: JMeter.

An illustration (image) shows the overall microservice architecture with the gateway, open‑service, and individual services.

Javamicroservicesbackend developmentRoutingFiltersZuulservice gateway
Top Architect
Written by

Top Architect

Top Architect focuses on sharing practical architecture knowledge, covering enterprise, system, website, large‑scale distributed, and high‑availability architectures, plus architecture adjustments using internet technologies. We welcome idea‑driven, sharing‑oriented architects to exchange and learn together.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.