-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Evaluation of Datastore Caching changes #581
Comments
Datastore CachingThis is part of the work to reduce the difference between lbm-sdk and cosmos-sdk. ProcessI proceeded to remove the cache manager of iavl. Performance improvements were made in the repository fork cosmos/iavl and tendermint/tm-db. However, there was a problem that the race test failed due to the changed part. MethodA benchmark was performed by executing package pfm
import (
"encoding/json"
"math/rand"
"strconv"
"testing"
abci "github.com/line/ostracon/abci/types"
"github.com/line/ostracon/libs/log"
ocproto "github.com/line/ostracon/proto/ostracon/types"
dbm "github.com/tendermint/tm-db"
"github.com/stretchr/testify/require"
"github.com/line/lbm-sdk/simapp"
sdk "github.com/line/lbm-sdk/types"
)
func BenchmarkBaseAccount(b *testing.B) {
encCfg := simapp.MakeTestEncodingConfig()
app := simapp.NewSimApp(log.NewNopLogger(), dbm.NewMemDB(), nil, true, map[int64]bool{}, simapp.DefaultNodeHome, 0, encCfg, simapp.EmptyAppOptions{}, nil)
genState := simapp.NewDefaultGenesisState(encCfg.Marshaler)
stateBytes, err := json.MarshalIndent(genState, "", " ")
require.NoError(b, err)
app.InitChain(abci.RequestInitChain{
Validators: []abci.ValidatorUpdate{},
ConsensusParams: simapp.DefaultConsensusParams,
AppStateBytes: stateBytes,
})
ctx := app.NewContext(false, ocproto.Header{})
addrs := []sdk.AccAddress{}
addrCount := 100000
coin := sdk.NewCoins(sdk.NewCoin("atom", sdk.NewInt(1000000000)))
for ii := 0; ii < addrCount; ii++ {
addr := sdk.AccAddress("addr" + strconv.Itoa(ii))
acc := app.AccountKeeper.NewAccountWithAddress(ctx, addr)
app.AccountKeeper.SetAccount(ctx, acc)
simapp.FundAccount(app, ctx, addr, coin)
addrs = append(addrs, addr)
}
sendAmount := sdk.NewCoins(sdk.NewCoin("atom", sdk.NewInt(1)))
b.Run("Testing/IAVLCache", func(b *testing.B) {
for ii := 0; ii < b.N; ii++ {
from := rand.Intn(addrCount)
to := rand.Intn(addrCount)
// if fixed case:
// from := 0
// to := 1
err = app.BankKeeper.SendCoins(ctx, addrs[from], addrs[to], sendAmount)
}
})
require.NoError(b, err)
} ResultThe following table is the performance of
ConclusionI can't think of any reason to keep the our fork versions(line/iavl and line/tm-db) of cosmos/iavl and tendermint/tm-db. |
Summary
Reconsideration of the data cache mechanism added to the datastore layer.
This task is to sort out useful features in order to reduce the differences between lbm-sdk and cosmos-sdk.
Parent: #549
For Admin Use
The text was updated successfully, but these errors were encountered: