Skip to content

CAS shared endpoint: evaluate unix-domain socket for the private gRPC upstream #3671

Closed as not planned

Description

@migmartri

Follow-up to #3628 / PR #3663.

Context

The CAS shared endpoint dispatches each request and proxies native gRPC through an in-process httputil.ReverseProxy to a private native gRPC server. The private listener is currently a TCP loopback socket (127.0.0.1:0), bound at construction, with the proxy dialing it over h2c.

A benchmark comparison on a 1 GiB ByteStream transfer (2 runs per direction, disk-backed staging) measured the proxy's upstream transport:

Upstream transport Upload Download Peak live heap (up / down)
TCP loopback ~213 MB/s ~171 MB/s ~32 / ~41 MiB
Unix-domain socket ~226 MB/s (+6%) ~183 MB/s (+7%) ~32 / ~41 MiB

UDS recovers roughly 2–4 percentage points of the proxy hop relative to the direct native baseline (the proxy on TCP loopback is −9.0% upload / −8.1% download; on UDS it is about −3.4% / −5%). Heap is identical on both, so end-to-end backpressure is unaffected by the transport choice. The current TCP loopback default already sits inside the R-003 10% shape.

Proposal

Evaluate switching the private listener to a unix-domain socket, or making it an opt-in, only if the measured gain justifies it for a target deployment.

Constraints to weigh:

  • The CAS pod runs with readOnlyRootFilesystem: true, so a unix socket must live on a writable mount (the staging emptyDir), and needs lifecycle (create/remove) and permission handling.
  • Unix sockets are not supported on Windows (dev machines are Linux/macOS; the server runs in Linux containers, so this is likely fine).
  • TCP loopback needs no writable path, no cleanup, no permission handling, and works everywhere.

Scope

Refs #3628, PR #3663.

AI assistance: Claude Code.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions