Company
Date Published
Author
George MacKerron
Word count
1862
Language
English
Hacker News points
None

Summary

Serverless computing offers benefits such as quick and simple deployments, true scalability, and low latency due to running near users. However, connecting to a serverless database from a serverless compute platform has been challenging until now. Neon's solution addresses this problem by launching its serverless PostgreSQL driver in beta, which connects to Neon databases from Cloudflare Workers and other environments supporting WebSockets. The driver is a drop-in replacement for node-postgres and provides a real Postgres connection via a WebSocket-to-TCP proxy, allowing database sessions with transactions and client-side logic in-between. This solution has the advantage of keeping things simple on a conceptual level while maintaining security through TLS encryption. Performance improvements are also being worked on to reduce latency and CPU time, such as reducing SCRAM rounds and optimizing network round-trips. The WebSocket proxy is now available in all regions, and read replicas across regions may be offered in the longer term. Both the serverless driver and WebSocket proxy are open source, allowing users to set up and run them to make any PostgreSQL database accessible over WebSockets.