Well, that’s not very specific. One can not use the new connection pool and still not have connection issues, and other can use the new connection pool and have this problem as well.
I recently (just yesterday) had this problem, I had over 400 connections open to the database, with a spike in usage on one of our API endpoints and suddenly the Django process was really slow, and most of the requests were crashing due to no more connections available.
We solved this problem using the new connection pool feature added, and it worked like a charm.
For reference, this is the configuration that we’re now using:
# settings.py
DATABASES = {"default": env.db("DATABASE_URL")}
DATABASES["default"]["OPTIONS"] = {"pool": {"min_size": 2, "max_size": 10, "timeout": 10}}
You can learn more about the numbers you should put in for min/max size and timeout on the psycopg3 connection pool documentation and on this article referenced there.
Since them we’ve not ran into any issues.