Adjust number of sync workers from 20 to 10. (#2077)

Adjust watch task min-pause-time to 1.minute.
Slowed down pause-time recovery by factor 3/4 instead of 1/2.
This commit is contained in:
Eugene Kabanov 2020-11-26 10:19:27 +02:00 committed by GitHub
parent c776d78c7d
commit 687cbaf94c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 11 deletions

View File

@ -30,7 +30,7 @@ const
PeerScoreMissingBlocks* = -200 PeerScoreMissingBlocks* = -200
## Peer response contains too many empty blocks. ## Peer response contains too many empty blocks.
SyncWorkersCount* = 20 SyncWorkersCount* = 10
## Number of sync workers to spawn ## Number of sync workers to spawn
StatusUpdateInterval* = chronos.minutes(1) StatusUpdateInterval* = chronos.minutes(1)
@ -1042,8 +1042,8 @@ proc syncLoop[A, B](man: SyncManager[A, B]) {.async.} =
proc watchTask() {.async.} = proc watchTask() {.async.} =
const const
MaxPauseTime = int(SECONDS_PER_SLOT) * int(SLOTS_PER_EPOCH) MaxPauseTime = int(SECONDS_PER_SLOT) * int(SLOTS_PER_EPOCH) # 06:24
MinPauseTime = int(SECONDS_PER_SLOT) MinPauseTime = int(SECONDS_PER_SLOT) * 5 # 01:00
pauseTime = MinPauseTime pauseTime = MinPauseTime
@ -1058,10 +1058,13 @@ proc syncLoop[A, B](man: SyncManager[A, B]) {.async.} =
if (op2 - op1 == 0'u64) and (pending > 1): if (op2 - op1 == 0'u64) and (pending > 1):
# Syncing is NOT progressing, we double `pauseTime` value, but value # Syncing is NOT progressing, we double `pauseTime` value, but value
# could not be bigger then `MaxPauseTime`. # could not be bigger then `MaxPauseTime`.
if (pauseTime shl 1) > MaxPauseTime: pauseTime =
pauseTime = MaxPauseTime block:
else: let newPauseTime = pauseTime * 2
pauseTime = pauseTime shl 1 if newPauseTime > MaxPauseTime:
MaxPauseTime
else:
newPauseTime
info "Syncing process is not progressing, reset the queue", info "Syncing process is not progressing, reset the queue",
start_op = op1, end_op = op2, start_op = op1, end_op = op2,
pending_workers_count = pending, pending_workers_count = pending,
@ -1072,10 +1075,13 @@ proc syncLoop[A, B](man: SyncManager[A, B]) {.async.} =
else: else:
# Syncing progressing, so reduce `pauseTime` value in half, but value # Syncing progressing, so reduce `pauseTime` value in half, but value
# could not be less then `MinPauseTime`. # could not be less then `MinPauseTime`.
if (pauseTime shr 1) < MinPauseTime: pauseTime =
pauseTime = MinPauseTime block:
else: let newPauseTime = (pauseTime * 3) div 4
pauseTime = pauseTime shr 1 if newPauseTime < MinPauseTime:
MinPauseTime
else:
newPauseTime
debug "Synchronization watch loop tick", debug "Synchronization watch loop tick",
wall_head_slot = man.getLocalWallSlot(), wall_head_slot = man.getLocalWallSlot(),