Benchmark Results

Performance measurements for the a2a-protocol-sdk Rust implementation, generated by Criterion.rs statistical benchmarking.

Note: These numbers were collected on CI runners (ubuntu-latest). Absolute values will vary by hardware. Use these for relative comparisons between operations and for regression detection across releases — not as guarantees of production performance on your specific hardware.

To reproduce on your own machine: cargo bench -p a2a-benchmarks

Last updated: 2026-10-26 03:04 UTC
Rust version: rustc 1.99.1 (58cf8f9c3 2026-10-13)
Platform: Linux-x86_64

Feature set: these figures were measured with OpenTelemetry instrumentation, a default feature of the SDK crates since 0.15.0. docs/readiness-bar.md measured default tracing and otel, with nothing installed, at 4.6–6.6% of the CPU time of a blocking send.

Interactive dashboard: See the Benchmark Dashboard for charts, visual comparisons, and drill-down analysis of these results.

Transport Throughput

End-to-end HTTP round-trip latency through JSON-RPC and REST transports. All measurements use loopback (127.0.0.1) to isolate SDK overhead from network latency.

BenchmarkMedian
transport_jsonrpc_send/single_message165.0 µs
transport_jsonrpc_stream/stream_drain175.2 µs
transport_payload_scaling/jsonrpc_send/1024168.0 µs
transport_payload_scaling/jsonrpc_send/102400310.2 µs
transport_payload_scaling/jsonrpc_send/10485761.71 ms
transport_payload_scaling/jsonrpc_send/16384201.1 µs
transport_payload_scaling/jsonrpc_send/256165.2 µs
transport_payload_scaling/jsonrpc_send/4096178.1 µs
transport_payload_scaling/jsonrpc_send/64163.3 µs
transport_rest_send/single_message163.4 µs
transport_rest_stream/stream_drain167.3 µs

Protocol Overhead

Serialization and deserialization cost per A2A type. This is the baseline tax every message pays regardless of transport.

Includes protocol/payload_scaling benchmarks that measure pure serde cost from 64B to 1MB — the correct regression detection target for serialization changes. Also compares serde_json::to_vec vs SerBuffer (thread-local reuse) and from_slice vs from_str (borrowed deserialization) paths.

BenchmarkMedian
protocol_batch/deserialize_tasks/1989 ns
protocol_batch/deserialize_tasks/1011.3 µs
protocol_batch/deserialize_tasks/100118.2 µs
protocol_batch/deserialize_tasks/5058.6 µs
protocol_batch/serialize_tasks/1316 ns
protocol_batch/serialize_tasks/102.5 µs
protocol_batch/serialize_tasks/10022.8 µs
protocol_batch/serialize_tasks/5011.2 µs
protocol_jsonrpc_envelope/deserialize_request655 ns
protocol_jsonrpc_envelope/deserialize_response1.3 µs
protocol_jsonrpc_envelope/serialize_request212 ns
protocol_jsonrpc_envelope/serialize_response366 ns
protocol_payload_scaling/from_slice/1024444 ns
protocol_payload_scaling/from_slice/10240018.4 µs
protocol_payload_scaling/from_slice/1048576190.5 µs
protocol_payload_scaling/from_slice/163843.2 µs
protocol_payload_scaling/from_slice/256314 ns
protocol_payload_scaling/from_slice/4096977 ns
protocol_payload_scaling/from_slice/64283 ns
protocol_payload_scaling/from_str/1024347 ns
protocol_payload_scaling/from_str/10240014.9 µs
protocol_payload_scaling/from_str/1048576153.9 µs
protocol_payload_scaling/from_str/163842.5 µs
protocol_payload_scaling/from_str/256244 ns
protocol_payload_scaling/from_str/4096769 ns
protocol_payload_scaling/from_str/64218 ns
protocol_payload_scaling/ser_buffer/1024688 ns
protocol_payload_scaling/ser_buffer/10240059.9 µs
protocol_payload_scaling/ser_buffer/1048576618.7 µs
protocol_payload_scaling/ser_buffer/163849.5 µs
protocol_payload_scaling/ser_buffer/256216 ns
protocol_payload_scaling/ser_buffer/40962.4 µs
protocol_payload_scaling/ser_buffer/64114 ns
protocol_payload_scaling/to_vec/1024755 ns
protocol_payload_scaling/to_vec/10240058.1 µs
protocol_payload_scaling/to_vec/1048576596.6 µs
protocol_payload_scaling/to_vec/163849.6 µs
protocol_payload_scaling/to_vec/256292 ns
protocol_payload_scaling/to_vec/40962.5 µs
protocol_payload_scaling/to_vec/64133 ns
protocol_stream_events/artifact_update_deserialize509 ns
protocol_stream_events/artifact_update_serialize185 ns
protocol_stream_events/status_update_deserialize369 ns
protocol_stream_events/status_update_serialize88 ns
protocol_type_serde/agent_card_deserialize1.2 µs
protocol_type_serde/agent_card_serialize411 ns
protocol_type_serde/message_deserialize/217585 ns
protocol_type_serde/message_serialize/217218 ns
protocol_type_serde/task_deserialize/278937 ns
protocol_type_serde/task_serialize/278323 ns

Task Lifecycle

TaskStore and EventQueue operations — the backbone of task management.

BenchmarkMedian
lifecycle_e2e/send_and_complete166.9 µs
lifecycle_e2e/stream_and_drain198.5 µs
lifecycle_queue/write_read/11.2 µs
lifecycle_queue/write_read/107.3 µs
lifecycle_queue/write_read/10074.4 µs
lifecycle_queue/write_read/5036.9 µs
lifecycle_store_get/lookup_in_1000402 ns
lifecycle_store_list/filtered_page_50_of_25022.5 µs
lifecycle_store_save/single_task705 ns

Concurrent Agents

Scaling behavior under parallel load — how latency changes as concurrency increases from 1 to 64 simultaneous operations.

BenchmarkMedian
concurrent_mixed/send_then_get249.3 µs
concurrent_sends/jsonrpc/1200.2 µs
concurrent_sends/jsonrpc/161.18 ms
concurrent_sends/jsonrpc/4365.4 µs
concurrent_sends/jsonrpc/644.59 ms
concurrent_store/save_and_get/124.3 µs
concurrent_store/save_and_get/1667.1 µs
concurrent_store/save_and_get/429.6 µs
concurrent_store/save_and_get/64190.3 µs
concurrent_streams/jsonrpc/1202.4 µs
concurrent_streams/jsonrpc/161.18 ms
concurrent_streams/jsonrpc/4369.9 µs
concurrent_streams/jsonrpc/644.44 ms

Realistic Workloads

Production-like usage patterns: multi-turn conversations, mixed payloads, interceptor chains, and connection reuse vs per-request clients.

BenchmarkMedian
realistic_complex_card/deserialize/12.0 µs
realistic_complex_card/deserialize/1010.2 µs
realistic_complex_card/deserialize/10097.6 µs
realistic_complex_card/deserialize/5049.4 µs
realistic_complex_card/serialize/1774 ns
realistic_complex_card/serialize/102.9 µs
realistic_complex_card/serialize/10023.1 µs
realistic_complex_card/serialize/5011.9 µs
realistic_connection/new_client_per_request277.9 µs
realistic_connection/reused_client167.3 µs
realistic_history_serde/deserialize/11.1 µs
realistic_history_serde/deserialize/104.3 µs
realistic_history_serde/deserialize/208.1 µs
realistic_history_serde/deserialize/52.5 µs
realistic_history_serde/deserialize/5019.7 µs
realistic_history_serde/serialize/1444 ns
realistic_history_serde/serialize/101.8 µs
realistic_history_serde/serialize/203.3 µs
realistic_history_serde/serialize/51.1 µs
realistic_history_serde/serialize/507.5 µs
realistic_interceptor_chain/interceptors/0161.7 µs
realistic_interceptor_chain/interceptors/1167.8 µs
realistic_interceptor_chain/interceptors/10168.8 µs
realistic_interceptor_chain/interceptors/5168.6 µs
realistic_multi_turn/sequential/1168.7 µs
realistic_multi_turn/sequential/101.74 ms
realistic_multi_turn/sequential/3520.5 µs
realistic_multi_turn/sequential/5872.7 µs
realistic_payload_complexity/large_metadata_10kb352.0 µs
realistic_payload_complexity/mixed_parts193.1 µs
realistic_payload_complexity/nested_metadata_10218.0 µs
realistic_payload_complexity/simple_text168.1 µs

Error Paths

Cost of error handling — comparing happy path latency to error path latency. Production systems spend significant time on error paths; benchmarking only the happy path gives an incomplete picture.

BenchmarkMedian
errors_happy_vs_error/error_path164.1 µs
errors_happy_vs_error/happy_path163.6 µs
errors_malformed_request/invalid_json65.3 µs
errors_malformed_request/wrong_content_type64.2 µs
errors_task_not_found/get_nonexistent_task73.2 µs

Streaming & Backpressure

Stream throughput under varying event volumes and consumer speeds. Reveals buffering and flow-control overhead that synthetic single-event tests miss.

The default broadcast channel capacity is 256 events (raised from 64 in v0.5.0). Deployments with >256 events/task can set a higher value with RequestHandlerBuilder::with_event_queue_capacity(). Since 0.15.0 a stream that falls behind catches up from the task's event log (the in-memory stores keep the last 512 events of a task by default), so a larger queue avoids the catch-up reads rather than being the only protection against streamLagged.

BenchmarkMedian
backpressure_append_volume/discard_store_252_events1.12 ms
backpressure_append_volume/discard_store_27_events283.3 µs
backpressure_append_volume/discard_store_3_events182.4 µs
backpressure_append_volume/discard_store_502_events2.09 ms
backpressure_append_volume/discard_store_52_events384.7 µs
backpressure_append_volume/discard_store_7_events199.2 µs
backpressure_append_volume/sqlite_store_252_events60.06 ms
backpressure_append_volume/sqlite_store_27_events7.33 ms
backpressure_append_volume/sqlite_store_3_events1.92 ms
backpressure_append_volume/sqlite_store_502_events144.54 ms
backpressure_append_volume/sqlite_store_52_events13.97 ms
backpressure_append_volume/sqlite_store_7_events3.90 ms
backpressure_append_volume/task_store_252_events1.25 ms
backpressure_append_volume/task_store_27_events303.4 µs
backpressure_append_volume/task_store_3_events197.4 µs
backpressure_append_volume/task_store_502_events2.24 ms
backpressure_append_volume/task_store_52_events424.8 µs
backpressure_append_volume/task_store_7_events216.5 µs
backpressure_concurrent_streams/streams/1222.8 µs
backpressure_concurrent_streams/streams/161.54 ms
backpressure_concurrent_streams/streams/4446.9 µs
backpressure_slow_consumer/1ms_delay27.82 ms
backpressure_slow_consumer/5ms_delay80.03 ms
backpressure_slow_consumer/fast_consumer240.6 µs
backpressure_stream_volume/252_events1.31 ms
backpressure_stream_volume/27_events311.8 µs
backpressure_stream_volume/3_events193.2 µs
backpressure_stream_volume/502_events2.40 ms
backpressure_stream_volume/52_events436.1 µs
backpressure_stream_volume/7_events220.1 µs
backpressure_timer_calibration/sleep_1ms_actual2.11 ms
backpressure_timer_calibration/sleep_5ms_actual6.14 ms

Data Volume Scaling

TaskStore performance at realistic data volumes (1K to 100K tasks). Shows how store operations scale as data accumulates over time.

BenchmarkMedian
data_volume_concurrent_reads/get/121.7 µs
data_volume_concurrent_reads/get/1628.7 µs
data_volume_concurrent_reads/get/422.5 µs
data_volume_concurrent_reads/get/6460.6 µs
data_volume_get/lookup/1000411 ns
data_volume_get/lookup/10000414 ns
data_volume_get/lookup/100000198 ns
data_volume_history_depth/save_with_turns/13.2 µs
data_volume_history_depth/save_with_turns/107.8 µs
data_volume_history_depth/save_with_turns/2012.8 µs
data_volume_history_depth/save_with_turns/54.7 µs
data_volume_history_depth/save_with_turns/5024.3 µs
data_volume_list/filtered_page_50/100022.7 µs
data_volume_list/filtered_page_50/1000022.4 µs
data_volume_list/filtered_page_50/10000022.6 µs
data_volume_save/after_prefill/01.8 µs
data_volume_save/after_prefill/10001.3 µs
data_volume_save/after_prefill/100001.4 µs
data_volume_save/after_prefill/500001.3 µs

Memory Overhead

Wall-clock time per operation, in nanoseconds, with a counting allocator (#[global_allocator]) installed. Each iteration counts its heap allocations, and the benchmark asserts that the count stays within 5% of a figure measured once beforehand, but the counts are not published: Criterion records the elapsed time. Read these rows as ns per operation, not as allocation counts or bytes.

MetricUnit
*_alloc_countns per operation (the allocation count is asserted, not reported)
*_bytes_per_payloadns per operation (the bytes allocated are asserted, not reported)
BenchmarkMedian (ns)
memory_bytes_per_payload/serialize_bytes/1024515
memory_bytes_per_payload/serialize_bytes/163845635
memory_bytes_per_payload/serialize_bytes/256200
memory_bytes_per_payload/serialize_bytes/40961507
memory_bytes_per_payload/serialize_bytes/64112
memory_deserialize/agent_card_alloc_count1111
memory_deserialize/task_alloc_count949
memory_history_scaling/deserialize_allocs/11160
memory_history_scaling/deserialize_allocs/104280
memory_history_scaling/deserialize_allocs/208178
memory_history_scaling/deserialize_allocs/52495
memory_history_scaling/deserialize_allocs/5019225
memory_history_scaling/serialize_allocs/1347
memory_history_scaling/serialize_allocs/101485
memory_history_scaling/serialize_allocs/202752
memory_history_scaling/serialize_allocs/5866
memory_history_scaling/serialize_allocs/506149
memory_serialize/agent_card_alloc_count351
memory_serialize/task_alloc_count248

Cross-Language Comparison

Rust-side criterion baselines for the workloads in benches/cross_language/. Every row below is this SDK only. The measured cross-SDK comparison — this SDK's server against the official Python SDK's server — is on Cross-Language Benchmark.

BenchmarkMedian
cross_language_concurrent_50/rust3.89 ms
cross_language_echo_roundtrip/rust162.8 µs
cross_language_minimal_overhead/rust154.9 µs
cross_language_serialize_agent_card/rust_deserialize1.1 µs
cross_language_serialize_agent_card/rust_roundtrip1.5 µs
cross_language_serialize_agent_card/rust_serialize379 ns
cross_language_stream_events/rust193.8 µs

Enterprise Scenarios

Workloads modeled on deployment patterns, run in one process over loopback: multi-tenant isolation, push notification management, eviction under memory pressure, rate limiting, CORS handling, read/write mix ratios, and large conversation histories.

BenchmarkMedian
enterprise_cancel_task/send_then_cancel253.7 µs
enterprise_client_interceptors/interceptors/0166.0 µs
enterprise_client_interceptors/interceptors/1167.4 µs
enterprise_client_interceptors/interceptors/10167.9 µs
enterprise_client_interceptors/interceptors/5168.0 µs
enterprise_cors/options_preflight48.8 µs
enterprise_eviction/save_at_capacity/100886 ns
enterprise_eviction/save_at_capacity/1000893 ns
enterprise_eviction/save_at_capacity/10000888 ns
enterprise_eviction/sweep_duration/100142 ns
enterprise_eviction/sweep_duration/1000145 ns
enterprise_eviction/sweep_duration/10000176 ns
enterprise_handler_limits/default_limits165.6 µs
enterprise_handler_limits/metadata_rejection90.2 µs
enterprise_handler_limits/tight_limits169.0 µs
enterprise_large_history/deserialize/10038.9 µs
enterprise_large_history/deserialize/20075.8 µs
enterprise_large_history/deserialize/500186.1 µs
enterprise_large_history/serialize/10015.3 µs
enterprise_large_history/serialize/20027.9 µs
enterprise_large_history/serialize/50068.5 µs
enterprise_large_history/store_save/10013.3 µs
enterprise_large_history/store_save/20028.1 µs
enterprise_large_history/store_save/50069.7 µs
enterprise_list_tasks/page_size/10131.1 µs
enterprise_list_tasks/page_size/25198.1 µs
enterprise_list_tasks/page_size/50310.7 µs
enterprise_multi_tenant/concurrent_tenant_saves/123.9 µs
enterprise_multi_tenant/concurrent_tenant_saves/1037.2 µs
enterprise_multi_tenant/concurrent_tenant_saves/100145.7 µs
enterprise_multi_tenant/concurrent_tenant_saves/5085.1 µs
enterprise_multi_tenant/tenant_isolation_check/1409 ns
enterprise_multi_tenant/tenant_isolation_check/10405 ns
enterprise_multi_tenant/tenant_isolation_check/100405 ns
enterprise_multi_tenant/tenant_isolation_check/50404 ns
enterprise_push_config/get230 ns
enterprise_push_config/list_per_task/1150 ns
enterprise_push_config/list_per_task/101.0 µs
enterprise_push_config/list_per_task/508.4 µs
enterprise_push_config/set1.1 µs
enterprise_rate_limiting/no_rate_limit169.5 µs
enterprise_rate_limiting/with_rate_limit172.3 µs
enterprise_rw_mix/0r_100w202.1 µs
enterprise_rw_mix/100r_0w44.0 µs
enterprise_rw_mix/25r_75w174.2 µs
enterprise_rw_mix/50r_50w127.5 µs
enterprise_rw_mix/75r_25w85.4 µs

Production Scenarios

Full end-to-end workflows exercising the complete SDK pipeline in scenarios modeled on real deployments (single process, loopback): task reconnection, cold start latency, concurrent race conditions, multi-context orchestration, push config lifecycle, parallel agent bursts, and dispatch routing overhead isolation.

BenchmarkMedian
production_agent_burst/agents/102.73 ms
production_agent_burst/agents/10026.94 ms
production_agent_burst/agents/5013.12 ms
production_agent_burst_client_sharing/per_agent_client_agents/102.70 ms
production_agent_burst_client_sharing/per_agent_client_agents/10027.86 ms
production_agent_burst_client_sharing/per_agent_client_agents/5013.66 ms
production_agent_burst_client_sharing/shared_client_agents/102.33 ms
production_agent_burst_client_sharing/shared_client_agents/10022.66 ms
production_agent_burst_client_sharing/shared_client_agents/5011.28 ms
production_cancel_subscribe_race/concurrent_cancel_and_subscribe729.2 µs
production_cold_start/first_request342.6 µs
production_cold_start/steady_state166.6 µs
production_dispatch_routing/direct_handler_invoke49.0 µs
production_dispatch_routing/full_http_roundtrip168.0 µs
production_e2e_orchestration/7_step_workflow1.36 ms
production_push_config/delete_roundtrip159.4 µs
production_push_config/get_roundtrip72.6 µs
production_push_config/list_roundtrip78.9 µs
production_push_config/set_roundtrip80.2 µs
production_subscribe_to_task/send_then_subscribe297.4 µs

Advanced Scenarios

SDK capabilities exercising previously-unbenchmarked paths: tenant resolver overhead, agent card hot-reload and discovery, subscribe fan-out for reconnection bursts, streaming artifact accumulation cost, pagination full walk, and extended agent card round-trip.

BenchmarkMedian
advanced_agent_card_discovery/well_known_endpoint54.8 µs
advanced_agent_card_hot_reload/read_current_card246 ns
advanced_agent_card_hot_reload/swap_and_read518 ns
advanced_agent_card_hot_reload/swap_complex_card48.7 µs
advanced_artifact_accumulation/store_save_at_depth/0607 ns
advanced_artifact_accumulation/store_save_at_depth/101.5 µs
advanced_artifact_accumulation/store_save_at_depth/10011.3 µs
advanced_artifact_accumulation/store_save_at_depth/505.6 µs
advanced_artifact_accumulation/store_save_at_depth/50058.8 µs
advanced_artifact_accumulation/task_clone_at_depth/099 ns
advanced_artifact_accumulation/task_clone_at_depth/10825 ns
advanced_artifact_accumulation/task_clone_at_depth/10010.3 µs
advanced_artifact_accumulation/task_clone_at_depth/505.1 µs
advanced_artifact_accumulation/task_clone_at_depth/50052.3 µs
advanced_extended_agent_card/get_extended_card_roundtrip70.5 µs
advanced_pagination_walk/filtered/1000_tasks_page_50246.0 µs
advanced_pagination_walk/filtered/100_tasks_page_2525.6 µs
advanced_pagination_walk/unfiltered/1000_tasks_page_50486.9 µs
advanced_pagination_walk/unfiltered/100_tasks_page_2551.2 µs
advanced_subscribe_fanout/concurrent_subscribers/1518.1 µs
advanced_subscribe_fanout/concurrent_subscribers/10904.6 µs
advanced_subscribe_fanout/concurrent_subscribers/5673.1 µs
advanced_tenant_resolver/bearer_resolver103 ns
advanced_tenant_resolver/bearer_resolver_with_mapper121 ns
advanced_tenant_resolver/header_resolver105 ns
advanced_tenant_resolver/header_resolver_miss74 ns
advanced_tenant_resolver/path_resolver113 ns

Agent-Level Latency Under Fault

Not run by the benchmarks workflow; no results are published here. benchmarks.yml does not run this bench, so the two groups below have no tables. To measure it locally: cargo bench -p a2a-benchmarks --bench coordinator_chain_under_fault.

End-to-end latency through a 5-hop in-process coordinator chain as the links between hops are made progressively less reliable. Unlike every other benchmark on this page, this one does not measure SDK-layer overhead — it measures the characteristic an agent-harness reviewer actually wants: "what is the end-to-end latency of an agent chain when the network between agents is unreliable, and how well do per-hop retries absorb it?"

The topology is:

test client ─[link 0]─▶ coord 1 ─[link 1]─▶ coord 2 ─[link 2]─▶ coord 3 ─[link 3]─▶ coord 4 ─[link 4]─▶ leaf

Every coordinator forwards the message to the next hop via a pre-built A2aClient wrapped in a FaultInjectingTransport. Each link applies its own independent fault profile, so per-hop faults compound end-to-end the way they would in a real deployment. Coordinators 1–4 retry their downstream call up to 3 times on retryable errors; the bench harness additionally retries the top-level send_message up to 8 times so the published error rates have effectively-zero unrecoverable-failure probability.

Honest caveats — read these before interpreting the numbers:

  • In-process, not network faults. The injected "error" is a synthetic ClientError::Timeout returned before the wrapped transport is called. This exercises the SDK's retry path faithfully, but does not exercise TCP congestion control, DNS resolution, or transport-level head-of-line blocking. Treat the numbers as "latency under SDK-level retransmission pressure," not "latency under real network loss."
  • One topology. Sequential delegation is the simplest multi-agent shape. Critic loops, parallel fan-out with deadline propagation, and plan-and-execute with replanning would be more rubric-relevant — this benchmark does not claim to cover those.
  • One benchmark does not retroactively make the other suites agent-level. It is deliberately additive: the first concrete data point in the "agent-level latency under fault" shape that the rest of the suite was missing entirely.

Group 1: per-hop latency injection (zero errors)

Varies per-link latency from 0 µs to 20 000 µs with zero synthetic errors, isolating the chain's latency-compounding factor from retry jitter. Five hops × per-hop latency gives the lower bound, plus the JSON-RPC loopback cost of five nested sends (not measured here).

Group 2: per-hop error injection (3 retries per hop + 8 outer retries)

Varies per-link synthetic-fault rate from 0% to 5% with zero added latency. Each coordinator retries its downstream call up to 3 times on retryable errors; the bench harness retries the top-level call up to 8 times. Records successful-path latency including retry cost, which is what "steady-state end-to-end latency under fault" means in practice.


Known Measurement Limitations

These notes help interpret benchmark results accurately and avoid misdiagnosing CI variance as real performance changes.

Streaming cross-thread scheduling

On N-core systems, tokio::spawn places the SSE builder task on a different worker thread with (N-1)/N probability. This was once held to cost ~500µs per request and to cause the ~24% bimodal distribution in the streaming benchmarks; a later measurement (the 0.9.0 changelog entry) found cross-thread scheduling real but second-order, about 50 µs of a 191 µs send.

Mitigations (v0.5.0): The SSE builder uses sleep + reset (not interval) to eliminate timer wheel entries during active streaming. Transport streaming benchmarks use worker_threads(1) runtime to eliminate cross-thread variance entirely (24 high severe → 4 high mild outliers, 3× tighter confidence intervals).

Data volume get() at 100K tasks

data_volume_get/lookup reports 411 ns at 1K tasks, 414 ns at 10K and 198 ns at 100K. A 100K figure below the 1K/10K ones has previously been traced to a CPU cache warming artifact from the large populate_store() setup filling L1/L2 caches; a 4MB cache-busting step was added in v0.5.0 to flush caches between populate and measure. Where the 100K figure is still the lowest, that step has not removed the effect, and the 1K/10K numbers are the representative O(1) lookup baseline.

Stream volume per-event cost

The default broadcast channel capacity is 256 events (raised from 64 in v0.5.0). backpressure_stream_volume does not run its larger rows at that default: the bench sizes the event queue above the event count (512 slots for the 52- and 252-event rows, 1,024 for the 502-event row), so it measures streaming cost, not capacity overflow. It reports 436.1 µs for 52 events, 1.31 ms for 252 and 2.40 ms for 502: 4.4 µs per added event from 52 to 252 events and 4.4 µs from 252 to 502.

Production deployments expecting >256 events/task can raise RequestHandlerBuilder::with_event_queue_capacity() to match their peak volume.

Transport payload insensitivity

Transport benchmarks (64B → 16KB) show a 23.1% latency increase for a 256× payload increase, because the 163.3 µs HTTP round-trip dominates. Serde regressions are hard to detect via the 64B–16KB transport benchmarks; the 100KiB (310.2 µs) and 1MiB (1.71 ms) rows are where payload size begins to dominate. Use the protocol/payload_scaling isolation benchmarks (64B → 1MB, pure serde) for serialization regression detection.

Connection reuse impact

Connection reuse saves 110.6 µs (39.8%) on loopback — 277.9 µs per request when the client is rebuilt each time, versus 167.3 µs when it is shared. On real networks with TLS the saving should be larger still, since a new client also pays a TLS handshake; this page does not measure that. Best practice: create one A2aClient at startup and share via Arc across request handlers.

Two consequences worth spelling out, because both have bitten this repo:

  • A benchmark that builds a client inside its measured region is measuring client construction, not the thing it names. production_agent_burst does exactly this, and its per-agent cost tracks 277.9 µs — the rebuild-every-time number — rather than the shared-client one.
  • Quoting this saving as a small percentage (an older revision of this page said 9%) understates it by 4.4×. It is a large fraction of a loopback request, not a rounding error.

What sharing a client is actually worth under concurrency

The bullet above says production_agent_burst tracks the rebuild-every-time number. That is true, and it invites a wrong inference: that sharing a client would move it to the reused figure. It does not, and production/agent_burst_client_sharing was added to measure the difference rather than reason about it. Both arms run the same server, the same three operations per agent, and the same burst sizes; only the client's provenance changes.

BurstClient per agentShared Arc<A2aClient>Saved per agent
10270.0 µs232.6 µs37.4 µs (13.8%)
50273.1 µs225.5 µs47.6 µs (17.4%)
100278.6 µs226.6 µs52.0 µs (18.7%)

Sharing wins at every burst size, and the medians' 95% confidence intervals are disjoint in all three, so the direction is not noise. But the size of the win is only a fraction of what the single-request comparison above predicts, 34% of it at 10 agents, 43% at 50 and 47% at 100, where it is 52.0 µs (18.7%) per agent against the 110.6 µs (39.8%) that reused_client versus new_client_per_request would lead you to expect.

The reason is that the two arms differ in two coupled ways, not one. A shared client skips per-agent construction and per-agent connection setup, but it also puts every concurrent agent on one connection pool, and that contention gives part of the saving back. The sequential benchmark has no contention to pay, which is why its number is the optimistic bound rather than the forecast.

The practical reading: share the client — it is free to do and wins at every size measured — but size capacity from the burst figures, not from the single-request saving.

Deserialization versus serialization cost

In the memory_* rows above, deserialization takes several times as long as serialization (Task: 949 ns vs 248 ns, 3.8×). This is inherent to serde_json's parsing model: every field creates an intermediate String/Vec allocation during parsing. The serde_helpers::deser_from_str() helper uses serde_json's from_str path, which in the protocol_payload_scaling rows above takes 19–23% less time than from_slice at every payload size (218 ns against 283 ns at 64 B).

The serde_helpers::SerBuffer provides thread-local buffer reuse for serialization. In the same rows it takes 114 ns against to_vec's 133 ns at 64 B (1.2×) and 216 ns against 292 ns at 256 B, and the two converge as the payload grows: 618.7 µs against 596.6 µs at 1 MiB.

History depth scaling

History depth scales roughly linearly: memory_history_scaling records 1160 ns to deserialize at 1 turn and 19225 ns at 50 turns (347 ns and 6149 ns to serialize), so a store that parses the stored task on every get() (the SQL stores) pays that growth per read; InMemoryTaskStore::get clones instead. The serde_helpers module provides optimized paths; for maximum throughput on deep histories, consider storing pre-serialized bytes alongside parsed structs to avoid re-parsing on every read.

Artifact accumulation clone cost

task_clone_at_depth measures Task::clone alone: 99 ns with no artifacts and 52.3 µs with 500. The background event processor no longer clones the whole task per artifact event: it persists artifact updates with TaskStore::save_artifact_delta, which the in-memory store applies in place, so streaming cost per event stays flat (see Stream volume per-event cost). store_save_at_depth still prices a whole-task save.

Slow consumer timer calibration

The backpressure/timer_calibration benchmarks measure actual tokio::time::sleep() durations on the CI runner. On shared runners, 1ms sleep ≈ 2.11 ms actual, 5ms sleep ≈ 6.14 ms actual. Slow consumer results should be interpreted against these calibrated durations, not the nominal sleep values.

Data volume save() at 10K tasks

data_volume/save/after_prefill/10000 reports 1.4 µs with a 95% confidence interval of [1.38 µs, 1.40 µs] in this run, as tight as the other prefill levels. An earlier run reported a much wider interval; if that recurs, an insert into the sorted BTreeMap index crossing a node split is the suspected cause, which has not been established. The indexes are what let list() serve a page in O(log n + page_size) without sorting every task on each call.

Dispatch routing: direct handler vs HTTP round-trip

production/dispatch_routing/direct_handler_invoke calls the request handler directly and reports 49.0 µs; full_http_roundtrip sends a message through a JSON-RPC server over a warm keep-alive connection and reports 168.0 µs. The difference (119.0 µs) is everything the direct call bypasses: the client's request and response handling, JSON-RPC (de)serialization, HTTP, and dispatch. docs/swarm-scale-findings.md measures the HTTP stack itself at roughly a tenth of a send.

Subscribe fan-out scaling

advanced/subscribe_fanout reports 518.1 µs with 1 subscriber, 673.1 µs with 5 and 904.6 µs with 10.

Agent burst scaling

production/agent_burst times the whole burst: 2.73 ms for 10 agents, 13.12 ms for 50 and 26.94 ms for 100 — per agent, 272.9 µs, 262.5 µs and 269.4 µs respectively.

Cold start vs steady state

production/cold_start/first_request (342.6 µs) creates a fresh server per iteration (sample_size=20), measuring server handler initialization + first TCP connect. steady_state (166.6 µs) reuses an existing keep-alive connection, measuring the full HTTP round-trip with connection overhead already amortized. The two benchmarks measure different things — they are complementary, not comparable.

Tenant resolver overhead

Per request, the tenant resolvers cost 105 ns (header), 74 ns (header miss), 113 ns (path), 103 ns (bearer) and 121 ns (bearer with mapper), against 165.0 µs for a full JSON-RPC round trip (transport_jsonrpc_send/single_message).

Pagination context index

At 1000 tasks, the advanced/pagination_walk filtered walk takes 246.0 µs against 486.9 µs unfiltered. The BTreeMap context index lets a context_id-filtered walk iterate only that context's tasks (500 of the 1,000 here), which is why it takes about half as long.


Methodology

All benchmarks use Criterion.rs, which provides:

  • Statistical significance testing — detects real regressions vs noise
  • Warm-up iterations — avoids cold-start measurement artifacts
  • Median and its 95 % confidence interval — a central tendency resistant to outliers
  • Configurable sample sizes — more iterations for noisy benchmarks

Measurement rigor

Most benchmarks follow these practices; the exceptions are deliberate (the cold-start, per-request-client and per-agent-client benchmarks build what they measure inside iter(), and the data_volume save benchmarks need a fresh task id per iteration):

  • Deterministic inputs: Fixed task IDs and payloads inside iter() — no incrementing counters that change HashMap distribution across iterations
  • Setup outside measurement: Store creation, server startup, and resource allocation happen before iter(), not inside it
  • debug_assert! for invariants: Correctness checks inside measurement loops use debug_assert! to avoid string-formatting cost in release builds
  • black_box() on inputs and outputs: Prevents the compiler from eliminating measured work through dead-code optimization
  • Tolerance-based allocation assertions: Memory benchmarks use a 5% tolerance instead of exact counts to avoid spurious CI failures from serde_json/stdlib version changes
  • Side-effect interceptors: The interceptor chain benchmark uses CountingInterceptor (AtomicU64) to verify interceptors are actually invoked during measurement — not just optimized away

What we benchmark

The SDK's value proposition is the A2A protocol layer and runtime efficiency, not agent logic. The bulk of the suite therefore benchmarks what the SDK owns: transport overhead, serialization cost, store operations, concurrency scaling, streaming backpressure, error handling, and memory allocation behavior.

One benchmark — coordinator_chain_under_fault — is deliberately a different shape: it measures end-to-end agent-chain latency under fault injection, not SDK-layer overhead. It is documented in its own section above with the caveats for how to interpret it (in-process only, sequential delegation only, one topology). It is not intended to substitute for a real agent-capability benchmark suite — it closes the most obvious gap in the existing suite while staying honest about what it is.

What we do NOT benchmark

  • Agent intelligence — LLM quality is an eval problem, not a perf benchmark
  • Real network faults — the fault-injection bench simulates synthetic ClientError::Timeout responses in-process, not real packet loss or TCP congestion control
  • Network latency — all benchmarks use loopback (127.0.0.1)
  • TLS handshake — benchmarks use plaintext HTTP
  • Task completion quality — needs human-preference evaluation
  • Multi-agent topologies beyond sequential delegation — critic loops, parallel fan-out with deadline propagation, and plan-and-execute with replanning are out of scope for this crate

Reproducing locally

# Run all benchmarks
cargo bench -p a2a-benchmarks

# Run a specific module
cargo bench -p a2a-benchmarks --bench transport_throughput

# Save baseline, make changes, then compare
./benches/scripts/run_benchmarks.sh --save
# ... make changes ...
./benches/scripts/run_benchmarks.sh --compare

Full HTML reports (with violin plots and comparison overlays) are generated in target/criterion/.