Skip to content

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.
@boring-cyborg boring-cyborg bot added area:providers provider:amazon AWS/Amazon - related issues labels Jul 8, 2024
@dstandish dstandish requested review from pankajkoti and sunank200 July 8, 2024 18:58
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
@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/Amazon - related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants