Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

implements random eviction for read-only accounts cache#32721

Closed
behzadnouri wants to merge 1 commit intosolana-labs:masterfrom
behzadnouri:read-only-cache-2rand
Closed

implements random eviction for read-only accounts cache#32721
behzadnouri wants to merge 1 commit intosolana-labs:masterfrom
behzadnouri:read-only-cache-2rand

Conversation

@behzadnouri
Copy link
Copy Markdown
Contributor

Problem

Summary of Changes

Fixes #

@behzadnouri behzadnouri force-pushed the read-only-cache-2rand branch from 627c89f to bb8de94 Compare August 6, 2023 13:36
@codecov
Copy link
Copy Markdown

codecov Bot commented Aug 6, 2023

Codecov Report

Merging #32721 (a928e02) into master (6eea38d) will decrease coverage by 0.1%.
Report is 5 commits behind head on master.
The diff coverage is 98.9%.

@@            Coverage Diff            @@
##           master   #32721     +/-   ##
=========================================
- Coverage    82.0%    81.9%   -0.1%     
=========================================
  Files         785      785             
  Lines      211192   211177     -15     
=========================================
- Hits       173200   173089    -111     
- Misses      37992    38088     +96     

@behzadnouri
Copy link
Copy Markdown
Contributor Author

@jeffwashington this is an alternative approach using random evictions: https://danluu.com/2choices-eviction/

The upside is that loads only need atomic updates, so no write-locks in load function.
On the other hand, the algorithm is probabilistic in nature and stores need to do more work.

I have arbitrarily picked

const PRUNE_RANDOM_SAMPLE_SIZE: usize = 8;

but that could possibly be optimized based on performance tests on mainnet.

@behzadnouri behzadnouri force-pushed the read-only-cache-2rand branch from bb8de94 to a928e02 Compare August 7, 2023 18:03
@github-actions github-actions Bot added the stale [bot only] Added to stale content; results in auto-close after a week. label Aug 22, 2023
@github-actions github-actions Bot closed this Aug 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

stale [bot only] Added to stale content; results in auto-close after a week.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant