use RWMutex when no TTLs are used
raulk opened this issue · 3 comments
Segments are guarded by a sync.Mutex
. If the user promises to not use TTLs at construction time (with an option), these locks could be changed to sync.RWMutex
for increased throughput in read-predominant, highly concurrent workloads.
We could also stop tracking the access time entirely, which would allow us to pack more data in the same size, as well as squeeze a little bit more performance (time.Now() translates into a syscall).
RWMutex
may perform worse than Mutex
if there is very little contention.
RWMutex
may perform worse thanMutex
if there is very little contention.
Can u explain more about why RWMutex may perform worse than Mutex ?
RWMutex
may perform worse thanMutex
if there is very little contention.Can u explain more about why RWMutex may perform worse than Mutex ?
RWMutex does more work than Mutex for Lock
operation.