---
title: "WebSocket Performance"
---

> Documentation Index
> Fetch the complete documentation index at: https://openarkstudio.github.io/arknet/llms.txt
> Use this file to discover all available pages before exploring further.

# WebSocket Performance

The charts were measured before the bundled Beast headers were removed. Standalone HTTP/WebSocket results apply only to that measured revision; current builds use Boost.

## Local Results

Release local loopback: 1024-byte binary messages, 16 clients, window 16 and
no extra application computation.

### WebSocket

![WebSocket throughput by IO model](/arknet/performance/assets/websocket-work0-throughput.svg)

![WebSocket p99 RTT by IO model](/arknet/performance/assets/websocket-work0-latency.svg)

- Four contexts/one thread each has the highest throughput median for both
  dependency combinations.
- Standalone's lowest p99 median belongs to four contexts/one thread each;
  Boost's belongs to two contexts/one thread each, whose run range overlaps
  four contexts/one thread each.
- With one client and window 1, one context/four threads has lower throughput
  medians than one context/one thread for both dependency combinations.

### WSS

![WSS throughput by IO model](/arknet/performance/assets/wss-work0-throughput.svg)

![WSS p99 RTT by IO model](/arknet/performance/assets/wss-work0-latency.svg)

- Four contexts/one thread each has the highest throughput median and lowest
  p99 median for both dependency combinations.
- WSS has lower throughput medians than plaintext WebSocket at the same load
  and thread model.

[Complete WebSocket report](/arknet/performance/websocket) · [Complete WSS report](/arknet/performance/wss)

[Test environment](/arknet/performance/overview) ·
[Metrics and statistics](/arknet/performance/methodology)

[Payload, batch and execution comparisons](/arknet/performance/dimensions#websocket) ·
[WSS comparison](/arknet/performance/dimensions#wss)

## Reproduce the IO Comparison

Build from the repository root with Boost.
With Visual Studio, add
`--config Release` to the build command and run the executable under
`benchmarks/Release/`. Windows executables end in `.exe`.

```sh
cmake -S . -B build-perf -DCMAKE_BUILD_TYPE=Release \
  -DARKNET_BUILD_BENCHMARKS=ON -DARKNET_ENABLE_SSL=OFF \
  -DARKNET_USE_BOOST_ASIO=ON
cmake --build build-perf --target arknet_loopback_benchmark --parallel 3
build-perf/benchmarks/arknet_loopback_benchmark \
  --protocol websocket --payload 1024 --clients 16 --window 16 \
  --io-model shared --io-threads 1 --work 0 --warmup 0.25 --seconds 1
```

This configuration uses 1024-byte binary messages, 16 clients, window 16 and
one context/one thread, writing JSON to standard output. Repeat each
configuration three times in fresh processes. Change `--io-threads` to 2 or 4
for a shared context, or use `--io-model sharded --io-threads 4` for four
contexts/one thread each. `--work 10000` adds 10,000 deterministic iterations
per server echo; `0` adds no application computation. The complete shell matrix
is in [Testing](/arknet/performance/methodology#performance-matrix). One connection remains
serialized; see [IO models](/arknet/concepts/io-models) for workload choices.

## Enable TLS

Use `--protocol wss --certs tests/certs` in a TLS-enabled build.
WSS verifies test certificates; see the [WSS report](/arknet/performance/wss) for
results and [TLS performance](/arknet/features/tls/performance) for the build commands.

This test measures binary echoes after upgrade, excluding browser scheduling,
upgrade rate, idle connections, compression, ping/pong, authentication, fan-out
and slow peers. The dependency combinations use different Asio/Beast versions, so differences
cannot be attributed solely to dependency selection.

See [testing](/arknet/project/testing),
[WebSocket tests](https://github.com/OpenArkStudio/arknet/blob/main/tests/websocket.cpp)
and [benchmark source](https://github.com/OpenArkStudio/arknet/blob/main/benchmarks/loopback.cpp).

Source: https://openarkstudio.github.io/arknet/features/websocket/performance/index.mdx
