You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Replace the account recency LRU with lock-free S3-FIFO #204
Keep frequently read non-authoritative accounts resident under churn by replacing the scc::HashCache LRU in keeper::cache::AccountCache with a lock-free S3-FIFO cache, and let callers record read hits without acquiring an account lease.
Why
Every recency eviction makes the validator unsubscribe the account and delete it from the bank. The next read fetches it upstream again (getMultipleAccounts) and resubscribes. On nodes where RPC middleware fans requests out to many distinct pubkeys, this dominates upstream RPC spend.
The current LRU has three problems for this workload:
Recency is promoted only when an account is materialized or a request is satisfied; plain reads are invisible to the cache.
LRU has no frequency signal, so a burst of one-off pubkeys flushes the hot set.
HashCache rounds capacity up to a power of two (minimum 256) and may evict early under bucket pressure, so lru-capacity is not the real resident bound.
S3-FIFO (Yang et al., SOSP '23) sends new keys through a small probationary FIFO, promotes keys that are hit again into a main FIFO, and readmits recently evicted keys through a ghost queue. Hits only bump a 2-bit atomic counter, so the read path stays lock-free.
Scope
Changes:
Replace the recency HashCache in AccountCache with an S3-FIFO cache: scc::HashIndex index (lock-free reads), bounded crossbeam_queue::ArrayQueue small/main/ghost queues, atomic per-entry frequency.
Add AccountsAccessor::touch(&Pubkey), a lock-free hit recorder for already-resident accounts.
Make lru_capacity an exact resident bound and update its documentation.
The eviction notification contract: pubkeys still go out on the subscribe_evictions channel, and cached_eviction_applies still re-checks residency under the lease.
Lease semantics, and authoritative accounts never entering recency.
Activity