Take every down peer out of the table in one walk (closes #225)
check / check (push) Canceled after 0s
check / check (push) Canceled after 0s
The prefix handler ran one PeerDown per peer, one after another, and stopped taking messages at 20,000 held-back messages. Sessions going down together queued up their walks, so a returning full-table peer could reach that limit. The table's PeersDown now takes several peers out of every prefix in one walk. One walk runs at a time. The next one takes every peer whose session went down meanwhile, so a message is held back for two walks at most. Each walk takes about 2.6 seconds for each full-table peer it takes out. The limit is now 150,000 messages, about 150 MiB: enough when four full-table peers go down together. The status page shows how many messages each handler holds back. Model: opus-5-5
This commit is contained in:
@@ -351,6 +351,10 @@ type HandlerStats struct {
|
||||
AvgProcessTime time.Duration
|
||||
MinProcessTime time.Duration
|
||||
MaxProcessTime time.Duration
|
||||
// HeldBackCount is how many messages the handler holds back to apply
|
||||
// later: what its HeldBackCount method returns, or 0 for a handler
|
||||
// without one.
|
||||
HeldBackCount int
|
||||
}
|
||||
|
||||
// GetHandlerStats returns a snapshot of performance statistics for all registered
|
||||
@@ -392,6 +396,11 @@ func (s *Streamer) GetHandlerStats() []HandlerStats {
|
||||
|
||||
info.metrics.mu.Unlock()
|
||||
|
||||
holder, holdsBack := info.handler.(interface{ HeldBackCount() int })
|
||||
if holdsBack {
|
||||
hs.HeldBackCount = holder.HeldBackCount()
|
||||
}
|
||||
|
||||
stats = append(stats, hs)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user