Skip to content
This repository was archived by the owner on Mar 13, 2022. It is now read-only.

Commit 84d1284

Browse files
authored
Merge pull request #29 from pokoli/pool_maxsize
Use a higher value for connecion_pool_maxsize.
2 parents 4127e1a + c38bc4d commit 84d1284

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

configuration.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
from __future__ import absolute_import
2222

23+
import multiprocessing
2324
import logging
2425
import sys
2526

@@ -83,11 +84,12 @@ def __init__(self):
8384
# Set this to True/False to enable/disable SSL hostname verification.
8485
self.assert_hostname = None
8586
# urllib3 connection pool's maximum number of connections saved
86-
# per pool. Increasing this is useful for cases when you are
87-
# making a lot of possibly parallel requests to the same host,
88-
# which is often the case here.
89-
# When set to `None`, will default to whatever urllib3 uses
90-
self.connection_pool_maxsize = None
87+
# per pool. urllib3 uses 1 connection as default value, but this is
88+
# not the best value when you are making a lot of possibly parallel
89+
# requests to the same host, which is often the case here.
90+
# cpu_count * 5 is used as default value to increase performance
91+
# This is used because it's the default value for ThreadPoolExecutor
92+
self.connection_pool_maxsize = multiprocessing.cpu_count() * 5
9193
# http proxy setting
9294
self.http_proxy_url = None
9395

0 commit comments

Comments
 (0)