Skip to content

avoid performing garbage collect on each topology update#118

Merged
bboreham merged 4 commits intomasterfrom
gc-topology-update
Oct 10, 2019
Merged

avoid performing garbage collect on each topology update#118
bboreham merged 4 commits intomasterfrom
gc-topology-update

Conversation

@murali-reddy
Copy link
Contributor

Fixes: #115

@bboreham
Copy link
Contributor

I think I would be happier if we did a garabgeCollect somewhere.
Maybe do it on the gossipTimer in localPeer ?

@murali-reddy
Copy link
Contributor Author

Updated PR to perform garbage collect corresponding to topology updates. Also timer is used trigger garbage collect at scheduled interval which will help coalesce topology updates.

@murali-reddy
Copy link
Contributor Author

addressed review comments. PTAL

gossip_test.go Outdated
}
}
// Allow topology to propagate
time.Sleep(1 * time.Second)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like this - sendPendingGossip() is carefully written to wait long enough already.

You could add a new function in peers_test.go like:

func forcePendingGC(routers ...*Router) {
	for _, router := range routers {
		router.Peers.Lock()
		if router.Peers.pendingGC {
			var pending peersPendingNotifications
			router.Peers.garbageCollect(&pending)
			router.Peers.unlockAndNotify(&pending)
		} else {
			router.Peers.Unlock()
		}
	}
}

then call it as necessary?

@bboreham
Copy link
Contributor

I note we can't run go test -race on this package any more, because TestDeferredShortIDReassignment() needs to create 4096 peers, and each peer now creates two goroutines, and the Go / LLVM ThreadSanitizer has a limit of 8128 goroutines.

@bboreham bboreham merged commit ea482fe into master Oct 10, 2019
@bboreham bboreham deleted the gc-topology-update branch October 10, 2019 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

high rate of Peers.garbageCollect() calls resulting from topology gossip

2 participants