urllib3 connectionpool - Connection pool is full, discarding connection(urllib3 connectionpool - 连接池已满,丢弃连接)
问题描述
看到了
urllib3.connectionpool WARNING - Connection pool is full, discarding connection
意味着我实际上正在丢失数据(因为失去连接)
或
是否意味着连接被丢弃(因为池已满);但是,当连接池可用时,稍后会重新尝试相同的连接?
mean that I am effectively loosing data (because of lost connection)
OR
Does it mean that connection is dropped (because pool is full); however, the same connection will be re-tried later on when connection pool becomes available?
推荐答案
没有数据丢失!
连接被丢弃在请求完成后(因为池已满,如前所述).这意味着这个特定的连接将来不会被重复使用.
The connection is being discarded after the request is completed (because the pool is full, as mentioned). This means that this particular connection is not going to be re-used in the future.
由于 urllib3 PoolManager 重用连接,它会限制每个主机保留的连接数,以避免累积太多未使用的套接字.PoolManager 可以配置为避免在池没有任何可用的空闲套接字时创建过多的套接字 PoolManager(..., block=True)
.
Because a urllib3 PoolManager reuses connections, it will limit how many connections are retained per hos to avoid accumulating too many unused sockets. The PoolManager can be configured to avoid creating excess sockets when the pool doesn't have any idle sockets available with PoolManager(..., block=True)
.
如果您依赖并发,最好将池的大小增加 (maxsize
) 至少与数字一样大您正在使用的线程数,以便每个线程有效地获得自己的连接.
If you're relying on concurrency, it could be a good idea to increase the size of the pool (maxsize
) to be at least as large as the number of threads you're using, so that each thread effectively gets its own connection.
更多详情:https://urllib3.readthedocs.io/en/latest/advanced-usage.html#customizing-pool-behavior
这篇关于urllib3 connectionpool - 连接池已满,丢弃连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:urllib3 connectionpool - 连接池已满,丢弃连接


基础教程推荐
- 在 Python 中,如果我在一个“with"中返回.块,文件还会关闭吗? 2022-01-01
- 筛选NumPy数组 2022-01-01
- 何时使用 os.name、sys.platform 或 platform.system? 2022-01-01
- 使用PyInstaller后在Windows中打开可执行文件时出错 2022-01-01
- 用于分类数据的跳跃记号标签 2022-01-01
- 线程时出现 msgbox 错误,GUI 块 2022-01-01
- 如何在海运重新绘制中自定义标题和y标签 2022-01-01
- Python kivy 入口点 inflateRest2 无法定位 libpng16-16.dll 2022-01-01
- 如何让 python 脚本监听来自另一个脚本的输入 2022-01-01
- Dask.array.套用_沿_轴:由于额外的元素([1]),使用dask.array的每一行作为另一个函数的输入失败 2022-01-01