[
https://issues.apache.org/jira/browse/BEAM-14144?focusedWorklogId=750168&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-750168
]
ASF GitHub Bot logged work on BEAM-14144:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 30/Mar/22 14:40
Start Date: 30/Mar/22 14:40
Worklog Time Spent: 10m
Work Description: steveniemitz commented on a change in pull request
#17151:
URL: https://github.com/apache/beam/pull/17151#discussion_r838627678
##########
File path:
runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/util/JfrInterop.java
##########
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.beam.runners.dataflow.worker.util;
+
+import java.io.InputStream;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.time.Duration;
+import java.time.Instant;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+/**
+ * Exposes methods to interop with JFR. This is only supported on java 9 and
up, java 8 does not
+ * include JFR and will throw an exception when instantiated.
+ *
+ * <p>Note, since beam needs to compile against java 8 still, we can't
directly bind to JFR classes
+ * at compile time. Instead, we need to use reflection to create/invoke JFR
methods.
+ */
+class JfrInterop {
+ // ensure only a single JFR profile is running at once
+ private static final ExecutorService JFR_EXECUTOR =
Executors.newSingleThreadExecutor();
+
+ private final Constructor<?> recordingCtor;
+ private final Method recordingStart;
+ private final Method recordingStop;
+ private final Method recordingGetStream;
+ private final Method recordingClose;
+ private final Object jfrConfig;
+
+ @SuppressWarnings("nullness")
+ JfrInterop() {
+ try {
+ Class<?> configClass = Class.forName("jdk.jfr.Configuration");
Review comment:
yeah I tried to figure out how to get that set up and gave up after a
few minutes. We'd have to use reflection to load the class anyways still.
--
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]
Issue Time Tracking
-------------------
Worklog Id: (was: 750168)
Time Spent: 2.5h (was: 2h 20m)
> Record JFR profiles when GC thrashing is detected
> -------------------------------------------------
>
> Key: BEAM-14144
> URL: https://issues.apache.org/jira/browse/BEAM-14144
> Project: Beam
> Issue Type: Improvement
> Components: runner-dataflow
> Reporter: Steve Niemitz
> Assignee: Steve Niemitz
> Priority: P2
> Time Spent: 2.5h
> Remaining Estimate: 0h
>
> It'd be useful for debugging GC issues in jobs to have allocation profiles
> when it was occurring. In java 9+, JFR is included in the JDK, we could use
> that to record profiles when GC thrashing is detected.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)