Esta página se muestra en inglés. Una traducción al español está en curso.
ConfigsMay 4, 2026·3 min de lectura

Apache ShenYu — High-Performance Extensible API Gateway

Apache ShenYu is a Java-native API gateway with a plugin-based architecture supporting HTTP, gRPC, WebSocket, MQTT, and Dubbo protocols for microservice traffic management.

Introduction

Apache ShenYu (formerly Soul) is an asynchronous, high-performance, cross-language API gateway graduated from the Apache Software Foundation. It provides dynamic traffic management for microservice architectures through a plugin-based design that supports hot-plugging at runtime. ShenYu handles protocol translation, traffic control, authentication, and observability across HTTP, gRPC, WebSocket, Dubbo, and other protocols.

What Apache ShenYu Does

  • Routes and load-balances traffic across microservice instances with dynamic upstream discovery
  • Provides protocol proxy for HTTP, gRPC, Spring Cloud, Dubbo, SOFA, Tars, Motan, and WebSocket
  • Applies traffic governance including rate limiting, circuit breaking, and request rewriting through plugins
  • Offers a web-based admin dashboard for managing routes, selectors, rules, and plugin configurations
  • Supports hot-reloading of plugin chains and routing rules without gateway restarts

Architecture Overview

ShenYu is built on a reactive stack using Spring WebFlux and Netty for non-blocking I/O processing. Incoming requests pass through a plugin chain where each plugin (authentication, rate limiting, routing, etc.) processes the request in order. The Admin module manages configurations and synchronizes them to gateway nodes via WebSocket, HTTP long polling, or ZooKeeper/Nacos/etcd. Service discovery integrates with registries like Nacos, ZooKeeper, Consul, and Eureka to automatically register upstream endpoints.

Self-Hosting & Configuration

  • Requires JDK 8+ and a database backend (MySQL, PostgreSQL, or H2 for development)
  • Deploy the Admin module and one or more Gateway nodes as separate Spring Boot applications
  • Configure data synchronization strategy between Admin and Gateway (WebSocket is the default)
  • Connect to service registries by adding the corresponding ShenYu client dependency to your microservices
  • Customize plugin order and parameters through the Admin dashboard or REST API

Key Features

  • Plugin-based architecture with 30+ built-in plugins covering auth, monitoring, rate limiting, and protocol proxying
  • Multi-language support through HTTP proxy — backend services can be written in any language
  • Traffic replay and A/B testing capabilities through the traffic management plugin
  • Cluster deployment with consistent configuration sync across all gateway nodes
  • Apache Software Foundation governance with an active community and regular releases

Comparison with Similar Tools

  • Kong — Lua/OpenResty-based gateway with a large plugin ecosystem, but JVM teams may prefer ShenYu for its native Java integration
  • Apache APISIX — High-performance Nginx/Lua gateway with a focus on cloud-native deployments, while ShenYu is Java-native with deeper JVM ecosystem integration
  • Spring Cloud Gateway — Reactive gateway built on Spring, but lacks the plugin marketplace and protocol diversity of ShenYu
  • Envoy — C++-based proxy with strong service mesh integration, but requires more effort for custom business logic

FAQ

Q: How does ShenYu compare to a service mesh like Istio? A: ShenYu is an API gateway handling north-south traffic (external to internal), while Istio manages east-west traffic (service to service). They complement each other in a microservice architecture.

Q: Can I write custom plugins? A: Yes. ShenYu provides an SPI-based plugin mechanism. Implement the ShenyuPlugin interface, register it, and configure the execution order through the Admin dashboard.

Q: Does ShenYu support Kubernetes? A: Yes. Helm charts and Kubernetes deployment manifests are available. ShenYu can also integrate with Kubernetes service discovery natively.

Q: What is the performance overhead? A: ShenYu processes requests asynchronously using Netty and WebFlux. Benchmarks show sub-millisecond added latency per request under typical plugin configurations.

Sources

Discusión

Inicia sesión para unirte a la discusión.
Aún no hay comentarios. Sé el primero en compartir tus ideas.

Activos relacionados