Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Create peer discovery packets on a worker thread (back port to 1.0) #961

Merged
merged 2 commits into from
Feb 25, 2019

Conversation

ajsutton
Copy link
Contributor

PR description

Backports #955 to 1.0 branch.

Creating peer discovery packets involves cryptographically signing the contents which is a fairly expensive operation. When we do that for a bunch of messages at once, such as when bonding to newly discovered peers, it can cause the Vertx event thread to be blocked for multiple seconds, causing errors and slow processing of incoming messages.

This change moves creation and signing of packets onto worker threads so that the event queue isn't blocked but ensures that the created packet is then delivered back on the event queue to maintain the single-threaded behaviour the code requires.

Copy link
Contributor

@shemnon shemnon left a comment

Choose a reason for hiding this comment

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

LGTM from an engineering perspective.

@ajsutton ajsutton merged commit d82f088 into PegaSysEng:1.0.0 Feb 25, 2019
@ajsutton ajsutton deleted the backport-discovery-packets branch February 25, 2019 22:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants