基准测试报告
硬件环境
后端Mock服务所在服务器:
- CPU: 4核8线程 Intel Cascade Lake @ 3.0GHz
- RAM: 16G
网关节点所在服务器:
- CPU: 4核8线程 Intel Cascade Lake @ 3.0GHz
- RAM: 16G
测试工具占用资源很少,安装在网关节点服务器。
ShenYu 版本
- ShenYu Admin: 2.6.0
- ShenYu Bootstrap: 2.6.0
测试工具
wrk-4.2.0
测试用例说明
说明
- 使用 Mock 服务模拟一个平均响应时长 20ms ,响应报文约 2k 的接口
- 每次测试时长 3 分钟
- JDK版本: OpenJdk-1.8.0
- HTTP 请求端分别使用
NettyClient和WebClient进行测试 - 日志级别为WARN
- Apache ShenYu Bootstrap部署模式:单机部署
- Apache ShenYu Admin部署在mock服务器上。
JVM 配置
-Xmx 4g
-Xms 4g
-Xmn 1g
-Xss 512k
-XX: +DisableExplicitGC
-XX: LargePageSizeInBytes=128m
公共配置
- application.yml
matchCache:
selector:
selectorEnabled: true
initialCapacity: 10000 # initial capacity in cache
maximumSize: 10000 # max size in cache
rule:
initialCapacity: 10000 # initial capacity in cache
maximumSize: 65536 # max size in cache
trie:
enabled: true
childrenSize: 10000
pathVariableSize: 1000
pathRuleCacheSize: 1000
matchMode: antPathMatch
netty:
http:
# set to false, user can custom the netty tcp server config.
webServerFactoryEnabled: true
selectCount: 1
workerCount: 8
accessLog: false
serverSocketChannel:
soRcvBuf: 87380
soBackLog: 128
soReuseAddr: false
connectTimeoutMillis: 10000
writeBufferHighWaterMark: 65536
writeBufferLowWaterMark: 32768
writeSpinCount: 16
autoRead: false
allocType: "pooled"
messageSizeEstimator: 8
singleEventExecutorPerGroup: true
socketChannel:
soKeepAlive: false
soReuseAddr: false
soLinger: -1
tcpNoDelay: true
soRcvBuf: 87380
soSndBuf: 16384
ipTos: 0
allowHalfClosure: false
connectTimeoutMillis: 10000
writeBufferHighWaterMark: 65536
writeBufferLowWaterMark: 32768
writeSpinCount: 16
autoRead: false
allocType: "pooled"
messageSizeEstimator: 8
singleEventExecutorPerGroup: true
file:
enabled: false
maxSize : 10
cross:
enabled: false
logging:
level:
root: warn
org.springframework.boot: warn
org.apache.ibatis: warn
org.apache.shenyu.bonuspoint: warn
org.apache.shenyu.lottery: warn
org.apache.shenyu: warn
- logback.xml
<root level="WARN">
<appender-ref ref="ASYNC_STDOUT"/>
<appender-ref ref="ASYNC_FILE"/>
<appender-ref ref="ASYNC_ERROR_FILE"/>
</root>
WebClient配置
httpclient:
strategy: webClient # netty
connectTimeout: 45000 # 45000
responseTimeout: 3000 # 3000
readerIdleTime: 3000 # 3000
writerIdleTime: 3000 # 3000
allIdleTime: 3000 # 3000
readTimeout: 3000 # 3000
writeTimeout: 3000 # 3000
wiretap: false # false
keepAlive: false # false
maxInMemorySize: 1 # 1
pool:
type: ELASTIC # ELASTIC
name: proxy # proxy
maxConnections: 16 # 16
acquireTimeout: 45000 # 45000
maxIdleTime: 3000 # 3000