Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connections optimization (requests pool_connections, pool_maxsize) #14

Open
litnimax opened this issue Sep 1, 2016 · 0 comments
Open

Comments

@litnimax
Copy link

litnimax commented Sep 1, 2016

In http_client.py we have the following:

class SynchronousHttpClient(HttpClient):
    """Synchronous HTTP client implementation.
    """

    def __init__(self):
        self.session = requests.Session()
        self.authenticator = None
        self.websockets = set()

So every requests creates a new connection.
What if we add there connection pooling and caching? Something like this:

def __init__(self):
        from requests.adapters import HTTPAdapter
        self.session = requests.Session()
        self.session.mount('http://', HTTPAdapter(pool_connections=50, pool_maxsize=100))
        self.authenticator = None
        self.websockets = set()

But we need a way to pass these parameters when we initialize ari client.
What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant