Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/blackberry/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Http urllib3连接管理_Http_Connection_Urllib3 - Fatal编程技术网

Http urllib3连接管理

Http urllib3连接管理,http,connection,urllib3,Http,Connection,Urllib3,我使用urllib3通过HTTP查询了数千次在线API,一次又一次,超过40000次。 我注意到,在一开始,来自API的HTTP GET非常快,速度小于500ms。 随着越来越多的HTTP请求被发出,响应时间会减慢到几秒钟 我的代码如下所示: http = urllib3.PoolManager() req = http.request(u'GET', URL) doc = xml.dom.minidom.parseString(req.data) nodes = doc.getElements

我使用urllib3通过HTTP查询了数千次在线API,一次又一次,超过40000次。 我注意到,在一开始,来自API的HTTP GET非常快,速度小于500ms。 随着越来越多的HTTP请求被发出,响应时间会减慢到几秒钟

我的代码如下所示:

http = urllib3.PoolManager()
req = http.request(u'GET', URL)
doc = xml.dom.minidom.parseString(req.data)
nodes = doc.getElementsByTagName(ELEMENT_NAME)
for node in nodes:
    #process the node, this happens very very fast.

我遗漏了什么吗?谢谢

也许您正在使用的API限制了您的速度?

我不这么认为,因为我以前使用过它来加载大量数据,但它很好……无论如何,我想不出urllib3会对这些症状负责的任何原因。也许在另一个图书馆也尝试同样的方法?