About connection to database #370
Replies: 2 comments 3 replies
-
First of all, differently from pyDAL, Emmett uses its own connection manager, which in case of pooled connection is the Also, the connection manager in Emmett ORM's is designed to fill the maximum size of the pool during first connection, for a couple of reasons:
The connection manager then will close all the connections in the pool during the interpreter shutdown. The
I personally set this to Regarding your question, you have to mind the pool size is per process, so in order to calculate the number of effectively opened connections using docker, I should multiply:
So, for example, let's say I have a docker image when I serve my app using 2 workers and I spawn 4 containers for that, and I configured a pool size of 10 connections, then I will have:
|
Beta Was this translation helpful? Give feedback.
-
Hi @gi0baro This is evident:
What happens in the scenario you describe:
If demand grows at a time and we have 150 open connections, but then low demand. Will they close themselves and will be the only 80 open? Jose |
Beta Was this translation helpful? Give feedback.
-
Hi
my pool_size = 10
I always did the deployments using FreeBSD + PostgreSQL + Gunicorn + Supervisord and I never had the problem with the connections.
In this implementation, Linux and Docker were used and yesterday had more than 200 connections to the open server.
I understand that the pool_size guarantees a minimum pool of available connections and that as you increase concurrent requests more connections are created. I understand that the closure of the connections is automatic. How do you handle these Emmett (Pydal)?
The keep_alive_timeout parameter makes the time indicated kill the connection and create a new one?
How I said before I had been worried about the connections before, but in this implementation they seem to grow in quantity.
Jose
Beta Was this translation helpful? Give feedback.
All reactions