Spring Cloud Gateway真的有那么差吗?
动机
已经不止一次看到“Spring Cloud Gateway性能比Zuul更差”的言论了,不少人人云亦云,来问我,既然如此,那Spring官方还开发Spring Cloud Gateway干嘛?难道仅仅是为了支持Zuul 1.x不支持的长连接、Web Socket吗?
故而写篇博客,纠正一下大家的错误观点。
开端
网上搜索了一下,说Spring Cloud Gateway性能比Zuul差的言论来自:http://www.servicemesh.cn/?/article/45
作者使用 ab 进行benchmark,操作非常标准。从结果来看,确实Spring Cloud Gateway比Zuul差了一大截。
但,让我们打开官方的Issue:Throughput problems when compared with Netflix Zuul and Nginx ,里面官方人员回答道:
reactor-netty has issues with http 1.0 and hence ab. reactor/reactor-netty#21
不妨跟踪到reactor/reactor-netty#21 ,看看说了啥:
As discussed recently about the issue raised on https://jira.spring.io/browse/SPR-14964, a very simple
ab-n1-c1http://localhost:8082/items/10on Spring + Reactor Netty based server block forever likely because Reactor Netty does not support HTTP 1.0.
里面说了,Reactor Netty不支持HTTP 1.0,而Spring Cloud Gateway依赖了 reactor-netty 。
也就是说——由于reactor-netty的bug,使用 ab 压测结果并不准确!
正确姿势
官方建议使用 wrk 进行benchmark测试。不仅如此,官方人员还十(丧)分(心)贴(病)心(狂)地创建了一个benchmark的项目:spring-cloud-gateway-bench ,其中对比了:
- Spring Cloud Gateway
- Zuul
- Linkerd
三者的性能。
思路非常简单:static 项目是一个使用Go语言编写的简单服务器;然后分别使用Gateway/Zuul/Linkerd来代理该服务的端点,并对比。
最终结果:
|
组件 |
RPS(request per second) |
|---|---|
|
Spring Cloud Gateway |
Requests/sec: 32213.38 |
|
Zuul |
Requests/sec: 20800.13 |
|
Linkerd |
Requests/sec: 28050.76 |
从结果可知,Spring Cloud Gateway的RPS是Zuul1的1.6倍!比Linkerd性能还好!
展望
- 本文的Zuul,指的是Zuul 1.x,是一个基于阻塞io的API Gateway。
- Spring Cloud Gateway是一个很有前途的项目,上手简单,功能也比较强大。
- Linkerd也是一个非常有前途的项目,是基于Scala实现的、目前市面上仅有的生产级别的Service Mesh(其他诸如Istio、Conduit暂时还不能用于生产)。
- Zuul已经发布了Zuul 2.x,基于Netty,也是非阻塞的,支持长连接,但Spring Cloud暂时还没有整合计划。
原文地址:https://www.cnblogs.com/puretuo/p/11287864.html
Spring Cloud Gateway真的有那么差吗?的更多相关文章
- 纠错帖:Zuul & Spring Cloud Gateway & Linkerd性能对比 (转载)
纠错帖:Zuul & Spring Cloud Gateway & Linkerd性能对比 Spring Cloud Spring Cloud Spring Cloud Gatew ...
- Spring Cloud gateway 网关四 动态路由
微服务当前这么火爆的程度,如果不能学会一种微服务框架技术.怎么能升职加薪,增加简历的筹码?spring cloud 和 Dubbo 需要单独学习.说没有时间?没有精力?要学俩个框架?而Spring C ...
- Spring Cloud Gateway actuator组建对外暴露RCE问题漏洞分析
Spring Cloud gateway是什么? Spring Cloud Gateway是Spring Cloud官方推出的第二代网关框架,取代Zuul网关.网关作为流量的,在微服务系统中有着非常作 ...
- API网关性能比较:NGINX vs. ZUUL vs. Spring Cloud Gateway vs. Linkerd API 网关出现的原因
API网关性能比较:NGINX vs. ZUUL vs. Spring Cloud Gateway vs. Linkerd http://www.infoq.com/cn/articles/compa ...
- Spring Cloud Gateway 之请求坑位[微服务IP不同请求会失败]
问题产生背景 在使用Spring Cloud Gateway过程中,希望配置多Routes映射不同的微服务,因为Gateway 和Zuul的访问路径不同(zuul 会带有服务service Id),造 ...
- 网关我选 Spring Cloud Gateway
网关可提供请求路由与组合.协议转换.安全认证.服务鉴权.流量控制与日志监控等服务.可选的网关有不少,比如 Nginx.高性能网关 OpenResty.Linkerd 以及 Spring Cloud G ...
- Spring Cloud Gateway(一):认识Spring Cloud Gateway
1.Spring Cloud Gateway 简介 Spring Cloud Gateway 系列目录 Spring Cloud Gateway(一):认识Spring Cloud Gateway S ...
- spring Cloud网关之Spring Cloud Gateway
Spring Cloud Gateway是什么?(官网地址:https://cloud.spring.io/spring-cloud-gateway/reference/html/) Spring C ...
- 快速突击 Spring Cloud Gateway
认识 Spring Cloud Gateway Spring Cloud Gateway 是一款基于 Spring 5,Project Reactor 以及 Spring Boot 2 构建的 API ...
随机推荐
- QTableWidget懒加载(动态加载)实现
在QTableWidget中加入一行行的数据,如果数据数量过多,滚动起来就会卡顿,插入数据时也会影响性能,为了解决这个问题,采用懒加载的方式,只在界面上显示10几条数据,填满界面.同时增加而外的竖直滚 ...
- LeetCode 88. 合并两个有序数组(Merge Sorted Array)
题目描述 给定两个有序整数数组 nums1 和 nums2,将 nums2 合并到 nums1 中,使得 num1 成为一个有序数组. 说明: 初始化 nums1 和 nums2 的元素数量分别为 m ...
- Java-JVM 运行时内存结构(Run-Time Data Areas)
Java 虚拟机定义了在程序执行期间使用的各种运行时数据区域. 其中一些数据区域所有线程共享,在 Java 虚拟机(JVM)启动时创建,仅在 Java 虚拟机退出时销毁. 还有一些数据区域是每个线程的 ...
- sklearn4_混合分类器
python机器学习-乳腺癌细胞挖掘(博主亲自录制视频) https://study.163.com/course/introduction.htm?courseId=1005269003&u ...
- cocos creator发布win10全屏缩放问题
当前2.2.1版本cocos creator发布的win32版本不是全屏的, https://forum.cocos.org/t/win-exe/80429 https://blog.csdn.net ...
- Haskell 安装
1.Ubuntu 安装过程中出现了一些问题: 1)W: An error occurred during the signature verification. The repository is n ...
- javascript之Screen(屏幕)对象
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- Python re 正则表达式【一】【转】
数量词的贪婪模式与非贪婪模式 正则表达式通常用于在文本中查找匹配的字符串.Python里数量词默认是贪婪的(在少数语言里也可能是默认非贪婪),总是尝试匹配尽可能多的字符:非贪婪的则相反,总是尝试匹配尽 ...
- Redis ==> 高级
一.发布订阅 Redis 发布订阅(pub/sub)是一种消息通信模式:发送者(pub)发送消息,订阅者(sub)接收消息. Redis 客户端可以订阅任意数量的频道. 下图展示了频道 channel ...
- jdk1.8-ArrayList源码分析
一:idea可以自动生成UML类图,ctrl+alt+u ArrayList类图 我没们看下类的继承关系 ) { ) { ) { )) )) newCapacity = minCapacity) ne ...