Skip to content

Commit fe70a81

Browse files
committed
More granular bulk load metrics
1 parent 0a5adf9 commit fe70a81

File tree

7 files changed

+16
-13
lines changed

7 files changed

+16
-13
lines changed

Diff for: docs/metrics.md

+2
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ bucketlistDB-<X>.bulk.loads | meter | number of entries Buck
4444
bucketlistDB-live.bulk.inflationWinners | timer | time to load inflation winners
4545
bucketlistDB-live.bulk.poolshareTrustlines | timer | time to load poolshare trustlines by accountID and assetID
4646
bucketlistDB-live.bulk.prefetch | timer | time to prefetch
47+
bucketlistDB-live.bulk.eviction | timer | time to load for eviction scan
48+
bucketlistDB-live.bulk.query | timer | time to load for query server
4749
bucketlistDB-<X>.point.<Y> | timer | time to load single entry of type <Y> on BucketList <X> (live/hotArchive)
4850
bucketlistDB-cache.hit | meter | number of cache hits on Live BucketList Disk random eviction cache
4951
bucketlistDB-cache.miss | meter | number of cache misses on Live BucketList Disk random eviction cache

Diff for: src/bucket/BucketSnapshot.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,8 @@ LiveBucketSnapshot::scanForEviction(
237237

238238
auto processQueue = [&]() {
239239
auto loadResult = populateLoadedEntries(
240-
keysToSearch, bl.loadKeysWithLimits(keysToSearch, nullptr));
240+
keysToSearch,
241+
bl.loadKeysWithLimits(keysToSearch, "eviction", nullptr));
241242
for (auto& e : maybeEvictQueue)
242243
{
243244
// If TTL entry has not yet been deleted

Diff for: src/bucket/SearchableBucketList.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,9 @@ SearchableLiveBucketListSnapshot::loadInflationWinners(size_t maxWinners,
204204
std::vector<LedgerEntry>
205205
SearchableLiveBucketListSnapshot::loadKeysWithLimits(
206206
std::set<LedgerKey, LedgerEntryIdCmp> const& inKeys,
207-
LedgerKeyMeter* lkMeter) const
207+
std::string const& label, LedgerKeyMeter* lkMeter) const
208208
{
209-
auto timer = getBulkLoadTimer("prefetch", inKeys.size()).TimeScope();
209+
auto timer = getBulkLoadTimer(label, inKeys.size()).TimeScope();
210210
auto op = loadKeysInternal(inKeys, lkMeter, std::nullopt);
211211
releaseAssertOrThrow(op);
212212
return std::move(*op);

Diff for: src/bucket/SearchableBucketList.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class SearchableLiveBucketListSnapshot
2828

2929
std::vector<LedgerEntry>
3030
loadKeysWithLimits(std::set<LedgerKey, LedgerEntryIdCmp> const& inKeys,
31-
LedgerKeyMeter* lkMeter) const;
31+
std::string const& label, LedgerKeyMeter* lkMeter) const;
3232

3333
EvictionResultCandidates scanForEviction(
3434
uint32_t ledgerSeq, EvictionCounters& counters, EvictionIterator iter,

Diff for: src/bucket/test/BucketIndexTests.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ class BucketIndexTest
310310

311311
// Test bulk load lookup
312312
auto loadResult =
313-
searchableBL->loadKeysWithLimits(mKeysToSearch, nullptr);
313+
searchableBL->loadKeysWithLimits(mKeysToSearch, "test", nullptr);
314314
validateResults(mTestEntries, loadResult);
315315

316316
if (expectedHitRate)
@@ -358,8 +358,8 @@ class BucketIndexTest
358358
mKeysToSearch.size());
359359

360360
// Run bulk lookup again
361-
auto loadResult2 =
362-
searchableBL->loadKeysWithLimits(mKeysToSearch, nullptr);
361+
auto loadResult2 = searchableBL->loadKeysWithLimits(
362+
mKeysToSearch, "test", nullptr);
363363
validateResults(mTestEntries, loadResult2);
364364

365365
checkHitRate(expectedHitRate, startingHitCount, startingMissCount,
@@ -403,7 +403,7 @@ class BucketIndexTest
403403
}
404404

405405
auto blLoad =
406-
searchableBL->loadKeysWithLimits(searchSubset, nullptr);
406+
searchableBL->loadKeysWithLimits(searchSubset, "test", nullptr);
407407
validateResults(testEntriesSubset, blLoad);
408408
}
409409
}
@@ -422,8 +422,8 @@ class BucketIndexTest
422422
LedgerKeySet invalidKeys(keysNotInBL.begin(), keysNotInBL.end());
423423

424424
// Test bulk load
425-
REQUIRE(searchableBL->loadKeysWithLimits(invalidKeys, nullptr).size() ==
426-
0);
425+
REQUIRE(searchableBL->loadKeysWithLimits(invalidKeys, "test", nullptr)
426+
.size() == 0);
427427

428428
// Test individual load
429429
for (auto const& key : invalidKeys)

Diff for: src/ledger/LedgerTxn.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -2950,7 +2950,7 @@ LedgerTxnRoot::Impl::prefetchInternal(UnorderedSet<LedgerKey> const& keys,
29502950
insertIfNotLoaded(keysToSearch, key);
29512951
}
29522952
auto blLoad = getSearchableLiveBucketListSnapshot().loadKeysWithLimits(
2953-
keysToSearch, lkMeter);
2953+
keysToSearch, "prefetch", lkMeter);
29542954
cacheResult(populateLoadedEntries(keysToSearch, blLoad, lkMeter));
29552955

29562956
return total;

Diff for: src/main/QueryServer.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,8 @@ QueryServer::getLedgerEntryRaw(std::string const& params,
169169
// Otherwise default to current ledger
170170
else
171171
{
172-
loadedKeys =
173-
bl.loadKeysWithLimits(orderedKeys, /*lkMeter=*/nullptr);
172+
loadedKeys = bl.loadKeysWithLimits(orderedKeys, "query",
173+
/*lkMeter=*/nullptr);
174174
root["ledgerSeq"] = bl.getLedgerSeq();
175175
}
176176

0 commit comments

Comments
 (0)