Skip to content

Commit

Permalink
sharedcache: move to fine-grained locking
Browse files Browse the repository at this point in the history
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
joshimhoff committed Jun 7, 2023
1 parent c34cb15 commit 77f4fbf
Show file tree
Hide file tree
Showing 3 changed files with 197 additions and 66 deletions.
Loading

0 comments on commit 77f4fbf

Please sign in to comment.