urllib3 connectionpool - 连接池已满,丢弃连接

urllib3 connectionpool - Connection pool is full, discarding connection(urllib3 connectionpool - 连接池已满,丢弃连接)
本文介绍了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 - 连接池已满,丢弃连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Leetcode 234: Palindrome LinkedList(Leetcode 234:回文链接列表)
How do I read an Excel file directly from Dropbox#39;s API using pandas.read_excel()?(如何使用PANDAS.READ_EXCEL()直接从Dropbox的API读取Excel文件?)
subprocess.Popen tries to write to nonexistent pipe(子进程。打开尝试写入不存在的管道)
I want to realize Popen-code from Windows to Linux:(我想实现从Windows到Linux的POpen-code:)
Reading stdout from a subprocess in real time(实时读取子进程中的标准输出)
How to call type safely on a random file in Python?(如何在Python中安全地调用随机文件上的类型?)