13.2Spring Cloud Gateway简介

分类: Gateway API网关

Spring Cloud Gateway 简介

Spring Cloud Gateway 是 Spring Cloud 的 API 网关实现。本节将学习 Spring Cloud Gateway 的基本概念。

本节将学习:Gateway 是什么、核心概念、与 Zuul 对比,以及性能优势。

Gateway 是什么

定义

Spring Cloud Gateway 是 Spring Cloud 的 API 网关,基于 Spring WebFlux 和 Reactor 实现。

特点

Gateway 特点:

  • 基于 WebFlux
  • 非阻塞式
  • 高性能
  • 功能丰富

核心概念

核心组件

Gateway 核心概念:

  • Route:路由
  • Predicate:断言
  • Filter:过滤器

与 Zuul 对比

对比表

特性GatewayZuul
性能高(WebFlux)较低(Servlet)
功能丰富基础
维护活跃维护模式

性能优势

性能特点

性能优势:

  • 非阻塞式
  • 基于 WebFlux
  • 高性能

官方资源

本节小结

在本节中,我们学习了:

第一个是 Gateway 是什么。 Spring Cloud Gateway 是 API 网关。

第二个是核心概念。 Route、Predicate、Filter。

第三个是与 Zuul 对比。 Gateway 和 Zuul 的对比。

第四个是性能优势。 Gateway 的性能优势。

这就是 Spring Cloud Gateway 简介。了解 Gateway 的基本概念,是使用 Gateway 的基础。

在下一节,我们将学习 Gateway 核心概念。