Skip to content
Merged
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
6 changes: 6 additions & 0 deletions csnode/include/csnode/backwardsync.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,12 @@ class BackwardSync {
size_t storedSinceFlush_ = 0;
uint64_t progressAt_ = 0;
size_t progressStored_ = 0;
// the phases of storing since the last progress line, for its averages per block
uint64_t phaseVerifyUs_ = 0;
uint64_t phaseStoreUs_ = 0;
uint64_t phaseConfirmUs_ = 0;
uint64_t phaseTransactions_ = 0;
uint64_t progressBusyUs_ = 0;

std::atomic<bool> stopped_{false};
std::atomic<bool> started_{false};
Expand Down
14 changes: 14 additions & 0 deletions csnode/src/backwardsync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,16 @@ void BackwardSync::tick(const Context& ctx) {
std::to_string(busyUs_ / 1000) + " ms of processor thread so far (longest turn " + std::to_string(longestTurnUs_ / 1000) + " ms, " +
std::to_string(slowTurns_.load()) + " over " + std::to_string(kSlowTurnMs) + " ms; longest flush " +
std::to_string(longestFlushUs_ / 1000) + " ms)");
// where the time of a block goes, on average: what to move off the processor thread next
const uint64_t blocks = std::max<uint64_t>(1, stored_ - progressStored_);
const uint64_t busy = busyUs_ - progressBusyUs_;
log("BACKFILL: per block over the last " + std::to_string(blocks) + ": verify " + std::to_string(phaseVerifyUs_ / blocks) +
" us, store " + std::to_string(phaseStoreUs_ / blocks) + " us, confirmations " + std::to_string(phaseConfirmUs_ / blocks) +
" us, " + std::to_string(phaseTransactions_ * 100 / blocks / 100) + "." +
std::to_string(phaseTransactions_ * 100 / blocks % 100 / 10) + " transactions; processor thread busy " +
std::to_string(busy / 10 / std::max<uint64_t>(1, t - progressAt_)) + " % of the time");
phaseVerifyUs_ = phaseStoreUs_ = phaseConfirmUs_ = phaseTransactions_ = 0;
progressBusyUs_ = busyUs_;
progressAt_ = t;
progressStored_ = stored_;
}
Expand Down Expand Up @@ -641,6 +651,10 @@ void BackwardSync::drain() {
if (us > longestTurnUs_) {
longestTurnUs_ = us;
}
phaseVerifyUs_ += verifyUs;
phaseStoreUs_ += storeUs;
phaseConfirmUs_ += confirmUs;
phaseTransactions_ += transactions;
if (now() >= startedMs + kSlowTurnMs) {
const size_t n = ++slowTurns_;
if (n <= 20 || n % 100 == 0) {
Expand Down
4 changes: 3 additions & 1 deletion docs/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ lines under the new release.

## Not released yet

Nothing yet.
| PR | Change |
|---|---|
| #151 | csnode: every backfill progress line (each 100,000 blocks) is followed by the average cost of a block per phase (verify, store, confirmations), the transactions per block and the share of the processor thread the backfill took |

## community.15 — 2026-11-01

Expand Down
Loading