Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Perf: Relax locking contention for cache and cachekv (#353)
## Describe your changes and provide context **Problem:** Currently when doing profiling, there are lot of locking contention happening in the cachekv layer, this is because we are using mutex for all read and write keys, but cachekv as a transient cache doesn't really need such a strict locking mechanism. Having a high locking contention would hurt the parallelize transaction execution performance a lot. **Solution:** - Replace BoundedCache with sync.map to have a per key based locking. We don't really need to bound the cache size for transient cachekv store since the cache will be destroyed after the block is finalized. - Do not read through the cache. When call get, previously we will also write the value to the cache which requires us to add a lock around the whole read+write back operation, however, as a transient cache, this wouldn't actually help benefit with cache hit too much, removing the read through behavior would help reduce contention a lot - Relax and narrow the locking scope for commitkvcache, this will still be used as an inter block cache ## Testing performed to validate your change Fully tested in loadtest env
- Loading branch information