Deepomatic / deepomatic-client-python

Python Client
Other
14 stars 0 forks source link

Use requests session to recycle HTTP connections #22

Closed maingoh closed 6 years ago

maingoh commented 6 years ago

Related to #21

With requests sessions we now have one HTTP connection pool per deepomatic Client, using HTTP keep-alive.

Previously each call to the Client created (and closed) a new HTTP connection, including Task polling via wait. This resulted in a lot of connection churn, potentially saturating the TCP stack.

More info there https://laike9m.com/blog/requests-secret-pool_connections-and-pool_maxsize,89/

PierreLesouhaitier commented 6 years ago

Have you been able to reduce the number of opened connections ? On my side, I could not see a lower number of connections using this PR on the script #20.

maingoh commented 6 years ago

@PierreLesouhaitier I didn't test with your script yet. I will do it later.

thomas-riccardi commented 6 years ago

The default max pool size may be changed later, depending on usage.