Commit d74531f
fix(proxy): reduce SSL connection overhead by setting TCP_NODELAY
Set TCP_NODELAY on both the client-facing and proxy-to-PostgreSQL sockets
to disable Nagle's algorithm. PostgreSQL's connection startup involves rapid
small-message exchanges (auth, parameter status, ready-for-query), and with
SSL there are additional round trips for the SSLRequest handshake. Nagle's
buffering was delaying these small packets by up to 40ms each, compounding
into significant latency for workloads that open many short-lived connections.
Measured improvement on 101 connections x 3 queries: SSL overhead reduced
from +6s to +2s vs no-SSL baseline. Per-query overhead with connection reuse
is unaffected (remains ~0s).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 5ade47a commit d74531f
1 file changed
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| 74 | + | |
74 | 75 | | |
75 | 76 | | |
76 | 77 | | |
| |||
130 | 131 | | |
131 | 132 | | |
132 | 133 | | |
| 134 | + | |
133 | 135 | | |
134 | 136 | | |
135 | 137 | | |
| |||
0 commit comments