Skip to content

Conversation

@pquentin
Copy link
Member

@pquentinpquentin commented Mar 24, 2025

While the Python GC can handle those dependencies, it can cause latency spikes when .option() is used for each query, which causes many clients to be garbage collected, which can be slower in the presence of cycles.

https://github.com/python/cpython/blob/main/InternalDocs/garbage_collector.md

objgraph backrefs, before and after

Namespaced sub clients reference back to the main client:

refs-main

No backreferences:

refs-cyclic-dependency-fixed

10 000 calls to client.options().info(), before and after

histogram-main

histogram-cyclic-fixed

Calling options() in a loop is 15% faster on average, and 2x faster for P100.

Copy link

@gioboagioboa left a comment

Choose a reason for hiding this comment

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

👍 it looks nice

While the Python GC can handle those dependencies, it can cause latency spikes when .option() is used for each query, which causes many clients to be garbage collected, which can be slower in the presence of cycles.
@pquentin
Copy link
MemberAuthor

👍 it looks nice

Thank you for the review! So it looked nice with 14 changed lines, but it did not work. :)

Sign up for freeto 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.

2 participants

@pquentin@gioboa