Skip to content

Commit fa7e2ee

Browse files
authored
Update default configuration for revoked HTLC clean-up (#3212)
The default configuration for removing old rows containing revoked HTLC data after a channel close was too slow and inadequate for most nodes. We update it to use smaller batches without a much shorter interval. Thanks @DerEwige for providing data about their experiments. Fixes #3211
1 parent f6a5a3c commit fa7e2ee

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

eclair-core/src/main/resources/reference.conf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -586,9 +586,10 @@ eclair {
586586
// down the node, we delete those rows in batches at regular intervals.
587587
revoked-htlc-info-cleaner {
588588
// Number of rows to delete per batch: a higher value will clean up the DB faster, but may have a higher impact on performance.
589-
batch-size = 50000
589+
batch-size = 500
590590
// Frequency at which batches of rows are deleted: a lower value will clean up the DB faster, but may have a higher impact on performance.
591-
interval = 15 minutes
591+
// If you are frequently closing or splicing channels, you may want to increase the default interval if you're seeing IO performance issues.
592+
interval = 1 seconds
592593
}
593594
}
594595

eclair-core/src/main/scala/fr/acinq/eclair/db/RevokedHtlcInfoCleaner.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,16 @@ object RevokedHtlcInfoCleaner {
4343
Behaviors.setup { context =>
4444
context.system.eventStream ! EventStream.Subscribe(context.self)
4545
Behaviors.withTimers { timers =>
46-
timers.startTimerWithFixedDelay(DeleteBatch, config.interval)
46+
timers.startSingleTimer(DeleteBatch, config.interval)
4747
Behaviors.receiveMessage {
4848
case ForgetHtlcInfos(channelId, beforeCommitIndex) =>
4949
db.markHtlcInfosForRemoval(channelId, beforeCommitIndex)
5050
Behaviors.same
5151
case DeleteBatch =>
5252
db.removeHtlcInfos(config.batchSize)
53+
// We restart a new timer after each batch, instead of using a timer at fixed intervals.
54+
// This ensures that we don't have DeleteBatch messages queuing up in the mailbox when the DB is busy.
55+
timers.startSingleTimer(DeleteBatch, config.interval)
5356
Behaviors.same
5457
}
5558
}

0 commit comments

Comments
 (0)