-
Notifications
You must be signed in to change notification settings - Fork 9.2k
HADOOP-19737: ABFS: [BugFix] Add metrics to identify improvements with read and write aggressiveness #8135
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
HADOOP-19737: ABFS: [BugFix] Add metrics to identify improvements with read and write aggressiveness #8135
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| /** | ||
| * 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 | ||
| * <p> | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * <p> | ||
| * 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.hadoop.fs.azurebfs; | ||
|
|
||
| import java.util.Random; | ||
|
|
||
| /** | ||
| * Provides a JVM-scoped unique identifier. | ||
| * | ||
| * <p>The identifier is generated once when the class is loaded and remains | ||
| * constant for the lifetime of the JVM. The value is a random 6-digit number | ||
| * in the range {@code [100000, 999999]}.</p> | ||
| * | ||
| * <p>This class is utility-only and cannot be instantiated.</p> | ||
| */ | ||
| public final class JvmIdProvider { | ||
|
|
||
| /** | ||
| * A JVM-wide unique identifier generated at class load time. | ||
| */ | ||
| private static final long JVM_UNIQUE_ID; | ||
|
|
||
| static { | ||
| JVM_UNIQUE_ID = 100000L + new Random().nextInt(900000); | ||
|
||
| } | ||
|
|
||
| /** | ||
| * Prevents instantiation. | ||
| */ | ||
| private JvmIdProvider() { | ||
| } | ||
|
|
||
| /** | ||
| * Returns the JVM-scoped unique identifier. | ||
| * | ||
| * @return the unique ID for this JVM instance | ||
| */ | ||
| public static long getJvmId() { | ||
| return JVM_UNIQUE_ID; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1338,7 +1338,11 @@ public AbfsRestOperation read(final String path, | |
| AbfsReadResourceUtilizationMetrics readResourceUtilizationMetrics = retrieveReadResourceUtilizationMetrics(); | ||
| // If metrics are available, record them in the tracing context for diagnostics or logging. | ||
| if (readResourceUtilizationMetrics != null) { | ||
| tracingContext.setResourceUtilizationMetricResults(readResourceUtilizationMetrics.toString()); | ||
| String readMetrics = readResourceUtilizationMetrics.toString(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With this logic, we can send same metrics data in two different read call, is this expected?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In toString() method, we are taking care of updateVersion and lastPushedVersion and pushing only if return updateVersion.get() > lastPushedVersion.get() to prevent same metric from getting pushed more than once, moreover markPushed is synchronized |
||
| tracingContext.setResourceUtilizationMetricResults(readMetrics); | ||
| if (!readMetrics.isEmpty()) { | ||
| readResourceUtilizationMetrics.markPushed(); | ||
| } | ||
| } | ||
| URL url = createRequestUrl(path, abfsUriQueryBuilder.toString()); | ||
| final AbfsRestOperation op = getAbfsRestOperation( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is calling it JvmIdProvider correct? Here we are generating our own id which is not JVM Id
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This ID is unique per JVM, hence the name. Should I change it to JvmUniqueIdProvider ?