Skills2026年5月4日·1 分钟阅读

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.

Agent 就绪

这个资产可以被 Agent 直接读取和安装

TokRepo 同时提供通用 CLI 命令、安装契约、metadata JSON、按适配器生成的安装计划和原始内容链接,方便 Agent 判断适配度、风险和下一步动作。

Native · 98/100策略:允许
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
Apache ShenYu
通用 CLI 安装命令
npx tokrepo install 0d469e44-4750-11f1-9bc6-00163e2b0d79

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

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产