Skip to content
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

politeiad: Execute batch reads concurrently. #1584

Merged
merged 4 commits into from Dec 3, 2021

Conversation

lukebp
Copy link
Member

@lukebp lukebp commented Nov 23, 2021

Part of #1582.

This commit updates the politeiad batch read route to execute the read
commands concurrently instead of serially in order to improve
performance.

A batch of read commands is executed using a sync WaitGroup counter to
track the completion status of the commands and a shared memory cache to
aggregate the replies. Each batch uses its own unique memory cache.

This performance optimization cut the execution time of a 5 command batch
by ~50%.

This commit updates the politeiad batch read route to execute the read
commands concurrently instead of serially in order to improve
performance.

Each batch of read commands is executed using a sync WaitGroup counter
to track the completion status of the commands and a shared memory cache
to aggreate the replies. The memory cache is local to each read batch.
This commit updates the politeiad batch read route to execute the read
commands concurrently instead of serially in order to improve
performance.

A batch of read commands is executed using a sync WaitGroup counter to
track the completion status of the commands and a shared memory cache to
aggregate the replies. Each batch uses its own unique memory cache.

This performance optimization cut the execution of a 5 command read
batch by ~50%.
@lukebp lukebp changed the title [WIP] politeiad: Execute batch reads concurrently. politeiad: Execute batch reads concurrently. Nov 24, 2021
@lukebp lukebp requested a review from amass01 November 24, 2021 17:28
Copy link
Member

@amass01 amass01 left a comment

Choose a reason for hiding this comment

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

Pretty neat

@lukebp
Copy link
Member Author

lukebp commented Nov 29, 2021

@amass01 please test this when you get a chance.

Copy link
Member

@amass01 amass01 left a comment

Choose a reason for hiding this comment

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

tACK.

Noticed 50% performance improvement.

@lukebp lukebp merged commit 760e539 into decred:master Dec 3, 2021
@lukebp lukebp added 91cfcc8 performance-impovement pi-not-deployed This item has been merged into master, but has not been deployed to production yet. labels Dec 3, 2021
@lukebp lukebp deleted the concurrent-reads branch February 6, 2022 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance-impovement pi-not-deployed This item has been merged into master, but has not been deployed to production yet.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants