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

cache,db: de-dup concurrent attempts to read the same block #4157

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

Commits on Nov 26, 2024

  1. cache,db: de-dup concurrent attempts to read the same block

    Concurrent reads of the same block have been observed to cause very high
    memory usage, and cause significant CPU usage for allocations/deallocations.
    We now coordinate across multiple concurrent attempts to read the same
    block via a readEntry, which makes the readers take turns until one
    succeeds.
    
    The readEntries are embedded in a map that is part of a readShard, where
    there is a readShard for each cache.Shard. See the long comment in the
    readShard declaration for motivation. The Options.LoadBlockSema is
    integrated into the readEntry, to simplify the waiting logic in the
    caller.
    
    Callers interact with this new behavior via Cache.GetWithReadHandle,
    which is only for callers that intend to do a read and then populate
    the cache. If this method returns a ReadHandle, the caller has permission
    to do a read. See the ReadHandle comment for details of the contract.
    
    Fixes cockroachdb#4138
    sumeerbhola committed Nov 26, 2024
    Configuration menu
    Copy the full SHA
    0c589ad View commit details
    Browse the repository at this point in the history