Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multi: replace per channel sigPool with global daemon level sigPool #2329

Merged
merged 1 commit into from Dec 18, 2018

Conversation

Projects
None yet
3 participants
@Roasbeef
Copy link
Member

commented Dec 15, 2018

In this commit, we remove the per channel sigPool within the
lnwallet.LightningChannel struct. With this change, we ensure that as
the number of channels grows, the number of gouroutines idling in the
sigPool stays constant. It's the case that currently on the daemon, most
channels are likely inactive, with only a hand full actually
consistently carrying out channel updates. As a result, this change
should reduce the amount of idle CPU usage, as we have less active
goroutines in select loops.

In order to make this change, the SigPool itself has been publicly
exported such that outside callers can make a SigPool and pass it into
newly created channels. Since the sig pool now lives outside the
channel, we were also able to do away with the Stop() method on the
channel all together.

Finally, the server is the sub-system that is currently responsible for
managing the SigPool within lnd.

@@ -1467,18 +1459,6 @@ func (lc *LightningChannel) createStateHintObfuscator() {
}
}

// Stop gracefully shuts down any active goroutines spawned by the
// LightningChannel during regular duties.
func (lc *LightningChannel) Stop() {

This comment has been minimized.

Copy link
@wpaulino

wpaulino Dec 15, 2018

Collaborator

Nit: looks like we can also remove the now unused shutdown and quit members.

@cfromknecht

This comment has been minimized.

Copy link
Collaborator

commented Dec 16, 2018

breacharbiter_test doesn't compile atm

# github.com/lightningnetwork/lnd [github.com/lightningnetwork/lnd.test]
./breacharbiter_test.go:1573:43: undefined: bobPool
multi: replace per channel sigPool with global daemon level sigPool
In this commit, we remove the per channel `sigPool` within the
`lnwallet.LightningChannel` struct. With this change, we ensure that as
the number of channels grows, the number of gouroutines idling in the
sigPool stays constant. It's the case that currently on the daemon, most
channels are likely inactive, with only a hand full actually
consistently carrying out channel updates. As a result, this change
should reduce the amount of idle CPU usage, as we have less active
goroutines in select loops.

In order to make this change, the `SigPool` itself has been publicly
exported such that outside callers can make a `SigPool` and pass it into
newly created channels. Since the sig pool now lives outside the
channel, we were also able to do away with the Stop() method on the
channel all together.

Finally, the server is the sub-system that is currently responsible for
managing the `SigPool` within lnd.

@Roasbeef Roasbeef force-pushed the Roasbeef:global-sig-pool branch from 5086c91 to fa160f5 Dec 16, 2018

@Roasbeef

This comment has been minimized.

Copy link
Member Author

commented Dec 16, 2018

Fixed, PTAL!

@wpaulino
Copy link
Collaborator

left a comment

Ran this on my testnet node and confirmed this reduced the amount of goroutines from one per channel to one globally. LGTM 🎯

@Roasbeef Roasbeef merged commit 152fc8b into lightningnetwork:master Dec 18, 2018

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage increased (+0.02%) to 55.674%
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.