-
Notifications
You must be signed in to change notification settings - Fork 446
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
Perf/background task scheduler #6655
Conversation
src/Nethermind/Nethermind.Consensus/Scheduler/BackgroundTaskScheduler.cs
Outdated
Show resolved
Hide resolved
src/Nethermind/Nethermind.Consensus/Scheduler/BackgroundTaskScheduler.cs
Outdated
Show resolved
Hide resolved
src/Nethermind/Nethermind.Network/P2P/Subprotocols/Eth/V62/Eth62ProtocolHandler.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_restartQueueSignal.WaitOneAsync
in BackgroundTaskScheduler.cs
needs a bit of work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using ValueTasks everywhere where Task.FromResult is used.
P2PMessages need to be disposable and use disposable objects - like ArrayPoolList for collections, maybe also Pools for some complex objects can be achieved?
} | ||
|
||
protected BlockHeadersMessage FulfillBlockHeadersRequest(GetBlockHeadersMessage msg) | ||
protected Task<BlockHeadersMessage> FulfillBlockHeadersRequest(GetBlockHeadersMessage msg, CancellationToken cancellationToken) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why Task in the first place? Why not ValueTask if really needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding is that Task should still be the default unless it has been shown that ValueTask improve performance.
{ | ||
Array.Resize(ref blocks, i + 1); | ||
break; | ||
} | ||
} | ||
|
||
return new BlockBodiesMessage(blocks); | ||
return Task.FromResult(new BlockBodiesMessage(blocks)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we move from Array->ArrayPoolList?
Add a general purpose scheduler for running background tasks.
Effect
(after, before), OldBlocks and OldReceipts.
Looks more like it got worst. could just be that I was using the desktop before.
Snap serving barely have any effect in the first place.
With this background thread scheduler, I've no idea if it do something or it is just noise.
It does serve 25% more nodes per second though.
Changes
Types of changes
What types of changes does your code introduce?
Testing
Requires testing
If yes, did you write tests?
Notes on testing
Documentation
Requires documentation update
Requires explanation in Release Notes
Yes
No
Schedule background task to not occur during block processing.