Skip to content
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

BP-49: Support read ahead async #3111

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -70,6 +70,11 @@ class DbLedgerStorageStats {
private static final String READ_CACHE_SIZE = "read-cache-size";
private static final String READ_CACHE_COUNT = "read-cache-count";

private static final String READ_AHEAD_TOTAL_TIME = "read-ahead-total-time";
private static final String READ_AHEAD_ASYNC_QUEUE_TIME = "read-ahead-async-queue-time";
private static final String READ_AHEAD_ASYNC_TOTAL_TIME = "read-ahead-async-total-time";
private static final String READ_AHEAD_ASYNC_BLOCK_TIME = "read-ahead-async-block-time";

@StatsDoc(
name = ADD_ENTRY,
help = "operation stats of adding entries to db ledger storage",
Expand Down Expand Up @@ -122,12 +127,12 @@ class DbLedgerStorageStats {
name = READAHEAD_BATCH_COUNT,
help = "the distribution of num of entries to read in one readahead batch"
)
private final OpStatsLogger readAheadBatchCountStats;
private final Counter readAheadBatchCountCounter;
@StatsDoc(
name = READAHEAD_BATCH_SIZE,
help = "the distribution of num of bytes to read in one readahead batch"
)
private final OpStatsLogger readAheadBatchSizeStats;
private final Counter readAheadBatchSizeCounter;
@StatsDoc(
name = READAHEAD_TIME,
help = "Time spent on readahead operations"
Expand Down Expand Up @@ -195,6 +200,31 @@ class DbLedgerStorageStats {
)
private final Gauge<Long> readCacheCountGauge;

@StatsDoc(
name = READ_AHEAD_TOTAL_TIME,
help = "time spent in reading ahead",
parent = READ_ENTRY
)
private final OpStatsLogger readAheadTotalTime;
@StatsDoc(
name = READ_AHEAD_ASYNC_QUEUE_TIME,
help = "time spent in the queue of reading ahead async",
parent = READ_ENTRY
)
private final OpStatsLogger readAheadAsyncQueueTime;
@StatsDoc(
name = READ_AHEAD_ASYNC_TOTAL_TIME,
help = "time spent of the entire task of reading ahead async",
parent = READ_ENTRY
)
private final OpStatsLogger readAheadAsyncTotalTime;
@StatsDoc(
name = READ_AHEAD_ASYNC_BLOCK_TIME,
help = "time spent in waiting the completion of reading ahead async",
parent = READ_ENTRY
)
private final OpStatsLogger readAheadAsyncBlockTime;

DbLedgerStorageStats(StatsLogger stats,
Supplier<Long> writeCacheSizeSupplier,
Supplier<Long> writeCacheCountSupplier,
Expand All @@ -208,8 +238,8 @@ class DbLedgerStorageStats {
readCacheMissCounter = stats.getCounter(READ_CACHE_MISSES);
writeCacheHitCounter = stats.getCounter(WRITE_CACHE_HITS);
writeCacheMissCounter = stats.getCounter(WRITE_CACHE_MISSES);
readAheadBatchCountStats = stats.getOpStatsLogger(READAHEAD_BATCH_COUNT);
readAheadBatchSizeStats = stats.getOpStatsLogger(READAHEAD_BATCH_SIZE);
readAheadBatchCountCounter = stats.getCounter(READAHEAD_BATCH_COUNT);
readAheadBatchSizeCounter = stats.getCounter(READAHEAD_BATCH_SIZE);
readAheadTime = stats.getThreadScopedCounter(READAHEAD_TIME);
flushStats = stats.getOpStatsLogger(FLUSH);
flushEntryLogStats = stats.getOpStatsLogger(FLUSH_ENTRYLOG);
Expand Down Expand Up @@ -270,6 +300,11 @@ public Long getSample() {
}
};
stats.registerGauge(READ_CACHE_COUNT, readCacheCountGauge);

readAheadTotalTime = stats.getOpStatsLogger(READ_AHEAD_TOTAL_TIME);
readAheadAsyncQueueTime = stats.getOpStatsLogger(READ_AHEAD_ASYNC_QUEUE_TIME);
readAheadAsyncTotalTime = stats.getOpStatsLogger(READ_AHEAD_ASYNC_TOTAL_TIME);
readAheadAsyncBlockTime = stats.getOpStatsLogger(READ_AHEAD_ASYNC_BLOCK_TIME);
}

}
Loading