From 0a4de859a270a270471ab0195c2a6c672131190c Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Sun, 28 Jan 2018 14:55:24 -0800 Subject: [PATCH] discovery+routing: reduce number of active validation barrier jobs In order to reduce high CPU utilization during the initial network view sync, we slash down the total number of active in-flight jobs that can be launched. --- discovery/gossiper.go | 2 +- peer.go | 2 +- routing/router.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/discovery/gossiper.go b/discovery/gossiper.go index ec81fd24..75e8d676 100644 --- a/discovery/gossiper.go +++ b/discovery/gossiper.go @@ -833,7 +833,7 @@ func (d *AuthenticatedGossiper) networkHandler() { // We'll use this validation to ensure that we process jobs in their // dependency order during parallel validation. validationBarrier := routing.NewValidationBarrier( - runtime.NumCPU()*10, d.quit, + runtime.NumCPU()*4, d.quit, ) for { diff --git a/peer.go b/peer.go index e643c223..e69255d3 100644 --- a/peer.go +++ b/peer.go @@ -1148,7 +1148,7 @@ func (p *peer) queueMsg(msg lnwire.Message, errChan chan error) { select { case p.outgoingQueue <- outgoinMsg{msg, errChan}: case <-p.quit: - peerLog.Debugf("Peer shutting down, could not enqueue msg.") + peerLog.Tracef("Peer shutting down, could not enqueue msg.") if errChan != nil { errChan <- fmt.Errorf("peer shutting down") } diff --git a/routing/router.go b/routing/router.go index cef4f9c0..f0ebae96 100644 --- a/routing/router.go +++ b/routing/router.go @@ -518,7 +518,7 @@ func (r *ChannelRouter) networkHandler() { // We'll use this validation barrier to ensure that we process all jobs // in the proper order during parallel validation. - validationBarrier := NewValidationBarrier(runtime.NumCPU()*10, r.quit) + validationBarrier := NewValidationBarrier(runtime.NumCPU()*4, r.quit) for { select {