Giter VIP home page Giter VIP logo

go-websocket-benchmark's Introduction

Go-Websocket-Benchmark

  • support 1m-connections client
  • support 1m-connections nbio_mod_nonblocking server

1M-Connections-Benchmark For nbio

  • Run
git clone https://github.com/lesismal/go-websocket-benchmark.git
cd go-websocket-benchmark

# build
./script/build.sh

# start server
./script/server.sh nbio_mod_nonblocking 
# or
# ./script/server.sh nbio_mod_mixed

# start benchmark client
# -c connections
# -n benchmark times
./script/client.sh -f=nbio_mod_nonblocking -c=1000000 -n=5000000 -b=1024
# or 
# ./script/client.sh -f=nbio_mod_mixed -c=1000000 -n=5000000 -b=1024

Here is some 1M-Connections-Benchmark report on my ubuntu vm, the nbio non-blocking server use cpu 0-3 and SetMemoryLimit(2G), benchmark with 1k payload:

root@ubuntu:~/go-websocket-benchmark# ./script/client.sh -f=nbio_mod_nonblocking -c=1000000 -n=5000000 -b=1024
2023/05/30 16:04:51.048 [INF] NBIO[Benchmark-Client] start
2023/05/30 16:04:51 1000000 clients start connecting
2023/05/30 16:04:52 25890 clients connected
2023/05/30 16:04:53 69455 clients connected
2023/05/30 16:04:54 116592 clients connected
......
2023/05/30 16:05:20 999998 clients connected
2023/05/30 16:05:21 999998 clients connected
2023/05/30 16:05:21 1000000 clients connected
-------------------------
Benchmark: nbio_mod_nonblocking
Conns    : 1000000
Payload  : 1024
TOTAL    : 5000000 times
SUCCESS  : 5000000, 100.00%
FAILED   : 0, 0.00%
TPS      : 100672
TIME USED: 49.67s
MIN USED : 39.24us
AVG USED : 19.86ms
MAX USED : 242.16ms
TP50     : 18.56ms
TP75     : 26.04ms
TP90     : 34.24ms
TP95     : 39.64ms
TP99     : 52.16ms
CPU MIN  : 0.00%
CPU AVG  : 293.65%
CPU MAX  : 319.95%
MEM MIN  : 1.61G
MEM AVG  : 1.91G
MEM MAX  : 2.06G
-------------------------

Or just run:

./script/1m_conns_benchmark.sh
  • Clean
./script/clean.sh

Benchmark For All Frameworks

  • Run
git clone https://github.com/lesismal/go-websocket-benchmark.git
cd go-websocket-benchmark
./script/benchmark.sh
  • Clean
./script/clean.sh

Some benchmark result on my ubuntu vm:

--------------------------------
os:

Ubuntu 20.04.6 LTS \n \l

--------------------------------
cpu model:

model name	: AMD Ryzen 7 5800H with Radeon Graphics
--------------------------------
              total        used        free      shared  buff/cache   available
Mem:       16362568      396988    15151676        1636      813904    15656380
Swap:             0           0           0
--------------------------------
Framework Conns Total Success Failed Used CPU Avg MEM Avg Avg TPS TP50 TP90 TP99
gobwas 10000 1000000 1000000 0 6.70s 386.29% 90.04M 13.38ms 149157 8.84ms 29.87ms 72.26ms
gorilla 10000 1000000 1000000 0 4.48s 286.82% 257.43M 8.95ms 223121 7.80ms 15.78ms 26.51ms
gws 10000 1000000 1000000 0 4.23s 248.67% 160.78M 8.46ms 236251 7.38ms 14.70ms 25.91ms
gws_basedon_stdhttp 10000 1000000 1000000 0 4.36s 267.13% 264.81M 8.71ms 229483 7.65ms 15.24ms 25.59ms
nbio_basedon_stdhttp 10000 1000000 1000000 0 4.36s 280.86% 198.42M 8.71ms 229348 7.61ms 15.37ms 25.51ms
nbio_mod_blocking 10000 1000000 1000000 0 4.57s 310.62% 185.31M 9.13ms 218737 7.82ms 16.34ms 28.02ms
nbio_mod_mixed 10000 1000000 1000000 0 4.66s 312.51% 204.19M 9.30ms 214786 8.03ms 16.47ms 28.73ms
nbio_mod_nonblocking 10000 1000000 1000000 0 5.14s 292.00% 86.74M 10.27ms 194373 9.37ms 16.94ms 26.30ms
nhooyr 10000 1000000 1000000 0 6.60s 405.59% 565.03M 13.18ms 151436 11.17ms 22.42ms 47.47ms

TODO

  1. Add cpu/mem count to the result - done
  2. Auto save Charts/Markdown/Xls files - Markdown done
  3. Different Args
  4. Add more frameworks

go-websocket-benchmark's People

Contributors

lesismal avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.