> This page is for NeMo Relay, version dev.
> For other versions, use one of these documentation indexes:
> - Latest (v0.11.2) (default): https://docs.nvidia.com/nemo/relay/latest/llms.txt
> - dev: https://docs.nvidia.com/nemo/relay/dev/llms.txt
> - v1.0.0: https://docs.nvidia.com/nemo/relay/v1.0.0/llms.txt
> - v0.11.2: https://docs.nvidia.com/nemo/relay/v0.11.2/llms.txt
> - v0.10.4: https://docs.nvidia.com/nemo/relay/v0.10.4/llms.txt
> - v0.9.4: https://docs.nvidia.com/nemo/relay/v0.9.4/llms.txt
> - v0.8.4: https://docs.nvidia.com/nemo/relay/v0.8.4/llms.txt

> For clean Markdown of any page, append .md to the page URL. For a task-oriented documentation index, fetch https://docs.nvidia.com/nemo/relay/llms.txt. Use the documentation version matching the installed NeMo Relay package: latest follows the latest stable release, vX.Y.Z identifies a retained release snapshot, and dev documents development changes. Preserve the selected version when following links; do not mix examples or API contracts from different versions. Fetch the relevant section's /llms.txt before individual pages instead of loading a complete version index.

# Performance

> Understand scope-local runtime overhead and performance considerations for middleware and subscribers.

NeMo Relay keeps runtime overhead focused around the work that is active for the current scope and call.

## Runtime Model

These points summarize the runtime behaviors that matter most for performance-sensitive
paths.

* Scope stacks define active ownership and scope-local visibility.
* Middleware registries are priority ordered and lazily sorted.
* Managed tool and large language model (LLM) helpers resolve visible
  middleware before executing the user callback.
* Subscribers receive emitted events after runtime work creates them.

## Practical Guidance

Use these practices when applying the concept in application or integration code.

* Prefer scope-local middleware for request-specific behavior so cleanup happens when the scope closes.
* Keep subscriber callbacks lightweight. Expensive export work no longer blocks
  managed execution directly, but it can still delay queued subscriber delivery,
  flushes, and shutdown.
* Use execution intercepts when you need to wrap real execution and sanitize guardrails when you only need to change emitted observability payloads.
* Use binding-native typed wrappers and codecs when provider payload conversion would otherwise be repeated at many call sites.

## Latency Benchmark

The latency benchmark measures Relay CLI overhead for gateway requests,
coding-agent hook forwarding, and cold startup. For direct application SDK
overhead, measure latency in the application with its own middleware and
subscribers.

For the benchmark harness, scenarios, and interpretation guidance, refer to
[Run the Latency Benchmark](/nemo/relay/dev/contribute/latency-benchmark).

## Related Topics

Use these links to continue into adjacent concepts and workflows.

* [Architecture](/nemo/relay/dev/about-nemo-relay/architecture)
* [Middleware](/nemo/relay/dev/about-nemo-relay/concepts/middleware)
* [Subscribers](/nemo/relay/dev/about-nemo-relay/concepts/subscribers)
* [Typed Wrappers And Codecs](/nemo/relay/dev/integrate-into-frameworks/using-codecs)