websocket压测工具分享

分享一个个人开发的 websocket 压测工具: wsbench
提供 IOPS, P50, P90, P99 等指标
支持导出压测结果到 JSON 文件,配合脚本生成图表

NAME:
   wsbench - testing websocket server iops and latency

USAGE:
   wsbench [global options] command [command options] [arguments...]

COMMANDS:
   echo
   broadcast
   version
   help, h    Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --help, -h  show help

导出图表教程#

语言环境#

  • go
  • nodejs

安装依赖#

npm install pm2 -g
go install github.com/lxzan/wsbench@latest

环境变量#

export PATH=$PATH:$GOPATH/bin

开始#

git clone https://github.com/lxzan/go-websocket-testing.git
cd go-websocket-testing
make build
pm2 start ./bin/*
cd frontend
npm install
pm2 start index.js --watch
sh bench.sh

测试程序退出后,访问 http://localhost:8080

Go

本作品采用《CC 协议》,转载必须注明作者和本文链接