Deploying data-driven applications to serverless and edge environments introduces unique challenges around database connections. Key issues include connection exhaustion from ephemeral function scaling, TCP connection restrictions in edge runtimes, and latency from geographically distant databases. Practical solutions covered include reducing ORM connection pool sizes to 1, setting concurrency limits on cloud functions, using connection poolers like PgBouncer or ProxySQL, proxying database connections via HTTP (e.g., Amazon RDS Proxy, Prisma Accelerate), adopting globally distributed databases (DynamoDB Global Tables, CockroachDB, Fauna), and using edge-first config stores. The post also discusses tradeoffs between eventual and strong consistency in multi-region data replication.

11m read timeFrom prisma.io
Post cover image
Table of contents
Table of contentsA note on terminologyServerless deployments and youBring your compute to the edgeWrapping up
2 Impressions