-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
util: use StampetLock to improve cache efficiency
Motivation: The cache class uses a regular lock object to guard the access to cache's internal storage. The same lock is used for read and writes. As cache's access pattern typically read dominated, the concurrent reads are appreciated. However, the Cache#get might remove expired entries, thus a shared read lock should be promoted into a write lock. As Cache class is used as NFS client session holder, any nfs4.x accesses (mostly) read or write into it, thus cache throughput has a direct influence on the NFS server performace in concurrent environments. Modification: Use StampedLock to guard the access to Cache's internal storage. Promote read lock to a write lock if needed or re-lock with a read lock before modifying. Result: Better cache throughput in read dominated concurrent environment. ReentrantLock Benchmark Mode Cnt Score Error Units CacheBenchmark.cacheGetBenchmark thrpt 25 3362040,369 ± 166081,245 ops/s StampetLock Benchmark Mode Cnt Score Error Units CacheBenchmark.cacheGetBenchmark thrpt 25 5280790,414 ± 162177,161 ops/s Target: master Acked-by: Lea Morschel
- Loading branch information
Showing
1 changed file
with
30 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters