在对我的 node.js socket.io 应用程序进行性能测试时,它似乎无法处理所需数量的并发 websocket 请求。
我正在使用以下规范在 Docker 环境中测试应用程序:
CPU:2 内存:4 GB
该应用程序被精简到只接受带有 socket.io + express.js 的 websocket 连接的最低限度。
我在artillery.io的帮助下进行了测试,测试场景是:
config:
target: "http://127.0.0.1:5000"
phases:
- duration: 100
arrivalRate: 20
scenarios:
- engine: "socketio"
flow:
- emit:
channel: "echo"
data: "hello"
- think: 50
Run Code Online (Sandbox Code Playgroud)
报告:
Summary report @ 16:54:31(+0200) 2018-07-30
Scenarios launched: 2000
Scenarios completed: 101
Requests completed: 560
RPS sent: 6.4
Request latency:
min: 0.1
max: 3
median: 0.2
p95: 0.5
p99: 1.4
Scenario counts:
0: 2000 (100%) …Run Code Online (Sandbox Code Playgroud)