Skip to the content.

Protocols

Crankfire load-tests HTTP, WebSocket, Server-Sent Events and gRPC. One run uses one protocol, set with --protocol or protocol:. All four share the same scheduler, rate limiting, arrival models, load patterns, feeders, auth, thresholds and reports. Each one defines a single “request” differently, as described below.

Feature support

Feature HTTP WebSocket SSE gRPC
Rate, arrival models, load patterns ✅ ✅ ✅ ✅
Feeders ({{key}}) ✅ ✅ ✅ ✅
Placeholder default values ✅ — — —
Auth (Bearer token) header handshake header header authorization metadata
Weighted endpoints ✅ — — —
Request chaining (extractors) ✅ — — —
Retries, --log-errors ✅ — — —
Trace propagation ✅ ✅ ✅ ✅
Thresholds, dashboard, JSON and HTML reports ✅ ✅ ✅ ✅

HTTP

crankfire --target https://api.example.com/data \
  --method POST \
  --header "Content-Type=application/json" \
  --body '{"user":"test"}' \
  --concurrency 10 --total 500

One request is one HTTP exchange, and the response body is always read to the end. Latency covers feeder lookup, any token fetch, request building, the round trip and the full body download.

WebSocket

crankfire --protocol websocket \
  --target ws://localhost:8080/ws \
  --ws-messages ping \
  --ws-message-interval 500ms \
  --ws-receive-timeout 2s \
  --concurrency 10 --duration 30s
protocol: websocket
target: wss://chat.example.com/ws?room={{room}}
websocket:
  messages:
    - '{"type":"join","room":"{{room}}"}'
    - '{"type":"message","text":"hello"}'
  message_interval: 200ms
  receive_timeout: 2s
  handshake_timeout: 10s

One request goes through these steps:

  1. Take a pooled connection, or dial a new one. Dialing uses handshake_timeout, default 30s.
  2. Send each entry in messages as a text frame. If you set message_interval and there is more than one message, Crankfire pauses that long after every message, including the last.
  3. If receive_timeout > 0, read incoming messages until the window ends. The request always lasts the full window; it does not stop after a reply.

Behaviour to know about:

Server-Sent Events (SSE)

crankfire --protocol sse \
  --target "https://events.example.com/stream?topic={{topic}}" \
  --feeder-path topics.csv --feeder-type csv \
  --sse-read-timeout 10s \
  --sse-max-events 50 \
  --concurrency 20 --duration 2m

One request goes through these steps:

  1. Take a pooled stream, or open a new one. Crankfire sends a GET with Accept: text/event-stream, and a response other than 200 is a failure.
  2. Read events until max_events have arrived or read_timeout has passed, whichever comes first.

Behaviour to know about:

gRPC

crankfire --protocol grpc \
  --target localhost:50051 \
  --grpc-proto-file ./protos/hello.proto \
  --grpc-service helloworld.Greeter \
  --grpc-method SayHello \
  --grpc-message '{"name":"{{name}}"}' \
  --grpc-metadata "x-tenant=acme" \
  --grpc-timeout 2s \
  --concurrency 10 --duration 30s
protocol: grpc
target: orders.example.com:443
grpc:
  proto_file: ./protos/orders.proto
  service: shop.v1.OrderService
  method: CreateOrder
  message: '{"user_id":"{{user_id}}","sku":"{{sku}}"}'
  metadata:
    x-request-source: crankfire
  timeout: 2s
  tls: true

One request is one unary call. Streaming RPCs are not supported.

TLS options:

tls insecure Result
false any Plaintext (h2c)
true false TLS verified against the system roots
true true TLS with no certificate verification

A warning is printed whenever insecure: true is set with protocol: grpc, even when tls is off.

Protocol metrics

WebSocket, SSE and gRPC report extra counters. They appear in the dashboard, in the text report under Protocol Metrics:, and in JSON under protocol_metrics.<protocol>. Numeric values are summed over all requests.

Protocol Keys
websocket messages_sent, messages_received, bytes_sent, bytes_received, connection_duration_ms
sse events_received, bytes_received, connection_duration_ms
grpc messages_sent, messages_received, bytes_sent, bytes_received, status_code (always OK)

WebSocket and SSE record these counters for failed requests too. gRPC records them only for successful calls; failed calls appear under Status buckets.

crankfire --config sse.yml --json-output | jq '.protocol_metrics.sse.events_received'

Note: connection_duration_ms is summed over all requests, so it is not the duration of any one connection.

Status buckets

Failed requests are grouped by protocol and code. The groups appear in the text report, the dashboard and JSON (status_buckets). Successful requests never appear here.

Protocol Code Example
http Numeric status for responses >= 400 503
websocket WebSocket close code 1006
grpc gRPC status name, with underscores removed UNAVAILABLE, DEADLINEEXCEEDED
any Go error type name for transport and setup errors see below

Error-type codes:

Code Typical cause
ERROR HTTP transport error, including client timeouts and connection refused
WRAPERROR A wrapped setup error: feeder, request build, WebSocket handshake failure, most SSE read errors
STATUSERROR SSE connect returned a status other than 200. The status number is not kept.
ERRORSTRING Plain errors, including cancellation

Note: Error-type codes say which kind of failure happened, not why. Use --log-errors (HTTP only) to see each failure, or check the server’s logs.