Echo (WebSocket)

Measures WebSocket echo throughput. Each connection upgrades via HTTP/1.1, then sends text messages and receives echoes. Each echo counts as one completed response.

Connections: 512, 4,096, 16,384 Pipeline: 16 (messages in flight per connection)

Workload

  1. Open TCP connection to port 8080
  2. Send HTTP/1.1 upgrade request to /ws
  3. After receiving 101 Switching Protocols, switch to WebSocket framing
  4. Send text frames containing "hello", receive echo frames
  5. Measure messages per second

What it measures

  • WebSocket upgrade handshake performance
  • WebSocket frame parsing and construction efficiency
  • Echo round-trip latency under load
  • Connection scalability for real-time workloads

Expected upgrade request/response

GET /ws HTTP/1.1
Host: localhost:8080
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==
Sec-WebSocket-Version: 13
HTTP/1.1 101 Switching Protocols
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=

Parameters

ParameterValue
Endpoint/ws (WebSocket upgrade)
Connections512, 4,096, 16,384
Pipeline16 (messages in flight)
Message"hello" (5 bytes, text frame)
Duration5s
Runs3 (best taken)
Load generatorgcannon --ws