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

feat(profiling): Better gevent support #1822

Merged
merged 4 commits into from Jan 17, 2023

Conversation

Zylphrex
Copy link
Member

@Zylphrex Zylphrex commented Jan 5, 2023

We're missing frames from gevent threads. Using gevent.threadpool.ThreadPool
seems to fix that. The monkey patching gevent does is causing the sampler thread
to run in a greenlet on the same thread as the all other greenlets. So when it
is taking a sample, the sampler is current greenlet thus no useful stacks can be
seen.

@Zylphrex Zylphrex force-pushed the txiao/feat/better-gevent-profiling-support branch 3 times, most recently from a9ffd5b to 6c905d2 Compare January 6, 2023 21:25
Base automatically changed from txiao/ref/remove-sample-buffer-from-profiler to master January 10, 2023 16:11
We're missing frames from gevent threads. Using `gevent.threadpool.ThreadPool`
seems to fix that. The monkey patching gevent does is causing the sampler thread
to run in a greenlet on the same thread as the all other greenlets. So when it
is taking a sample, the sampler is current greenlet thus no useful stacks can be
seen.
@Zylphrex Zylphrex force-pushed the txiao/feat/better-gevent-profiling-support branch from 6c905d2 to 0d5555c Compare January 10, 2023 18:32
@Zylphrex Zylphrex marked this pull request as ready for review January 11, 2023 16:51
@Zylphrex Zylphrex requested review from sl0thentr0py and a team January 11, 2023 16:51
@Zylphrex
Copy link
Member Author

One potential TODO for gevent would be to look into separating the samples by greenlet instead of thread id. Though this has the caveat that since all the greenlets are in the same thread, we're only able to capture a sample from the current greenlet each time. So if that is split across multiple samples, the final flamechart would appear as if we sample at a much lower frequency.

@Zylphrex Zylphrex merged commit ffe7737 into master Jan 17, 2023
@Zylphrex Zylphrex deleted the txiao/feat/better-gevent-profiling-support branch January 17, 2023 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants