gRPC
A gRPC step calls a method of a service: unary (one request, one response), server streaming, client streaming and bidirectional (bidi) streaming. You write the request message as JSON, and Spitfire turns it into protobuf using the schema. The schema comes either from the server's server reflection service or from .proto files you upload to the connection. Streaming methods also show the time to the first message, the per-message latency and the time between messages.
Creating the connection
Add a connection of type gRPC (Adding a connection), e.g. orders-grpc. Fields of this type:
- Address (host:port): required, e.g.
orders.internal:50051. - Authority: when the
:authorityheader must differ from the address (such as a virtual host behind a proxy). - Bearer token: sent on every call as
authorization: Bearer <token>metadata. A secret. - Separate connection per VU: each VU opens its own HTTP/2 connection.
- Shared connections (per runner): with Separate connection per VU off, the VUs of a runner share this many connections (default 8). A single connection hits the server's concurrent stream limit (often 100–128) and counts the wait as latency; behind an L4 load balancer every call also goes to one backend.
- .proto files: if reflection is on, leave it empty (The schema comes from server reflection. shows). If it is off, choose the service's
.protofiles together with the files they import. The controller compiles them on save; a compile error refuses the save.
For TLS see TLS settings.
Adding a step
- Add step → Protocol: gRPC, and pick your gRPC connection in Connection.
- The Method list is filled from the schema (Pick a method…); streaming methods show server stream, client stream or bidi stream. If Couldn't read the schema; type the method appears, type the method as
package.Service/Method(e.g.shop.v1.Orders/GetOrder). - Write the message in Request message (JSON). Fill in the template inserts an empty skeleton with the method's fields.
- Add Metadata if needed (e.g.
x-tenant: demo). - The Status check accepts the gRPC status name (
OK,NOT_FOUND, case-insensitive) or its numeric code.
{"id": "get-order", "name": "Get order", "protocol": "grpc", "connection": "orders-grpc",
"grpc": {"method": "shop.v1.Orders/GetOrder", "message": "{\"id\": \"{{$uuid}}\"}",
"metadata": [{"key": "x-tenant", "value": "demo"}]},
"checks": [{"type": "status", "value": "OK"}]}Streaming settings
When you pick a streaming method, the Streaming method section opens. One step is one stream.
| Setting | Description |
|---|---|
| Messages to send | Client and bidi: Repeat the message (the same message Count times; {{__MSG}} is the message's number, from 0) or Message list. Server streaming sends its message once. |
| Interval between messages | The wait between two messages (e.g. 100ms). |
| Keep the sending side open after the last message | Bidi, for servers that end the stream when the client closes its side. Set a response count or duration with it. |
| Responses to wait for | The stream ends after this many responses. Empty: until the server ends it. If the server ends earlier, the step fails as incomplete. |
| Stream duration | The client ends the stream after this; not an error. |
| Timeout (deadline) | Default: the test's request timeout plus this step's pacing. Exceeding it is DEADLINE_EXCEEDED. |
| Checks and extraction see | the last response (default) or every response, as a JSON array ($[0].id, $[9].text…). |
A bidi stream that sends ten messages, waits for ten responses and verifies the tenth:
{"id": "chat", "name": "Chat", "protocol": "grpc", "connection": "orders-grpc",
"grpc": {"method": "shop.v1.Chat/Talk", "message": "{\"text\": \"selam {{__MSG}}\"}",
"stream": {"count": 10, "interval": "100ms", "receive": 10, "body": "all"}},
"checks": [{"type": "jsonPath", "path": "$[9].text", "value": "selam 9"}]}The counts of sent and received messages are in the grpc-messages-sent / grpc-messages-received headers; checks can use them.
Metrics it produces
The common metrics are in Metrics of every step. For gRPC, req_duration is the call for unary and the whole stream for streaming; req_failed counts calls whose status is not OK.
| Metric | Meaning |
|---|---|
grpc_time_to_first_message |
From opening the stream to the first response |
grpc_message_latency |
Bidi only: each response is paired with the oldest unanswered message; right for servers that answer each message in order |
grpc_message_gap |
For responses that pair with nothing (server streaming, extra pushes): time since the previous response |
grpc_messages_sent, grpc_messages_received |
Counters |
On the run page, streaming steps appear in the gRPC streams table (Messages sent, Messages received, First message p95, Message latency p95, Time between messages p95). Threshold example: {"metric": "grpc_time_to_first_message", "expr": "p(95)<300"}.
Common problems
The general table of connection, auth and TLS errors: Protocols and connections.
| Symptom | Cause | Fix |
|---|---|---|
| The method list is empty, Couldn't read the schema; type the method or Could not read the gRPC schema. | Reflection is off and no .proto is uploaded, or the controller cannot reach the server. |
First Test. If it is green, upload the .proto files with their imports. |
A .proto save is refused with not found / could not resolve import |
An imported file is missing. | Select every file in the chain together (e.g. a shared common.proto). |
UNAUTHENTICATED or PERMISSION_DENIED |
Missing or wrong token. | Type the Bearer token again and save, or send the right header in the step's Metadata. |
DEADLINE_EXCEEDED on a streaming step |
The stream did not end before the timeout. | Set Responses to wait for or Stream duration; raise Timeout (deadline) if needed. |
The step fails with incomplete |
The server ended before Responses to wait for was reached. | Set the count to what the server really sends, or leave it empty. |
| p95 rises in steps as load grows while the server's CPU is low | Many VUs share few HTTP/2 connections and wait at the stream limit. | Raise Shared connections (per runner) or tick Separate connection per VU. |
The last row is the most common case: the server looks idle, yet latency climbs. In that case we first raise the connection count to 32 and repeat the same run.