Skip to content

Connections optimization (requests pool_connections, pool_maxsize) #14

@litnimax

Description

@litnimax

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions