[python_cpu_sleep_asyncio_3.12] add CPU/sleep attribution scenario (PROF-14213) - #129
Open
taegyunkim wants to merge 4 commits into
Open
[python_cpu_sleep_asyncio_3.12] add CPU/sleep attribution scenario (PROF-14213)#129taegyunkim wants to merge 4 commits into
taegyunkim wants to merge 4 commits into
Conversation
…ROF-14213) New scenario that alternates 10 ms CPU bursts with 50 ms sleeps in asyncio mode with 4 concurrent staggered slots, asserting on (a) total CPU consumed (667M ns/wall-sec, ±25%) and (b) cpu_burst self-attribution as % of cpu-time profile (80% ±10%). The 80% baseline comes from the python-cpu-accuracy survey's adaptive-off asyncio runs: 4 staggered slots × 10 ms CPU × 50 ms sleep gives 40 s/min of CPU, and ~81% of that attributed to _cpu_loop in the survey. Adaptive sampling is disabled (_DD_PROFILING_STACK_ADAPTIVE_SAMPLING_ENABLED=0). Also adds base_images/Dockerfile.python-3.12.
3 tasks
This comment has been minimized.
This comment has been minimized.
Contributor
Author
|
@codex review |
|
Codex Review: Didn't find any major issues. You're on a roll. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
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.
Summary
python_cpu_sleep_asyncio_3.12exercising CPU + sleep alternation in asyncio mode (M=4 staggered slots) on Python 3.12.667_000_000ns/wall-sec, ±25%.cpu_burstaccounts for ~80% of CPU time, ±10%.Task-2throughTask-5each account for ~25% of CPU time, ±15%, onMainThread.base_images/Dockerfile.python-3.12(also added by the sibling sync + gevent PRs; rebase whichever lands second/third).Why Python 3.12
Python 3.12 is the most widely deployed version among dd-trace-py customers and the version Datadog runs internally, so the regression check exercises the same combination most users see in production.
Why these bounds
Based on the python-cpu-accuracy survey (DataDog/experimental, users/taegyun.kim/python-cpu-accuracy) adaptive-off asyncio run, which measured
_cpu_loopself-time at ~81% with total CPU ~40 s/min on 4 staggered slots × 10 ms / 50 ms.Formula:
M × C / (C + S) = 4 × 0.01 / 0.06 = 0.667 CPU-sec/wall-sec.The per-task assertion verifies that CPU time is split across the four asyncio tasks rather than being attributed to only one task. GitHub Actions showed more scheduler/sample noise for individual task labels (for example
12% / 24% / 37% / 24%), so the per-task budget is ±15% while still catching a large attribution skew.Latest local run:
.*total CPU: expected ~20.2s, actual 19.8s (2.3% error).*cpu_burst.*: expected 80%, actual 82% (2% error)Task-2=15%,Task-3=18%,Task-4=40%,Task-5=24%(all within ±15%)Test plan
go test -run TestSchemaValidation ./...TEST_SCENARIOS="python_cpu_sleep_asyncio_3.12" go test -timeout 10m -v -run TestScenarios ./...JIRA: PROF-14213