[Feature]: Run cachemulti.store.write in parallel #20787
Open
Description
opened on Jun 26, 2024
Summary
Cachemulti.store.Write calls every constituent CacheKV store's write method. https://github.com/cosmos/cosmos-sdk/blob/main/store/cachemulti/store.go#L122-L128
Now that in SDK v50 onwards we are using working hashes, where these don't directly write to a shared DB, we should switch this to doing every write in a goroutine and having a sync.WaitGroup to wait for all the writes to complete
Problem Definition
Improves an important speed bottleneck in block execution + syncing.
Proposed Feature
Make the code
// Write calls Write on each underlying store.
func (cms Store) Write() {
cms.db.Write()
wg := sync.WaitGroup{}
wg.Add(len(cms.stores))
for _, store := range cms.stores {
go func() {
store.Write()
wg.Done()
}()
}
wg.Wait()
}
Metadata
Assignees
Labels
Type
Projects
Status
👀 Waiting / In review
Activity