Skip to catalogue

196

connection pool

Reuse connections. A new TCP and TLS handshake per query will dominate the query.

What is connection pool?

A pool keeps open connections to a database or HTTP host and lends them out. Size is limited by the server, not by the number of app threads. Pools that outlive a fork, or that are created per request, leak or thrash.

Why does connection pool matter when vibe coding?

Models open a client inside the handler. Serverless multiplies that by concurrency. Name one pool per process and a max.

How do you do connection pool?

Create the pool at startup. Set max size under the database limit divided by the number of app instances. Time out borrows. Close on shutdown.

How do you ask a model for connection pool?

Use one connection pool for (database), created at startup, max (N) per instance. Do not connect per request. N times the number of instances must stay under the database max connections. Close the pool on shutdown.

What goes wrong with connection pool?

A max of 100 in each of 40 processes. You configured 4000 connections against a server that allows 200. Do the multiplication.

adjacent