Hello,

The SQLA Pooling section 
<https://docs.sqlalchemy.org/en/20/core/pooling.html> says that the default 
connection pool (QueuePool is the default pool, isn’t it?) has 5 
connections with an overflow of 10 (docs 
<https://docs.sqlalchemy.org/en/20/core/pooling.html#sqlalchemy.pool.QueuePool.__init__>
).

However, in our configuration we use





*sqlalchemy.pool_recycle = 3600sqlalchemy.pool_pre_ping = 
Truesqlalchemy.pool_size = 20sqlalchemy.max_overflow = 30*

Independently of how many connections the PG server accepts (looks like 100 
by default, docs 
<https://www.postgresql.org/docs/current/runtime-config-connection.html>) a 
single gRPC server process has a global Engine instance with a connection 
pool of that configured size.

Without too many requests flowing through our gRPC server process, we 
already see these errors:

*QueuePool limit of size 20 overflow 30 reached, connection timed out, 
timeout 30.00 (Background on this error at: https://sqlalche.me/e/14/3o7r)*

Assuming that we have the implementation correct (a global Engine and its 
connection pool, sessions fetching and releasing connections correctly) the 
error can mean one of two things:

   1. too many simultaneous requests hold a connection too long; or
   2. these settings aren’t realistic for a production server environment.

Is there another angle I might be missing? What configuration settings 
would you recommend? Other than turning on debugging (docs 
<https://docs.sqlalchemy.org/en/20/core/pooling.html#sqlalchemy.pool.Pool.params.echo>)
 
what tips do you have to debug the issue?

Much thanks!
Jens

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/0cdbdb8a-0cff-47f4-b0ca-fccd70ded2den%40googlegroups.com.

Reply via email to