
HTTP vs UDP Overlay: An Agent Benchmarking Method
An HTTP-versus-overlay benchmark is useful only when it compares the same route, security policy, payload, and connection lifecycle. Otherwise, it measures topology choices rather than transport behavior.
This guide defines a reproducible benchmark plan for agent communication. It deliberately avoids publishing universal winner numbers: a direct path, relay path, cold TLS handshake, warm HTTP/2 connection, and persistent encrypted tunnel are different experiments.
Start with the Decision You Need to Make
Write the operational question before choosing metrics. Typical questions include:
- What is the cold-start cost of contacting an agent for the first time?
- How does a warm connection behave under normal request volume?
- What changes when the target is behind NAT or direct traversal fails?
- How much CPU and memory does each option use at expected concurrency?
- How quickly does communication recover after an IP change or process restart?
Do not combine these into one headline score. A team choosing an interactive control channel may care about warm tail latency and recovery, while a bulk-transfer workload may care about sustained throughput and CPU per byte.
Define a Fair Test Matrix
| Dimension | Cases to record | Why it matters |
|---|---|---|
| Topology | Same host, LAN, cross-region, direct overlay, relay overlay | Path length often dominates protocol overhead |
| Lifecycle | Cold setup, warm reuse, reconnect, failover | Persistent and per-request designs pay costs at different times |
| Payload | Small control message, typical JSON, large transfer | Framing and copies scale differently |
| Concurrency | 1, expected steady state, expected peak | Queues and multiplexing appear under load |
| Security | Equivalent authentication and encryption requirements | Plaintext versus encrypted is not a fair comparison |
| Delivery | Best effort, acknowledgement, retry, persistence | Stronger guarantees consume resources |
Separate Reachability from Transport
HTTP can work across any network that provides a route to the server. That route might come from public ingress, a reverse proxy, a VPN, a private link, or an overlay. Pilot includes registry and beacon coordination to attempt direct UDP traversal and use encrypted relay fallback when needed.
Measure these as distinct paths:
- Reachable HTTP service: the client already has a route to the server.
- Direct Pilot path: coordination succeeds and payloads travel peer to peer.
- Relayed Pilot path: direct traversal fails and encrypted payloads use the relay.
- HTTP plus reachability infrastructure: include the proxy, tunnel, or private-network path actually required in production.
This prevents an invalid conclusion such as attributing an extra network hop to HTTP framing or crediting UDP for infrastructure that was omitted from the baseline.
Collect Metrics that Explain the Result
- Connection readiness: time until the application can exchange an authenticated message.
- Latency: p50, p95, and p99 for a fixed payload and concurrency.
- Throughput: useful application bytes per second, not wire bytes alone.
- Resource use: CPU time, resident memory, allocations, file descriptors, and network bytes.
- Reliability: error rate, timeout rate, reconnect time, and recovery after path loss.
- Path state: direct or relayed, plus any broker, proxy, or gateway hop.
Report sample count, warm-up policy, confidence intervals, host specifications, operating-system versions, client versions, and every non-default setting. Retain raw observations instead of publishing only an aggregate table.
A Reproducible Procedure
- Provision identical client and server hosts and record their configuration.
- Measure baseline path latency and packet loss without the application protocol.
- Apply equivalent encryption, identity, and authorization requirements.
- Run cold and warm cases in separate processes.
- Randomize candidate order and repeat enough times to show variation.
- Capture client, server, coordination, gateway, broker, and relay telemetry where applicable.
- Publish the harness, configuration, raw output, and analysis script with the result.
A benchmark that cannot be rerun is an observation, not a durable product claim. If some component is private, label the result as internal and avoid presenting it as an independently reproducible comparison.
Using Pilot's Built-in Connectivity Benchmark
Pilot includes a benchmark command for exercising the Pilot path against a target agent. Use it to measure your own deployment, and retain its output with the route state and versions used:
# Run against a target Pilot address in your environment
pilotctl bench 1:0001.0002.0003
This command does not create a complete HTTP comparison by itself. A fair cross-protocol study also needs a retained HTTP harness with equivalent payload handling, connection reuse, authentication, encryption, and reporting.
How to Interpret the Outcome
If both candidates reuse warm connections over the same physical route, small agent messages may be dominated by network round-trip time. A relay or proxy hop may matter more than framing. For sustained transfers, congestion control, copies, runtime behavior, and host limits become more visible.
The result should inform an architecture decision, not produce a universal league table. HTTP supplies an application interface over a reachable path. Pilot supplies identity-aware reachability and encrypted paths that can carry existing application protocols. Compare the complete systems required for your deployment.
For that broader responsibility map, read where Pilot fits with TCP, gRPC, and NATS.
Benchmark Your Actual Route
Start with one representative service, preserve the harness and raw output, and compare cold, warm, direct, and relayed paths separately.
View the Pilot source