Documentation ¶
Index ¶
Constants ¶
View Source
const BatchSize = 100
BatchSize batch size
View Source
const Iterations = 500_000
Iterations number of iterations to perform
Variables ¶
View Source
var Concurrency = runtime.NumCPU()
Concurrency number of go parallel executions
View Source
var FunctionBenchmarks = []bm.Bm{ { CreateStore: true, Name: "sequential write (baseline)", Concurrency: Concurrency, Iterations: 1_000_000, Work: func(bm *bm.Bm, start int, end int) error { for i := start; i < end; i++ { kv := schema.KeyValue{Key: []byte(strconv.FormatUint(uint64(i), 10)), Value: V} if _, err := bm.Store.Set(kv); err != nil { return err } } return nil }, }, { CreateStore: true, Name: "sequential write (async commit)", Concurrency: Concurrency, Iterations: 1_000_000, Work: func(bm *bm.Bm, start int, end int) error { opt := store.WithAsyncCommit(true) for i := start; i < end; i++ { kv := schema.KeyValue{Key: []byte(strconv.FormatUint(uint64(i), 10)), Value: V} if _, err := bm.Store.Set(kv, opt); err != nil { return err } } return nil }, }, { CreateStore: true, Name: "sequential write (concurrency++)", Concurrency: Concurrency * 8, Iterations: 1_000_000, Work: func(bm *bm.Bm, start int, end int) error { for i := start; i < end; i++ { kv := schema.KeyValue{Key: []byte(strconv.FormatUint(uint64(i), 10)), Value: V} if _, err := bm.Store.Set(kv); err != nil { return err } } return nil }, }, { CreateStore: true, Name: "sequential write (async commit / concurrency++)", Concurrency: Concurrency * 8, Iterations: 1_000_000, Work: func(bm *bm.Bm, start int, end int) error { opt := store.WithAsyncCommit(true) for i := start; i < end; i++ { kv := schema.KeyValue{Key: []byte(strconv.FormatUint(uint64(i), 10)), Value: V} if _, err := bm.Store.Set(kv, opt); err != nil { return err } } return nil }, }, { CreateStore: true, Name: "sequential write (GOMAXPROCS=128 / concurrency++)", Concurrency: Concurrency * 8, Iterations: 1_000_000, Before: func(bm *bm.Bm) { maxProcs = runtime.GOMAXPROCS(128) }, After: func(bm *bm.Bm) { runtime.GOMAXPROCS(maxProcs) }, Work: func(bm *bm.Bm, start int, end int) error { for i := start; i < end; i++ { kv := schema.KeyValue{Key: []byte(strconv.FormatUint(uint64(i), 10)), Value: V} if _, err := bm.Store.Set(kv); err != nil { return err } } return nil }, }, { CreateStore: true, Name: "batch write", Concurrency: func() int { if Concurrency < 10 { return 10 } return Concurrency }(), Iterations: 1_000_000, Work: func(bm *bm.Bm, start int, end int) error { list := schema.KVList{} for i := start; i < end; i++ { list.KVs = append(list.KVs, &schema.KeyValue{ Key: []byte(strconv.FormatUint(uint64(i), 10)), Value: V, }) } if _, err := bm.Store.SetBatch(list); err != nil { return err } return nil }, }, { CreateStore: true, Name: "batch write (async commit)", Concurrency: func() int { if Concurrency < 10 { return 10 } return Concurrency }(), Iterations: 1_000_000, Work: func(bm *bm.Bm, start int, end int) error { opt := store.WithAsyncCommit(true) list := schema.KVList{} for i := start; i < end; i++ { list.KVs = append(list.KVs, &schema.KeyValue{ Key: []byte(strconv.FormatUint(uint64(i), 10)), Value: V, }) } if _, err := bm.Store.SetBatch(list, opt); err != nil { return err } return nil }, }, }
FunctionBenchmarks ...
View Source
var RPCBenchmarks = []bm.Bm{ makeRPCBenchmark("sequential write", Concurrency, Iterations, sequentialSet), makeRPCBenchmark("batch write", Concurrency, Iterations, batchSet), makeRPCBenchmark("batch write no concurrency", 1, Iterations, batchSet), }
RPCBenchmarks ...
View Source
var V = []byte{0, 1, 3, 4, 5, 6, 7}
V ...
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.