add measure datastore wrapper around bench chain datastore
This commit is contained in:
parent
9c17ac5bde
commit
00d1e6b549
@ -34,6 +34,7 @@ import (
|
|||||||
bdg "github.com/dgraph-io/badger/v2"
|
bdg "github.com/dgraph-io/badger/v2"
|
||||||
"github.com/ipfs/go-datastore"
|
"github.com/ipfs/go-datastore"
|
||||||
badger "github.com/ipfs/go-ds-badger2"
|
badger "github.com/ipfs/go-ds-badger2"
|
||||||
|
measure "github.com/ipfs/go-ds-measure"
|
||||||
pebbleds "github.com/ipfs/go-ds-pebble"
|
pebbleds "github.com/ipfs/go-ds-pebble"
|
||||||
|
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
@ -89,6 +90,9 @@ var importBenchCmd = &cli.Command{
|
|||||||
&cli.BoolFlag{
|
&cli.BoolFlag{
|
||||||
Name: "only-import",
|
Name: "only-import",
|
||||||
},
|
},
|
||||||
|
&cli.BoolFlag{
|
||||||
|
Name: "use-pebble",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Action: func(cctx *cli.Context) error {
|
Action: func(cctx *cli.Context) error {
|
||||||
vm.BatchSealVerifyParallelism = cctx.Int("batch-seal-verify-threads")
|
vm.BatchSealVerifyParallelism = cctx.Int("batch-seal-verify-threads")
|
||||||
@ -126,7 +130,7 @@ var importBenchCmd = &cli.Command{
|
|||||||
bdgOpt.Options.DetectConflicts = false
|
bdgOpt.Options.DetectConflicts = false
|
||||||
|
|
||||||
var bds datastore.Batching
|
var bds datastore.Batching
|
||||||
if false {
|
if cctx.Bool("use-pebble") {
|
||||||
cache := 512
|
cache := 512
|
||||||
bds, err = pebbleds.NewDatastore(tdir, &pebble.Options{
|
bds, err = pebbleds.NewDatastore(tdir, &pebble.Options{
|
||||||
// Pebble has a single combined cache area and the write
|
// Pebble has a single combined cache area and the write
|
||||||
@ -155,6 +159,9 @@ var importBenchCmd = &cli.Command{
|
|||||||
}
|
}
|
||||||
defer bds.Close() //nolint:errcheck
|
defer bds.Close() //nolint:errcheck
|
||||||
|
|
||||||
|
under := bds
|
||||||
|
bds = measure.New("dsbench", bds)
|
||||||
|
|
||||||
bs := blockstore.NewBlockstore(bds)
|
bs := blockstore.NewBlockstore(bds)
|
||||||
cacheOpts := blockstore.DefaultCacheOpts()
|
cacheOpts := blockstore.DefaultCacheOpts()
|
||||||
cacheOpts.HasBloomFilterSize = 0
|
cacheOpts.HasBloomFilterSize = 0
|
||||||
|
2
go.mod
2
go.mod
@ -12,7 +12,7 @@ require (
|
|||||||
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d
|
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d
|
||||||
github.com/buger/goterm v0.0.0-20200322175922-2f3e71b85129
|
github.com/buger/goterm v0.0.0-20200322175922-2f3e71b85129
|
||||||
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e
|
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e
|
||||||
github.com/cockroachdb/pebble v0.0.0-20200916222308-4e219a90ba5b
|
github.com/cockroachdb/pebble v0.0.0-20201001221639-879f3bfeef07
|
||||||
github.com/coreos/go-systemd/v22 v22.0.0
|
github.com/coreos/go-systemd/v22 v22.0.0
|
||||||
github.com/detailyang/go-fallocate v0.0.0-20180908115635-432fa640bd2e
|
github.com/detailyang/go-fallocate v0.0.0-20180908115635-432fa640bd2e
|
||||||
github.com/dgraph-io/badger/v2 v2.2007.2
|
github.com/dgraph-io/badger/v2 v2.2007.2
|
||||||
|
2
go.sum
2
go.sum
@ -136,6 +136,8 @@ github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f h1:o/kfcElHqOi
|
|||||||
github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f/go.mod h1:i/u985jwjWRlyHXQbwatDASoW0RMlZ/3i9yJHE2xLkI=
|
github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f/go.mod h1:i/u985jwjWRlyHXQbwatDASoW0RMlZ/3i9yJHE2xLkI=
|
||||||
github.com/cockroachdb/pebble v0.0.0-20200916222308-4e219a90ba5b h1:OKALTB609+19AM7wsO0k8yMwAqjEIppcnYvyIhA+ZlQ=
|
github.com/cockroachdb/pebble v0.0.0-20200916222308-4e219a90ba5b h1:OKALTB609+19AM7wsO0k8yMwAqjEIppcnYvyIhA+ZlQ=
|
||||||
github.com/cockroachdb/pebble v0.0.0-20200916222308-4e219a90ba5b/go.mod h1:hU7vhtrqonEphNF+xt8/lHdaBprxmV1h8BOGrd9XwmQ=
|
github.com/cockroachdb/pebble v0.0.0-20200916222308-4e219a90ba5b/go.mod h1:hU7vhtrqonEphNF+xt8/lHdaBprxmV1h8BOGrd9XwmQ=
|
||||||
|
github.com/cockroachdb/pebble v0.0.0-20201001221639-879f3bfeef07 h1:Cb2pZUCFXlLA8i7My+wrN51D41GeuhYOKa1dJeZt6NY=
|
||||||
|
github.com/cockroachdb/pebble v0.0.0-20201001221639-879f3bfeef07/go.mod h1:hU7vhtrqonEphNF+xt8/lHdaBprxmV1h8BOGrd9XwmQ=
|
||||||
github.com/cockroachdb/redact v0.0.0-20200622112456-cd282804bbd3 h1:2+dpIJzYMSbLi0587YXpi8tOJT52qCOI/1I0UNThc/I=
|
github.com/cockroachdb/redact v0.0.0-20200622112456-cd282804bbd3 h1:2+dpIJzYMSbLi0587YXpi8tOJT52qCOI/1I0UNThc/I=
|
||||||
github.com/cockroachdb/redact v0.0.0-20200622112456-cd282804bbd3/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg=
|
github.com/cockroachdb/redact v0.0.0-20200622112456-cd282804bbd3/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg=
|
||||||
github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd h1:qMd81Ts1T2OTKmB4acZcyKaMtRnY5Y44NuXGX2GFJ1w=
|
github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd h1:qMd81Ts1T2OTKmB4acZcyKaMtRnY5Y44NuXGX2GFJ1w=
|
||||||
|
Loading…
Reference in New Issue
Block a user