The worker pool is a thread pool that allows multiple jobs to run concurrently. The worker pool is normally started only when a full node is initialized. If a full node is not initialized, then no separate thread is started, and jobs are not run concurrently but sequentially.
This means that the performance of CLI commands that use the worker pool, like wallet:rescan, can vary drastically depending on whether a full node is running or not. This behavior is not documented and far from obvious from a user prospective.
To always offer the best performance, this commit changes the worker pool to ensure that threads are always spawned before executing any job.
Testing Plan
with a node NOT running:
Run wallet:rescan before this change. Observe that the CPU utilization does not exceed 100%
Run wallet:rescan after this change. Observe that the CPU utilization goes well beyond 100%
Alternatively: observe the time that wallet:rescan takes when running with/without a node.
Documentation
Does this change require any updates to the Iron Fish Docs (ex. the RPC API
Reference)? If yes, link a
related documentation pull request for the website.
[ ] Yes
Breaking Change
Is this a breaking change? If yes, add notes below on why this is breaking and label it with breaking-change-rpc or breaking-change-sdk.
Summary
The worker pool is a thread pool that allows multiple jobs to run concurrently. The worker pool is normally started only when a full node is initialized. If a full node is not initialized, then no separate thread is started, and jobs are not run concurrently but sequentially.
This means that the performance of CLI commands that use the worker pool, like
wallet:rescan
, can vary drastically depending on whether a full node is running or not. This behavior is not documented and far from obvious from a user prospective.To always offer the best performance, this commit changes the worker pool to ensure that threads are always spawned before executing any job.
Testing Plan
with a node NOT running:
wallet:rescan
before this change. Observe that the CPU utilization does not exceed 100%wallet:rescan
after this change. Observe that the CPU utilization goes well beyond 100%Alternatively: observe the time that
wallet:rescan
takes when running with/without a node.Documentation
Does this change require any updates to the Iron Fish Docs (ex. the RPC API Reference)? If yes, link a related documentation pull request for the website.
Breaking Change
Is this a breaking change? If yes, add notes below on why this is breaking and label it with
breaking-change-rpc
orbreaking-change-sdk
.