Performance degrades under high load because of ConnectionNotAvailable exceptions #998
Unanswered
kramar11
asked this question in
Potential Issue
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I'm using httpcore in a project and while doing some performance tests with locust, I noticed, that the performance degraded under very high load. After digging, I found, that the AsyncConnectionPool may (and under load will!) assign connections to more than one pool_requests, which then results in ConnectionNotAvailable Exceptions (lots of them) which lowers the performance as the pool_request needs again to wait for an available connection.
I then made a simple modification in _assign_requests_to_connections so that already assigned connections are not considered as available, which greatly increased performance and totally got rid of ConnectionNotAvailable Exceptions.
Note: Only the 2 lines with the
assigned_connections
var were added/changed.My test results:
Don't know if this is the right fix to avoid the ConnectionNotAvailable Exceptions but it increases high load performance by more than 30 percent. I think it could be reasonable to keep two lists of connections, those which are available and those which are assigned - and move assigned connections accordingly.
What do you think?
Beta Was this translation helpful? Give feedback.
All reactions