擅长:python、mysql、java
<p>来自MongoClient的pymongo文档:</p>
<blockquote>
<p><em>maxPoolSize (optional): The maximum number of connections that the pool will open simultaneously. If this is set, operations will block if there are maxPoolSize outstanding connections from the pool. Defaults to 100. Cannot be 0.</em></p>
</blockquote>
<p>并签名:</p>
<pre><code> pymongo.mongo_client.MongoClient(
host='localhost', port=27017, document_class=dict,
tz_aware=False, connect=True, **kwargs)
</code></pre>
<p>因此,在该调用中使用所需的值添加<code>maxPoolSize</code>将设置连接池的大小。在</p>
<p>注意,<em>“没有什么是免费的”</em>,这对客户机和服务器都是一个明显的成本,以维护大量的连接。对于高请求负载,您可以考虑其他处理方法,或者至少平衡负载。在</p>