This is a draft implementation to remove global mutex in HashMapBackend.
This PR tries to avoiding locking the whole hashmap backend while updating or inserting new payload because our online service exists writing and reading actions at the same time. We need to ensure reading performance while writing actions exist.
The following is my change ideas:
I involve an atomic variable in Payload to implement a row lock.
I involve a mutex in Partition to protect insert a new payload action. Besides, parallel_flat_hash_map ensures the atomicity of adding/removing/updating an entry in flat hash map.
This is a draft implementation to remove global mutex in
HashMapBackend
. This PR tries to avoiding locking the whole hashmap backend while updating or inserting new payload because our online service exists writing and reading actions at the same time. We need to ensure reading performance while writing actions exist.The following is my change ideas:
Payload
to implement a row lock.Partition
to protectinsert a new payload
action. Besides,parallel_flat_hash_map
ensures the atomicity of adding/removing/updating an entry in flat hash map.