-
Notifications
You must be signed in to change notification settings - Fork 167
perf(profiling): separate queue and waking thread #3611
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
base: master
Are you sure you want to change the base?
Conversation
On every sample we send data to another thread and attempt to wake that thread. The problem is the syscall here is almost as expensive as collecting the sample if the other thread is asleep, which is often the case. This branch avoids that. Instead it writes to a queue and samples are handled when that background thread wakes up for other reasons. Notably one of those reasons is every 10ms when wall-time is enabled (default) so _probably_ this should work pretty well without filling the queues.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3611 +/- ##
==========================================
- Coverage 62.20% 62.12% -0.08%
==========================================
Files 141 141
Lines 13387 13387
Branches 1753 1753
==========================================
- Hits 8327 8317 -10
- Misses 4263 4270 +7
- Partials 797 800 +3 see 3 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
Under sustained load in ZTS, this could otherwise run forever.
Benchmarks [ profiler ]Benchmark execution time: 2026-01-31 18:02:19 Comparing candidate commit b622e0f in PR branch Found 9 performance improvements and 6 performance regressions! Performance is the same for 14 metrics, 7 unstable metrics. scenario:php-profiler-exceptions-with-profiler
scenario:php-profiler-exceptions-with-profiler-and-timeline
scenario:php-profiler-timeline-memory-with-profiler
scenario:php-profiler-timeline-memory-with-profiler-and-timeline
scenario:walk_stack/1
scenario:walk_stack/50
scenario:walk_stack/99
scenario:walk_stack_instructions/1
scenario:walk_stack_instructions/50
scenario:walk_stack_instructions/99
|
b5a4330 to
07df26e
Compare
Description
On master, we send every sample to another thread and attempt to wake that thread to process the sample. The problem is the syscall here is almost as expensive as collecting the sample if the other thread is asleep, which is often the case in NTS builds. Here's a profile showing this (but note it's not always this close):
This git branch avoids that. Instead it writes to a queue and samples are handled when that background thread wakes up for other reasons. Notably one of those reasons is every 10ms when wall-time is enabled (default) so probably this should work pretty well without filling the queues. The queues are larger on ZTS builds, though by a fixed multiplier (16).
Reviewer checklist