Skip to content

Commit ca10478

Browse files
committed
Add metrics for block downloads
1 parent 2b25535 commit ca10478

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

execution_chain/config.nim

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,13 @@ type
544544
defaultValue: 128
545545
name: "debug-portal-workers".}: int
546546

547+
alpha* {.
548+
hidden,
549+
desc: "The Kademlia concurrency factor",
550+
defaultValue: 3,
551+
name: "debug-alpha"
552+
.}: int
553+
547554
of `import-rlp`:
548555
blocksFile* {.
549556
argument

execution_chain/nimbus_import.nim

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ declareCounter nec_imported_transactions, "Transactions processed during import"
4141

4242
declareCounter nec_imported_gas, "Gas processed during import"
4343

44+
declareGauge nec_download_block_number, "Latest in order downloaded block number"
45+
46+
declareCounter nec_downloaded_blocks, "Blocks downloaded during import"
47+
48+
4449
var running {.volatile.} = true
4550

4651
proc openCsv(name: string): File =
@@ -187,7 +192,7 @@ proc run(config: NimbusConf): PortalNode {.
187192
## Portal node setup
188193
let
189194
portalProtocolConfig = PortalProtocolConfig.init(
190-
DefaultTableIpLimit, DefaultBucketIpLimit, DefaultBitsPerHop, defaultAlpha, RadiusConfig(kind: Static, logRadius: 249),
195+
DefaultTableIpLimit, DefaultBucketIpLimit, DefaultBitsPerHop, config.alpha, RadiusConfig(kind: Static, logRadius: 249),
191196
defaultDisablePoke, defaultMaxGossipNodes, defaultContentCacheSize,
192197
defaultDisableContentCache, defaultMaxConcurrentOffers, defaultDisableBanNodes,
193198
)
@@ -227,7 +232,7 @@ proc getBlockLoop(
227232
startBlock: uint64,
228233
portalWorkers: int,
229234
): Future[void] {.async.} =
230-
const bufferSize = 8192
235+
const bufferSize = 8192*4
231236

232237
let
233238
historyNetwork = node.historyNetwork.value()
@@ -257,6 +262,7 @@ proc getBlockLoop(
257262

258263
continue
259264

265+
nec_downloaded_blocks.inc()
260266
blocks[i] = init(EthBlock, header, body)
261267
downloadFinished[i] = true
262268
totalDownloadCount.inc()
@@ -277,6 +283,9 @@ proc getBlockLoop(
277283

278284
while true:
279285
while downloadFinished[nextReadIndex]:
286+
# TODO: Fix this counter, it's not accurate as blockNumberOffset updates
287+
# differently than the block being passed around here
288+
nec_download_block_number.set((blockNumberOffset + nextReadIndex.uint64).int64)
280289
debug "Adding block to the processing queue",
281290
blockNumber = blockNumberOffset + nextReadIndex.uint64
282291
await blockQueue.addLast(blocks[nextReadIndex])

0 commit comments

Comments
 (0)