为什么在我的基准测试中zuul的性能要优于网关?

问题描述

最近我已经使用官方测试程序“基准”对zuul和gateway进行了测试,但结果却有所不同。

zuul:spring-boot-2.0.0.RELEASE,spring-cloud-Finchley.RELEASE(原始版本:2.0.0.BUILD-SNAPSHOT,Finchley.BUILD-SNAPSHOT) 网关:spring-boot-2.3.2.RELEASE,spring-cloud-Hoxton.SR7(原始版本:2.1.2.RELEASE,Greenwich.BUILD-SNAPSHOT)

我只是对基准测试程序做了一些改动,以版本和端口为例!下游服务是官方的,测试工具是官方的,但结果如下(zuul为10000,网关为20000):

[root@sf161113 wrk]# ./wrk -t 10 -c 200 -d 30s http://10.19.161.113:20000/hello.txt
Running 30s test @ http://xxx:20000/hello.txt
  10 threads and 200 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    51.36ms   30.86ms 314.06ms   70.97%
    Req/Sec   405.00     86.79   820.00     71.51%
  121018 requests in 30.09s,19.97MB read
  Non-2xx or 3xx responses: 4
Requests/sec:   4021.26
Transfer/sec:    679.38KB
[root@sf161113 wrk]# ./wrk -t 10 -c 200 -d 30s http://10.19.161.113:10000/hello.txt
Running 30s test @ http://xxx:10000/hello.txt
  10 threads and 200 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    75.11ms   99.37ms   1.21s    87.01%
    Req/Sec   462.19    120.82     1.05k    68.24%
  137422 requests in 30.09s,21.65MB read
Requests/sec:   4567.38

我尝试了很多次!网关在一个请求中可能更快,但处理的请求却更少。怎么了?顺便说一句,我使用的VM具有4核和8G内存。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)