更新性能测试文档

taobao_model
tanghc 5 years ago
parent 1c4ff766df
commit e7daa46005
  1. 45
      doc/docs/files/90999_网关性能测试.md

@ -1,13 +1,13 @@
# 网关性能测试
**测试环境**
> 注意:记得关闭限流功能
**测试环境**
- 测试工具:[wrk](https://github.com/wg/wrk),[安装教程](https://www.cnblogs.com/quanxiaoha/p/10661650.html)
- 服务器:CentOS7(虚拟机,宿主机:macbookpro),内存:2G,CPU:1,核数:2核
- 运行环境:Java8、Mysql-5.7、Nacos-1.1.3
- 运行参数:
- 网关启动参数:
```
-verbose:gc -XX:+PrintGCDetails -XX:+PrintHeapAtGC -Xloggc:gc-zuul.log \
@ -15,7 +15,7 @@
-XX:+UseConcMarkSweepGC
```
- zuul配置:
- zuul配置(仅针对zuul,Spring Cloud Gateway没有做优化配置)
```properties
# 不校验时间,这样一个链接可以一直进行测试
@ -35,8 +35,6 @@ hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds=13000
logging.file=sop-gateway.log
```
以上配置仅针对zuul,Spring Cloud Gateway没有做优化配置
CentOS允许最大连接数
```
$ ulimit -n
@ -63,6 +61,21 @@ Requests/sec: 1441.96
Transfer/sec: 406.96KB
```
结果说明,下同:
```
8 threads and 200 connections (共8个测试线程,200个连接)
(平均值) (标准差) (最大值)(正负一个标准差所占比例)
Thread Stats Avg Stdev Max +/- Stdev
(延迟)
Latency 139.74ms 69.39ms 617.14ms 69.82%
(每秒请求数)
Req/Sec 182.12 55.74 343.00 66.24%
43391 requests in 30.09s, 11.96MB read (30.09秒内处理了43391个请求,耗费流量11.96MB)
Requests/sec: 1441.96 (QPS 1441.96,即平均每秒处理请求数为1441.96)
Transfer/sec: 406.96KB (平均每秒流量406.96KB)
```
- Spring Cloud Zuul测试结果
```
@ -114,3 +127,23 @@ Transfer/sec: 226.50KB
综上所述,Spring Cloud Gateway在没有优化的情况下,压测表现比zuul好,但zuul的数据表现也不差,但是出现超时现象,总的来说还是Spring Cloud Gateway具有优势。
附启动脚本:
`restart.sh`
```bash
echo "Stopping sop-gateway-1.0.0-SNAPSHOT.jar"
pid=`ps -ef | grep sop-gateway-1.0.0-SNAPSHOT.jar | grep -v grep | awk '{print $2}'`
if [ -n "$pid" ]
then
echo "kill -9 的id:" $pid
kill -9 $pid
fi
nohup java -jar -verbose:gc -XX:+PrintGCDetails -XX:+PrintHeapAtGC -Xloggc:gc.log \
-XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=128m -Xms1024m -Xmx1024m -Xmn256m -Xss256k -XX:SurvivorRatio=8\
-XX:+UseConcMarkSweepGC sop-gateway-1.0.0-SNAPSHOT.jar\
--spring.profiles.active=dev --server.port=8081 &
tail -f nohup.out
```
Loading…
Cancel
Save