Java 16 introduces native Unix domain socket support via JEP 380, enabling faster and more secure local inter-process communication. This exploration covers connecting to PostgreSQL using the new UnixDomainSocketAddress API, discovering that the blocking Socket API is not supported (only SocketChannel), and working around this limitation with the Vert.x Postgres client by creating custom Transport and NioSocketChannel subclasses. An informal benchmark shows ~15% latency improvement over TCP/IP loopback. The post also discusses broader use cases like multi-process application architectures, non-disruptive server upgrades via file descriptor transfer (not yet supported in JEP 380), and the hope that frameworks like Netty and Vert.x will adopt this feature using multi-release JARs.
Sort: