When the number of checked-out connections reaches the size set in pool_size, additional connections will be returned up to this limit. When those additional connections are returned to the pool, they are disconnected and discarded. It follows then that the total number of simultaneous connections the pool will allow is pool_size + max_overflow, and the total number of “sleeping” connections the pool will allow is pool_size.
您正在阅读有关QueuePool的信息,它管理数据库连接以获得更好的性能。它通过保持打开的空闲连接来实现这一点,以备以后重用。它将保持打开的连接数为池大小=5(默认值)。如果打开第六个连接,队列中的一个连接将关闭,只要它处于空闲状态。如果没有空闲,则队列池将打开其他队列池,最大溢出=10(默认值)。如果再这样下去,你就会得到一个错误。
但是,这两个参数都是可配置的。将池大小设置为0以拥有无限打开的连接。
The source is here
每SQLAlchemy docs
所以是的,溢出的连接比正常休眠的连接更容易被释放。
如果您实际查看
QueuePool._do_get()
的源,您将看到当连接计数等于池大小+溢出时,它会引发一个TimeoutError
,并且在调用connect()
后不久不会返回到池的连接。您正在阅读有关QueuePool的信息,它管理数据库连接以获得更好的性能。它通过保持打开的空闲连接来实现这一点,以备以后重用。它将保持打开的连接数为池大小=5(默认值)。如果打开第六个连接,队列中的一个连接将关闭,只要它处于空闲状态。如果没有空闲,则队列池将打开其他队列池,最大溢出=10(默认值)。如果再这样下去,你就会得到一个错误。 但是,这两个参数都是可配置的。将池大小设置为0以拥有无限打开的连接。 The source is here
相关问题 更多 >
编程相关推荐