cockroachdb / cockroachdb/pebble

cache: investigate using xsync.RBMutex

Open
#5,029 2 comments 0 reactions 0 assignees View on GitHub
A-storage C-performance T-storage
Dominant language
Go
Stars
6k
Forks
584
Avg merge
16h 35m
Merged PRs (30d)
5

Description

[`cache.shard`](https://github.com/cockroachdb/pebble/blob/master/internal/cache/clockpro.go#L79) currently provides mutual exclusion using a `sync.RWMutex`. We should investigate whether [`xsync.RBMutex`](https://github.com/puzpuzpuz/xsync?tab=readme-ov-file#rbmutex) provides better scalability under concurrent access. `xsync.RBMutex` is optimized for read-lock acquisition and for cache-like workloads where readers are much more frequent than writers.

Jira issue: PEBBLE-536

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in internal/cache/clockpro.go at cache.shard, where sync.RWMutex currently provides mutual exclusion. Read the xsync.RBMutex documentation, then compare the two mutexes under concurrent cache-like access; done means recording whether RBMutex provides better scalability and documenting the result.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
databases, performance
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.