Repository navigation
perf(profiling): scale Echion frame cache with frame limit - #20351
Draft
taegyunkim wants to merge 3 commits into
Draft
taegyunkim wants to merge 3 commits into
taegyunkim wants to merge 3 commits into
Conversation
Codeowners resolved asResolved from the full PR diff against |
Circular import analysis
|
Dependency direction analysis
|
Contributor
❌ ErrorsYour PR has failed checks. Please review the issues below and take necessary action before merging. 🚦 2 Pipeline jobs failed
ℹ️ InfoNo other issues found (see more)🧪 All tests passed Useful? React with 👍 / 👎 This comment will be updated automatically if new data arrives.🔗 Commit SHA: 9f12cf1 | Docs | View more details | Give us feedback! |
taegyunkim
added a commit
that referenced
this pull request
Sep 21, 2026
Keep the existing fixed 1024-entry cache throughout the task-frame-budget work. Dynamic capacity management and its test expectations remain isolated in #20351 for after the rest of the stack lands.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Scale Echion's retained frame cache to four times the configured maximum frame count, bounded between 256 and 1024 entries. Cache capacity can be adjusted while the sampler is stopped, and shrinking immediately evicts least-recently-used entries. With the default
DD_PROFILING_MAX_FRAMES=64, this reduces the cache capacity from 1024 to 256 entries.The retained frame-cache capacity is independent of the 2048-frame internal unwind safety ceiling, now named
MAX_STACK_UNWIND_SAFETY_LIMITafter #20352. This PR leaves that ceiling and task-aware stack discovery unchanged.JIRA: PROF-14213
Testing
Performance validation is deferred until #19085 and the PRs stacked on top of it have merged. Keep this PR in draft pending that evaluation. Refresh this branch against the resulting
main, then compare the existing 1024-entry cache against 256/512-entry capacities and this scaling policy. Measure retained cache memory, process memory, cache hits/misses and evictions, sampler CPU time, and effective sampling frequency across plain-thread, asyncio, and gevent workloads. Re-run functional coverage on that baseline as well.Completed functional checks on the current baseline:
origin/mainata1bcb762e9, rebuilt the native extensions and ran the following on Python 3.14.5 with gevent: 6 passed, 460 deselected.scripts/run-tests --venv 1b5fa93 -- tests/profiling/collector/test_stack.py \ -k 'test_collect_truncate or test_native_frame_limit_scales_cache or test_exact_native_frame_limit_is_not_truncated or test_set_max_frames_after_fork_restart or test_asyncio_discovery_ignores_plain_stack_limit or test_collect_gevent_thread_task'scripts/lint checks: passed.scripts/check-releasenotes: passed.Risks
The smaller cache can increase frame-cache churn and sampler CPU overhead, even with shallow frame limits. The 256-entry floor only bounds minimum capacity, not miss rate or CPU cost: the shared cache working set depends on threads, tasks, and bytecode offsets, not just stack depth. Lower retained cache memory is the intended benefit, but neither its magnitude nor the overall performance tradeoff has been measured. The existing 1024-entry capacity remains the ceiling for larger limits.
Additional Notes
origin/mainata1bcb762e9, including refactor(profiling): clarify stack unwind safety limit #20352. The merge applied cleanly without manual conflict resolution.