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

Accounts read cache evictor polls instead of checking a channel #3891

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

brooksprumo
Copy link

@brooksprumo brooksprumo commented Dec 3, 2024

Problem

In #3867, there was a discussion that prompted me to consider if there was a need for a channel at all, now that we're using try_recv() instead of recv() in the evictor: #3867 (comment)

Using a channel here now seems redundant, and only adds unnecessary work. We still check every 100 ms without a channel, so can we remove the channel entirely?

Summary of Changes

Remove the channel for the accounts read cache evictor. We're already polling every 100 ms anyway.

Results

I ran this PR against master, similar to what I showed in #3867 (comment).

These graphs are over 1 hour. Purple is this PR, blue is master.

Here's time to store. Looks the same to me:
store

Total size of the cache. Again, looks the same to me:
size

Wakeups are the same, as expected:
wakeup all

wakeup productive

Overall, this PR's perf looks similar to master. I wouldn't expect much difference. We may only see a meaningful difference where there would've been contention in store() when sending an eviction message.

@brooksprumo brooksprumo self-assigned this Dec 3, 2024
@brooksprumo brooksprumo marked this pull request as ready for review December 3, 2024 18:03
Comment on lines -206 to -208
if self.data_size() > self.max_data_size_hi {
self.send_evict();
}
Copy link
Author

Choose a reason for hiding this comment

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

This is the main win. Now the foreground thread, when it calls store(), doesn't need to check the data size and send an evict message.

Copy link

@HaoranYi HaoranYi left a comment

Choose a reason for hiding this comment

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

lgtm.
simpler and faster!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants