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

NC-1880 High TX volume swamps block processing #337

Merged
merged 5 commits into from
Dec 3, 2018

Conversation

shemnon
Copy link
Contributor

@shemnon shemnon commented Nov 30, 2018

PR description

Move transaction processing into its own thread(s).

Fixed Issue(s)

Fixes NC-1880

Move transaction processing into it's own thread(s).
@@ -43,6 +43,7 @@

protected final ExecutorService workerExecutor;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we rename this syncWorkerExecutor?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -56,13 +57,21 @@
new ThreadFactoryBuilder()
.setDaemon(true)
.setNameFormat(EthScheduler.class.getSimpleName() + "Timer")
.build()),
Executors.newFixedThreadPool(
workerCount,
Copy link
Contributor

Choose a reason for hiding this comment

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

We probably want a separate count for the tx workers, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

* Allow txWorkerExecutor threads to be independently configured
  * push the above to the config and across the tests
@@ -92,7 +101,11 @@ protected EthScheduler(
}

public Future<?> scheduleWorkerTask(final Runnable command) {
Copy link
Contributor

Choose a reason for hiding this comment

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

scheduleSyncWorkerTask?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. Also scheduleTxWorkerTask, so both align with the field name.

@ajsutton ajsutton added the bug Something isn't working label Dec 2, 2018
@@ -744,4 +755,38 @@ public void shouldSuccessfullyRespondToGetHeadersRequestLessThanZero()
done.get();
}
}

@Test
public void transactionMessagesGoToTheCorrectExecutor() {
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick - this might make more sense in the TransactionPoolFactory test, as the tx pool is the object deciding how to use the workers

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The message dispatch occurs within the EthProtocolManager, even though TransactionPool is the one registering the listener. EthProtocolManager::processMessage calls are key to this test. Also, this would result in core then depending on eth (at least the tests) and would result in a quasi-circular dependency. While it does bring the test closer to the other half of the code that is being tested EthScheduler is also as much under test. But the number of new quasi-circular imports that :ethereum:core_test would gain if I moved the test persuades me to leave it where it is.

@@ -142,7 +142,8 @@
protocolContext.getBlockchain(),
networkId,
fastSyncEnabled,
syncConfig.downloaderParallelism());
syncConfig.downloaderParallelism(),
syncConfig.transactionsParallelism());
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick (optional) - it looks like SyncConfig is becoming EthConfig - maybe we should rename and move it??

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There may be more to it than a surface renaming. Spun off to NC-1993.

@shemnon shemnon merged commit abaaef7 into PegaSysEng:master Dec 3, 2018
@shemnon shemnon deleted the NC-1880 branch January 25, 2019 21:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants