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

Share data loader to across asyncio boto sessions #40658

Merged

Conversation

dstandish
Copy link
Contributor

@dstandish dstandish commented Jul 8, 2024

By default, a botocore session creates and caches an instance of JSONDecoder which consumes a lot of memory. This issue was reported here boto/botocore#3078. In the context of triggers which use boto sessions, this can result in excessive memory usage and as a result reduced capacity on the triggerer. We can reduce memory footprint by sharing the loader instance across the sessions.

Idea for the solution here comes from this comment:
boto/botocore#3078 (comment)

Def let me know if you see any concerns with this.

Below here is memory utilization shown before and after the fix, with 50 s3 key triggers running:

Before (770MB):
image

After (370MB):
image

By default, a botocore session creates and caches an instance of JSONDecoder which
consumes a lot of memory.  This issue was reported here boto/botocore#3078.
In the context of triggers which use boto sessions, this can result in excessive
memory usage and as a result reduced capacity on the triggerer.  We can reduce
memory footprint by sharing the loader instance across the sessions.
Copy link
Member

@hussein-awala hussein-awala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one!

@potiuk potiuk merged commit d2b6197 into apache:main Jul 8, 2024
51 checks passed
@kaxil kaxil deleted the use-shared-loader-object-for-asyncio-sessions branch July 25, 2024 10:41
romsharon98 pushed a commit to romsharon98/airflow that referenced this pull request Jul 26, 2024
By default, a botocore session creates and caches an instance of JSONDecoder which
consumes a lot of memory.  This issue was reported here boto/botocore#3078.
In the context of triggers which use boto sessions, this can result in excessive
memory usage and as a result reduced capacity on the triggerer.  We can reduce
memory footprint by sharing the loader instance across the sessions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:providers provider:amazon-aws AWS/Amazon - related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants