Skip to content
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

Boto3 Performance degradation after ugprade from python 3.8 to 3.12 #3224

Open
jricardooliveira opened this issue Jul 19, 2024 · 4 comments
Open
Labels
bug This issue is a confirmed bug. p2 This is a standard priority issue

Comments

@jricardooliveira
Copy link

Describe the bug

We have been experiencing significant performance degradation in our services after upgrading our environment from Python 3.8 with boto3 1.28 (container running python:3.8.16-slim-buster) to Python 3.12 with any version of boto3 greater than or equal to 1.28 (container running python:3.12.2-slim-bookworm).

Expected Behavior

The performance should be consistent across requests, similar to the behavior observed in the Python 3.8 environment.

Current Behavior

Screenshot 2024-07-19 at 10 12 01

Reproduction Steps

1- Set up a container with Python 3.8.16-slim-buster and boto3 1.28.
2 - Set up a container with Python 3.12.2-slim-bookworm and boto3 1.28 or higher.
3 - Send multiple burst requests from a single user to a service using boto3.

In the screenshot you may see the performance degradation before and after and the culprit... boto3 kinesis POST request.
Screenshot 2024-07-19 at 10 07 31

Possible Solution

No response

Additional Information/Context

We suspect that the connection initialization process in the newer environment might be causing this issue. Any insights or suggestions on how to address this performance degradation would be greatly appreciated.

SDK version used

1.28.x 1.34.x

Environment details (OS name and version, etc.)

Container Debian slim-bookworm

@jricardooliveira jricardooliveira added bug This issue is a confirmed bug. needs-triage This issue or PR still needs to be triaged. labels Jul 19, 2024
@tim-finnigan tim-finnigan self-assigned this Jul 23, 2024
@tim-finnigan tim-finnigan added the investigating This issue is being investigated and/or work is in progress to resolve the issue. label Jul 23, 2024
@tim-finnigan
Copy link
Contributor

Thanks for reaching out. We need a bit more information here in order to investigate this further. Can you provide a minimal code snippet to reproduce the issue? It's not clear what your code involves and what might be affecting the performance.

Also could you share debug logs, which you can get by adding boto3.set_stream_logger('') to your script? That may help with understanding what is going on here. And per the CHANGELOG the latest Boto3 version is 1.34.146, so please try updating to test this in the latest (or a recent) version.

@tim-finnigan tim-finnigan added response-requested Waiting on additional info and feedback. p2 This is a standard priority issue and removed investigating This issue is being investigated and/or work is in progress to resolve the issue. needs-triage This issue or PR still needs to be triaged. labels Jul 23, 2024
@jricardooliveira
Copy link
Author

Hi,

We found out that the issue is probably related with OpenSSL 3.x vs OpenSSL 1.x ... but we aren't sure. What we're sure is that using Debian or Ubuntu that comes with OpenSSL 1.x is fast and the problem arises on Debian 12 based distros.

Are you aware of issues related to OpenSSL?

Thanks
Joao

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. label Jul 29, 2024
@tim-finnigan
Copy link
Contributor

Thanks for following up - I'm not aware of issues involving OpenSSL related to performance degradation. But if you're able to provide logs/memory profiles comparing both then that could with further investigation.

@tim-finnigan tim-finnigan added the response-requested Waiting on additional info and feedback. label Aug 2, 2024
@nateprewitt
Copy link
Contributor

nateprewitt commented Aug 2, 2024

There is an as-of-yet unresolved performance decrease in Python 3.12+ with OpenSSL 3.x because of how OpenSSL 3 does certificate path lookups (python/cpython#95031). This has lead to up to 5x decreases in performance in some instances depending on the number of certs and locations searched on the host.

We've done some initial investigations to help minimize this but it's still an unresolved issue for most of Python's networking infrastructure. I'm a bit surprised you're seeing this on Debian/Ubuntu as most reports have been more significant on Windows (up to 55x reported performance decrease). We have yet to see information on a safe solution for addressing this. Using a single SSLContext has unfortunately proven to be problematic in Requests and other projects that have tried addressing this.

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. label Aug 3, 2024
@tim-finnigan tim-finnigan removed their assignment Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a confirmed bug. p2 This is a standard priority issue
Projects
None yet
Development

No branches or pull requests

3 participants