V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
The Go Programming Language
http://golang.org/
Go Playground
Go Projects
Revel Web Framework
Nazz

为了压测 websocket server 性能, 我写了一个命令行工具和生成图表脚本

  •  
  •   Nazz · Aug 24, 2023 · 1776 views
    This topic created in 980 days ago, the information mentioned may be changed or developed.

    仓库地址

    语言环境

    • go
    • nodejs

    安装依赖

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

    开始测试

    运行 5 轮测试, 最后取中位数

    make build
    pm2 start ./bin/*
    cd frontend
    npm install
    pm2 start index.js --watch
    sh bench.sh
    

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

    result

    2 replies    2023-08-24 12:27:03 +08:00
    Nazz
        1
    Nazz  
    OP
       Aug 24, 2023
    补充说明下, gorilla/websocket 和 nhooyr/websocket 未使用 stream api
    mrochcnnnnn
        2
    mrochcnnnnn  
       Aug 24, 2023
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1202 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 155ms · UTC 17:35 · PVG 01:35 · LAX 10:35 · JFK 13:35
    ♥ Do have faith in what you're doing.