Skip to content

Conversation

@zy-kkk
Copy link
Member

@zy-kkk zy-kkk commented Aug 23, 2024

pick(#39582)

This PR addresses a memory leak issue caused by FastList objects in HikariCP being retained by ThreadLocal variables, which are not easily garbage collected in long-running JNI threads. To mitigate this, a system property com.zaxxer.hikari.useWeakReferences is set to true, ensuring that WeakReference is used for ThreadLocal objects, allowing the garbage collector to reclaim memory more effectively. Even though setting this will affect some performance, solving resource leaks is relatively more important
Performance difference before and after setting
Before setting:
10 concurrency 0.02-0.05
100 concurrency 0.18-0.4
After setting:
10 concurrency 0.02-0.07
100 concurrency 0.18-0.7

Proposed changes

Issue Number: close #xxx

…kariCP (apache#39582)

This PR addresses a memory leak issue caused by FastList objects in
HikariCP being retained by ThreadLocal variables, which are not easily
garbage collected in long-running JNI threads. To mitigate this, a
system property com.zaxxer.hikari.useWeakReferences is set to true,
ensuring that WeakReference is used for ThreadLocal objects, allowing
the garbage collector to reclaim memory more effectively.
Even though setting this will affect some performance, solving resource
leaks is relatively more important
Performance difference before and after setting
Before setting:
10 concurrency 0.02-0.05
100 concurrency 0.18-0.4
After setting:
10 concurrency 0.02-0.07
100 concurrency 0.18-0.7
@doris-robot
Copy link

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR

Since 2024-03-18, the Document has been moved to doris-website.
See Doris Document.

@zy-kkk
Copy link
Member Author

zy-kkk commented Aug 23, 2024

run buildall

@morningman morningman merged commit 4cb7122 into apache:branch-2.1 Aug 23, 2024
@zy-kkk zy-kkk deleted the hikari_leak_21 branch September 12, 2024 07:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants