Skip to content

Missing TCP_NODELAY on HttpConnector causes ~40ms latency per gRPC call on localhost with in-memory kurrentdb #232

Description

@screwyprof

Problem

NodeConnection::new creates an HttpConnector without setting TCP_NODELAY (grpc.rs:897-898). Nagle's algorithm buffers
small gRPC requests for up to 40ms before sending.

This affects every gRPC call through the client — reads, appends, subscriptions.

Benchmark

Measured read_stream on a nonexistent stream (localhost, single-node, tls=false):

median fastest
before (Nagle on) 42 ms 40 ms
after (set_nodelay(true)) 311 µs 225 µs

135x improvement. The DB itself responds in ~1ms (verified via HTTP API).

Suggested fix

let mut http = HttpConnector::new();
http.enforce_http(false);
http.set_nodelay(true);  // disable Nagle — gRPC is latency-sensitive

Most gRPC clients set it - Go's gRPC does, Java's does, tonic's built-in transport::Channel sets TCP_NODELAY by default.
The custom hyper client path misses it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions