Skip to content
New issue

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

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

Already on GitHub? # to your account

Multithreaded vote processor #4600

Merged
merged 7 commits into from
May 7, 2024

Conversation

pwojcikdev
Copy link
Contributor

Changes vote processor to use multiple threads. While processing of votes inside the election container is still done under exclusive lock, this should help amortize time spent checking vote signatures.

@qwahzi qwahzi added this to the V27 milestone May 3, 2024
@gr0vity-dev
Copy link
Contributor

I tested this on a local network, and somehow the multi-threaded approach behaves inferior to the current develop branch.
Screenshot 2024-05-03 at 20 13 26

Here are the grafana stats

@pwojcikdev
Copy link
Contributor Author

pwojcikdev commented May 4, 2024

That's interesting, thanks for testing @gr0vity-dev. This would imply that the overhead of lock contention is the largest factor here. I fixed a small bug with thread notifications, but I don't think it should have a significant impact. It would be great if you could run your tests with various settings for batch_size and threads. For now I modified the default config to use a single thread by default.

@clemahieu
Copy link
Contributor

A frame graph would be good at identifying what's causing the slowdown, seems odd that one thread would be the fastest for an explicitly CPU-bound task.

@pwojcikdev
Copy link
Contributor Author

I received the flamegraph and was able to identify the bottleneck. It's now fixed and multithreaded version seems to perform better than single threaded, as expected.

@pwojcikdev pwojcikdev requested a review from clemahieu May 5, 2024 07:27
@gr0vity-dev
Copy link
Contributor

I did another side by side run between develop and the improved multi-threaded vote processor
Screenshot 2024-05-05 at 19 59 42

Here are the detailed grafana stats

@pwojcikdev pwojcikdev merged commit 687e5f3 into nanocurrency:develop May 7, 2024
24 of 26 checks passed
gr0vity-dev pushed a commit to gr0vity-dev/nano-node that referenced this pull request May 8, 2024
…rom pwojcikdev/vote-processor-threads

Multithreaded vote processor
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants