项目作者: oatpp

项目描述 :
Websocket Client and Server for benchmarks with Millions of concurrent connections.
高级语言: C++
项目地址: git://github.com/oatpp/benchmark-websocket.git
创建时间: 2019-03-24T22:53:44Z
项目社区:https://github.com/oatpp/benchmark-websocket

开源协议:Apache License 2.0

下载


benchmark-websocket Build Status

About recent results read here: 5 Million WebSockets

See also:

Overview

This repo contains both server and client used in oatpp-websocket-benchmarks.
Both server and client are implemented based on oatpp Async API and oatpp-coroutines

Repo structure

  1. |- client/
  2. | |- src/ // client source code
  3. | |- CMakeLists.txt // client CMakeLists.txt
  4. |
  5. |- server/
  6. | |- src/ // server source code
  7. | |- CMakeLists.txt // server CMakeLists.txt
  8. |
  9. |- prepare.sh // prepare script - will clone oatpp and oatpp-websocket. build and install.
  10. |- sock-config.sh // configure required sysctl(s)

Reproduce latest benchmark

Create two n1-highmem-16 (16 vCPUs, 104 GB memory) - Debian GNU/Linux 9 instances in same VPC on Google Cloud.

Execute the following commands for both instances (SSH).

  • Install git
  1. $ sudo su
  2. $ apt-get update
  3. ...
  4. $ apt-get install -y git
  5. ...
  1. $ git clone https://github.com/oatpp/benchmark-websocket
  2. ...
  3. $ cd benchmark-websocket
  • Install oatpp and oatpp-websocket modules (run ./prepare.sh script).
  1. $ ./prepare.sh
  • Configure environment (run ./sock-config-5m.sh script)
  1. $ ./sock-config-5m.sh
  2. $ ulimit -n 6000000

Build and Run Server

Commands for server instance only:

  • Build server
  1. $ cd server/build/
  2. $ cmake ..
  3. $ make
  • Run server
  1. $ ./wsb-server-exe --tp 16 --tio 8 --pc 500

where:
--tp - number of data-processing threads.
--tio - number of I/O workers.
--pc - number of ports to listen to.

Build and Run Client

Commands for client instance only:

  • Build client
  1. $ cd client/build/
  2. $ cmake ..
  3. $ make
  • Run client
  1. $ ./wsb-client-exe --tp 16 --tio 8 -h <server-private-ip> --socks-max 5000000 --socks-port 10000 --si 1000 --sf 30 --pc 500

where:
--tp - number of data-processing threads.
--tio - number of I/O workers.
-h <server-private-ip> - substitute private-ip of server instance here.
--socks-max - how many client connections to establish.
--socks-port - how many client connections per port.
--si 1000 --sf 30 - control how fast clients will connect to server. Here - each 1000 iterations sleep for 30 milliseconds.
--pc - number of available server ports to connect to.

Note - clients will not start load until all clients are connected.
Note - client app will fail with assertion if any of clients has failed.