Company
Date Published
Author
Tamir Duberstein
Word count
978
Language
English
Hacker News points
None

Summary

CockroachDB, initially a NoSQL distributed key-value store, has evolved into a relational SQL database, necessitating the use of two network ports due to protocol differences between HTTP and PGWire. The original setup allowed multiplexing admin UI and RPC traffic on a single port using net/rpc, but implementing PostgreSQL's wire protocol required a distinct port because PGWire operates over plain TCP. To manage this, CockroachDB employed cmux to distinguish between protocols and route traffic accordingly. While the switch to gRPC, which supports HTTP2 features, improved performance by avoiding blocking with multiplexed streams, it also introduced complications with TLS and the admin UI. The current solution involves separating the HTTP admin UI onto its own port while gRPC and PGWire share another, pending potential performance fixes from gRPC maintainers that could reinstate a single-port configuration.