Skip to main content
This guide covers best practices for minimizing latency and maximizing throughput when using the Infercom Inference Service.

Connection pooling

The single most impactful optimization is reusing your client instance across requests. This enables HTTP connection pooling, which skips the TCP and TLS handshake on subsequent calls.
Reusing your client instance can reduce network overhead by up to 50% on consecutive requests.

How it works

When you create a new client for every request, each call must establish a fresh TCP connection and negotiate TLS — adding several tens of milliseconds depending on your location and network conditions. By reusing the client, the underlying connection stays open and subsequent requests skip this setup entirely.
Avoid creating a new client inside loops or request handlers. This forces a new TCP+TLS handshake on every call.
Both the SambaNova SDK and OpenAI SDK use httpx under the hood, which automatically manages a connection pool when you reuse the client. The default pool maintains up to 20 keep-alive connections.

Response performance metadata

Every API response includes detailed performance metrics in the usage object. Use these to measure and optimize your application.

Available metrics

Example response

Measuring client vs server latency

To understand how much time is spent on the network versus inference, compare your client-side elapsed time with the server-reported total_latency:
A typical network overhead from within the EU is 50–150ms, depending on your proximity to the datacenter and whether connection pooling is active.

Streaming for interactive applications

For chatbots and interactive use cases, streaming delivers the first token to the user faster and provides a more responsive experience.
Streaming does not reduce total processing time, but it significantly improves perceived latency by delivering output as it is generated.

Performance best practices