擅长:python、mysql、java
<p>每<a href="http://docs.sqlalchemy.org/en/latest/core/pooling.html#sqlalchemy.pool.QueuePool.__init__" rel="nofollow noreferrer">SQLAlchemy docs</a></p>
<blockquote>
<p>When the number of checked-out connections reaches the size set in <code>pool_size</code>, additional connections will be returned up to this limit. <strong>When those additional connections are returned to the pool, they are disconnected and discarded.</strong> It follows then that the total number of simultaneous connections the pool will allow is <code>pool_size + max_overflow</code>, and the total number of “sleeping” connections the pool will allow is <code>pool_size</code>.</p>
</blockquote>
<p>所以是的,溢出的连接比正常休眠的连接更容易被释放。</p>
<p>如果您实际查看<code>QueuePool._do_get()</code>的源,您将看到当连接计数等于池大小+溢出时,它会引发一个<code>TimeoutError</code>,并且在调用<code>connect()</code>后不久不会返回到池的连接。</p>