A new API for creating TCP sockets from Cloudflare Workers
blog.cloudflare.com
blog.cloudflare.com
One issue I see is the cost of constantly opening and closing a TCP connection for something like the postgres example. Postgres specifically has quite a high cost for each connection. Pgbouncer helps, but this could still be pretty consequential at the concurrency that workers can offer.
Maybe in the future we could create local pools that can be shared across executions, similar to how AWS Lambda does it now?
I don’t think you can connect() to the service binding yet which limits the flexibility as you have to manually tunnel your queries through a fetch handler, but it should be fairly doable and probably possible to have a generic conversion shim layer to convert.