Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sharedcache: move to fine-grained locking
Before this commit, s.mu was held when s.get & s.set were reading and writing to s.file. This was done to simplify merging an initial implementation with the necessary correctness properties. This commit moves to fine-grained locking, to improve the performance of the cache. A table mapping each cache block index to its "lock state" is introduced. During the reading and writing to s.file, only the specific cache block being updated is locked. Both read and write locks are supported, so that multiple reads of some cache block can be done concurrently. Also, writing back to the cache is now done asynchronously with respect to the call to ReadAt. With this commit merged, I think we can run some production experiments measuring the efficiency of the cache.
- Loading branch information