Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
c38ead2
added ops per sec and average pagination metric for listkeys
Dec 7, 2023
36ca4fa
updated test cases
Dec 12, 2023
1818a49
Updated all test cases
Dec 13, 2023
f731a19
refactored code
Dec 13, 2023
6d3d979
refactored code
Dec 13, 2023
18e1e00
fixed errors
Dec 14, 2023
6744486
fixed import errors
Dec 14, 2023
a8c1c0a
Merge branch 'master' into HDDS-9874
muskan1012 Dec 18, 2023
3375fce
rearranged imports and refactored code
muskan1012 Dec 18, 2023
68b8238
Merge branch 'master' into HDDS-9874
muskan1012 Jan 4, 2024
e879fc9
removed duplicate code
muskan1012 Jan 8, 2024
94545b6
code change to avoid build failure
muskan1012 Jan 10, 2024
860247b
Merge branch 'master' into HDDS-9874
muskan1012 Jan 28, 2024
3c15956
fixed test cases
muskan1012 Feb 7, 2024
2a3a512
Merge branch 'HDDS-9874' of github.com:muskan1012/ozone into HDDS-9874
muskan1012 Feb 7, 2024
7fb39c6
Merge branch 'apache:master' into HDDS-9874
muskan1012 Feb 7, 2024
1bd6fd7
fixed checkstyle and other issues
muskan1012 Feb 7, 2024
31f8a3c
checkstyle issue resolved
muskan1012 Feb 7, 2024
3a73859
unit test resolution
muskan1012 Feb 7, 2024
6bf2a5e
unit test case failures resolutions
muskan1012 Feb 8, 2024
8671712
listKeysReadFromRocksDbLatency metric added
muskan1012 Feb 8, 2024
a0397eb
removed irrelevant code
muskan1012 Feb 8, 2024
dfd427b
refactored code to avoid null pointer exception
muskan1012 Feb 8, 2024
cf5f43d
Merge branch 'master' into HDDS-9874
muskan1012 Mar 26, 2024
570bc36
Merge branch 'master' into HDDS-9874
muskan1012 Jun 18, 2024
364de9b
updated code to avoid npe
muskan1012 Jun 18, 2024
d26e986
npe resolution for integration-recon
muskan1012 Jun 18, 2024
2bb0cda
refactored code as per review comments
muskan1012 Jun 24, 2024
bf9d575
minor nits fixed
muskan1012 Jun 25, 2024
b0a5832
changes as per the review comment
muskan1012 Jul 1, 2024
1c83093
Apply suggestions from code review
muskan1012 Jul 1, 2024
8139ae7
changed naming convention as per the review comment
muskan1012 Jul 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.apache.hadoop.metrics2.MetricsSystem;
import org.apache.hadoop.metrics2.annotation.Metric;
import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
import org.apache.hadoop.metrics2.lib.MutableGaugeFloat;
import org.apache.hadoop.metrics2.lib.MutableRate;

/**
Expand Down Expand Up @@ -113,12 +114,21 @@ public static void unregister() {
@Metric(about = "Ratis local command execution latency in nano seconds")
private MutableRate validateAndUpdateCacheLatencyNs;

@Metric(about = "average pagination for listKeys")
private MutableRate listKeysAveragePagination;

@Metric(about = "ops per second for listKeys")
private MutableGaugeFloat listKeysOpsPerSec;

@Metric(about = "ACLs check latency in listKeys")
private MutableRate listKeysAclCheckLatencyNs;

@Metric(about = "resolveBucketLink latency in listKeys")
private MutableRate listKeysResolveBucketLatencyNs;

@Metric(about = "readFromRockDb latency in listKeys")
private MutableRate listKeysReadFromRocksDbLatencyNs;

public void addLookupLatency(long latencyInNs) {
lookupLatencyNs.add(latencyInNs);
}
Expand Down Expand Up @@ -216,11 +226,23 @@ public MutableRate getValidateAndUpdateCacheLatencyNs() {
return validateAndUpdateCacheLatencyNs;
}

public void setListKeysAveragePagination(long keyCount) {
listKeysAveragePagination.add(keyCount);
}

public void setListKeysOpsPerSec(float opsPerSec) {
listKeysOpsPerSec.set(opsPerSec);
}

MutableRate getListKeysAclCheckLatencyNs() {
return listKeysAclCheckLatencyNs;
}

MutableRate getListKeysResolveBucketLatencyNs() {
return listKeysResolveBucketLatencyNs;
}

public void addListKeysReadFromRocksDbLatencyNs(long latencyInNs) {
listKeysReadFromRocksDbLatencyNs.add(latencyInNs);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ public class OmMetadataManagerImpl implements OMMetadataManager,
private final Map<String, TableCacheMetrics> tableCacheMetricsMap =
new HashMap<>();
private SnapshotChainManager snapshotChainManager;
private final OMPerformanceMetrics perfMetrics;
private final S3Batcher s3Batcher = new S3SecretBatcher();

/**
Expand All @@ -328,7 +329,15 @@ public class OmMetadataManagerImpl implements OMMetadataManager,
*/
public OmMetadataManagerImpl(OzoneConfiguration conf,
OzoneManager ozoneManager) throws IOException {
this(conf, ozoneManager, null);
}

public OmMetadataManagerImpl(OzoneConfiguration conf,
OzoneManager ozoneManager,
OMPerformanceMetrics perfMetrics)
throws IOException {
this.ozoneManager = ozoneManager;
this.perfMetrics = perfMetrics;
this.lock = new OzoneManagerLock(conf);
// TODO: This is a temporary check. Once fully implemented, all OM state
// change should go through Ratis - be it standalone (for non-HA) or
Expand All @@ -350,6 +359,7 @@ protected OmMetadataManagerImpl() {
OzoneConfiguration conf = new OzoneConfiguration();
this.lock = new OzoneManagerLock(conf);
this.omEpoch = 0;
perfMetrics = null;
}

public static OmMetadataManagerImpl createCheckpointMetadataManager(
Expand Down Expand Up @@ -384,6 +394,7 @@ private OmMetadataManagerImpl(OzoneConfiguration conf, File dir, String name)
setStore(loadDB(conf, dir, name, true,
java.util.Optional.of(Boolean.TRUE), Optional.empty()));
initializeOmTables(CacheType.PARTIAL_CACHE, false);
perfMetrics = null;
}


Expand Down Expand Up @@ -421,6 +432,7 @@ private OmMetadataManagerImpl(OzoneConfiguration conf, File dir, String name)
stop();
throw e;
}
perfMetrics = null;
}

@Override
Expand Down Expand Up @@ -1163,7 +1175,7 @@ public List<OmBucketInfo> listBuckets(final String volumeName,
public ListKeysResult listKeys(String volumeName, String bucketName,
String startKey, String keyPrefix, int maxKeys)
throws IOException {

long startNanos = Time.monotonicNowNanos();
List<OmKeyInfo> result = new ArrayList<>();
if (maxKeys <= 0) {
return new ListKeysResult(result, false);
Expand Down Expand Up @@ -1232,11 +1244,11 @@ public ListKeysResult listKeys(String volumeName, String bucketName,
cacheKeyMap.put(key, omKeyInfo);
}
}

long readFromRDbStartNs, readFromRDbStopNs = 0;
// Get maxKeys from DB if it has.

try (TableIterator<String, ? extends KeyValue<String, OmKeyInfo>>
keyIter = getKeyTable(getBucketLayout()).iterator()) {
readFromRDbStartNs = Time.monotonicNowNanos();
KeyValue< String, OmKeyInfo > kv;
keyIter.seek(seekKey);
// we need to iterate maxKeys + 1 here because if skipStartKey is true,
Expand All @@ -1259,10 +1271,24 @@ public ListKeysResult listKeys(String volumeName, String bucketName,
break;
}
}
readFromRDbStopNs = Time.monotonicNowNanos();
}

boolean isTruncated = cacheKeyMap.size() > maxKeys;

if (perfMetrics != null) {
long keyCount;
if (isTruncated) {
keyCount = maxKeys;
} else {
keyCount = cacheKeyMap.size();
}
perfMetrics.setListKeysAveragePagination(keyCount);
float opsPerSec =
keyCount / ((Time.monotonicNowNanos() - startNanos) / 1000000000.0f);
perfMetrics.setListKeysOpsPerSec(opsPerSec);
perfMetrics.addListKeysReadFromRocksDbLatencyNs(readFromRDbStopNs - readFromRDbStartNs);
}
// Finally DB entries and cache entries are merged, then return the count
// of maxKeys from the sorted map.
currentCount = 0;
Expand Down