arunpandianp opened a new pull request, #41869:
URL: https://github.com/apache/beam/pull/41869
Disable per-step profiler scope tagging in the Dataflow Java legacy
worker (`org.apache.beam.runners.dataflow.worker.profiler.ScopedProfiler`)
by default, with an opt-in experiment
(`--experiments=enable_scoped_profiler`)
to re-enable it if needed.
Motivation:
When the Google Cloud Profiler Java agent (`profiler_java_agent.so`) is
attached, `ScopedProfiler` registers each step's internal
`NameContext.originalName()` (e.g., `"s1"`, `"s2"`, `"sN"`) via JNI
(`Profiler.registerAttribute`) and invokes JNI `Profiler.setAttribute`
inside `DataflowExecutionState.onActivate` on every state push and pop in
`ExecutionStateTracker.enterState` (twice per element in
`ParDoOperation.process`, `WriteOperation.process`, and
`FlattenOperation.process`, as well as per shuffle key/value in
`GroupingShuffleReader` and once per bundle in
`ReadOperation.runReadLoop`). On high-throughput / high-cardinality
pipelines, these per-element JNI transitions incur measurable CPU
overhead on the hottest execution path.
Why it is safe to disable by default:
- `ScopedProfiler` only annotates CPU and wall profile samples with a
raw `attr` label set to the internal original step name (`"sN"`, not
the user-facing transform name). Heap sampling ignores this attribute.
- The exported `"sN"` `attr` label is not user-visible in the Google
Cloud Console Cloud Profiler UI or the Dataflow UI (Cloud Profiler UI
does not display or support filtering/grouping by sample labels).
- The only way to inspect or use the `"sN"` `attr` label is by
downloading raw `.pb.gz` pprof profiles (or saving profiles to GCS via
`--saveProfilesToGcs`) and manually passing tag flags to the `pprof`
CLI (e.g., `-tagfocus=attr=...`, `-tagroot=attr`), then correlating
`"sN"` back to the user transform name.
- Core Cloud Profiler functionality (CPU, wall, and heap profile
collection and upload via `enable_google_cloud_profiler`, call stacks,
and flame graphs) continues to work unchanged.
- Dataflow execution state tracking (msec counters, lull logging, and
side-input read counters) is completely unaffected.
- Dataflow Runner v2 (`sdks/java/harness`), Python, and Go workers
already do not use `ScopedProfiler` or export `attr` labels.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]