High TCPConnector.connect latency in aiohttp when running in Kubernetes #11255
Unanswered
ramundomario
asked this question in
Q&A
Replies: 1 comment 2 replies
-
|
Does switching between ThreadedResolver and AsyncResolver show a change in behaviour? |
Beta Was this translation helpful? Give feedback.
2 replies
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.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
We're experiencing unexpectedly high latency during TCP connection establishment (
TCPConnector.connect) when running our Python application usingaiohttpclient inside Kubernetes.Sometimes the
TCPConnector.connectstep takes approximately 15 seconds per request.When it happens, the number looks pretty static, with only minor variations (a few milliseconds), which suggests a systematic issue rather than random network delays.
Context
asyncio+aiohttpaio-pikathat consumes jobs from RabbitMQ and makes, in addition, HTTP requests to internal services usingaiohttp.ndotsis set to1so every URL must by FQDN.The HTTP client is created using
aiohttp.ClientSessiontogether withaiohttp.TCPConnectorfor each request (we're not re-using theClientSessionnor theTCPConnector)Observations
TCPConnector.connectphaseforce_closeand otherTCPConnectorsettings did not resolve the issue (as reported in aiohttp.ClientSession together with ClusterIp not load balancing #6629)TCPConnector.connect, only 13 showed the long (~15s) latency.Traces are subject to sampling and do not represent total calls
Versions
3.11.183.11.13Looking for help understanding this behavior and any guidance or best practices to mitigate the latency.
Any pointers on diagnosing, configuration, or known issues would be greatly appreciated.
Thank you for your support and for maintaining aiohttp!
Beta Was this translation helpful? Give feedback.
All reactions