8000 Requests do not share HTTP(S) connection pool · Issue #132 · Azure/msrest-for-python · GitHub
[go: up one dir, main page]

Skip to content
Requests do not share HTTP(S) connection pool #132
@akx

Description

@akx

Hey there,

It looks like msrest (as used by the Azure SDK for Python) does not automatically share a requests context between requests.

I see traces of some code that would allow passing in a requests Session (e.g. here and maybe here too?), but I have no idea how to use those... I'm just creating a ComputeManagementClient :)

The reason why this came up is that I profiled a script that basically just does cmc.virtual_machines.list() about 7 times and it spends half of what it does (29.6 + 17.3 = 46.9%) just connecting to places it could have already have a connection to 😞

Function Calls Own Time %
_ssl._SSLSocket.read 20 2156 39.3%
_ssl._SSLSocket.do_handshake 11 1626 29.6%
_socket.socket.connect 11 949 17.3%
_ssl._SSLContext.load_verify_locations 11 84 1.5%

So... how do I get my ComputeManagementClient to keep that requests session, or better yet, how do I get all of my Client objects to share one session (if that's safe)?

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

      0