-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lambda client apparently does not use connection pooling #3843
Comments
Hi @tim-finnigan , for sure, the request must be sent twice since we invoke the function twice. What is unclear is why the HTTP connection is created anew for each invoke instead of re-using the previous connection. |
Hi @siscia thanks for following up. I think the issue here is that when you call import boto3
boto3.set_stream_logger('')
client = boto3.client('lambda')
def test_invoke():
response = client.invoke(FunctionName='connectTest')
response_payload = response['Payload']
response_payload = response['Payload'].read().decode('utf-8') # Line here needed to read response
print(response_payload)
test_invoke()
test_invoke() |
That was it! Thanks a lot for your support! |
Describe the bug
The lambda client (apparently) does not use correctly the https pooling.
Expected Behavior
Invoking lambda while using boto3 should use a connection pool and re-use previously established connections.
Current Behavior
The boto3 client, while using lambda, does not use the connection pooling and it re-creates a new connection at each invocation.
Reproduction Steps
You can see twice the line:
2023-09-06 01:31:44,878 urllib3.connectionpool [DEBUG] Starting new HTTPS connection (2): lambda.eu-west-1.amazonaws.com:443
Also the latency is such that can be explained by establishing a new connection.
Possible Solution
No response
Additional Information/Context
I believe this was already reported in:
#2666
SDK version used
boto3-1.28.35
Environment details (OS name and version, etc.)
Ubuntu
The text was updated successfully, but these errors were encountered: