forked from TrueCloudLab/frostfs-node
[#1524] metabase: Add some bolt parameters to the configuration
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
d6043abc24
commit
07e06249d5
8 changed files with 35 additions and 13 deletions
|
@ -278,20 +278,24 @@ func WithPermissions(perm fs.FileMode) Option {
|
|||
}
|
||||
}
|
||||
|
||||
// WithBatchSize returns option to specify maximum concurrent operations
|
||||
// WithMaxBatchSize returns option to specify maximum concurrent operations
|
||||
// to be processed in a single transactions.
|
||||
// This option is missing from `bbolt.Options` but is set right after DB is open.
|
||||
func WithBatchSize(s int) Option {
|
||||
func WithMaxBatchSize(s int) Option {
|
||||
return func(c *cfg) {
|
||||
c.boltBatchSize = s
|
||||
if s != 0 {
|
||||
c.boltBatchSize = s
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// WithBatchDelay returns option to specify maximum time to wait before
|
||||
// WithMaxBatchDelay returns option to specify maximum time to wait before
|
||||
// the batch of concurrent transactions is processed.
|
||||
// This option is missing from `bbolt.Options` but is set right after DB is open.
|
||||
func WithBatchDelay(d time.Duration) Option {
|
||||
func WithMaxBatchDelay(d time.Duration) Option {
|
||||
return func(c *cfg) {
|
||||
c.boltBatchDelay = d
|
||||
if d != 0 {
|
||||
c.boltBatchDelay = d
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ func BenchmarkListWithCursor(b *testing.B) {
|
|||
}
|
||||
|
||||
func listWithCursorPrepareDB(b *testing.B) *meta.DB {
|
||||
db := newDB(b, meta.WithBatchSize(1), meta.WithBoltDBOptions(&bbolt.Options{
|
||||
db := newDB(b, meta.WithMaxBatchSize(1), meta.WithBoltDBOptions(&bbolt.Options{
|
||||
NoSync: true,
|
||||
})) // faster single-thread generation
|
||||
|
||||
|
|
|
@ -43,8 +43,8 @@ func prepareObjects(t testing.TB, n int) []*objectSDK.Object {
|
|||
func BenchmarkPut(b *testing.B) {
|
||||
b.Run("parallel", func(b *testing.B) {
|
||||
db := newDB(b,
|
||||
meta.WithBatchDelay(time.Millisecond*10),
|
||||
meta.WithBatchSize(runtime.NumCPU()))
|
||||
meta.WithMaxBatchDelay(time.Millisecond*10),
|
||||
meta.WithMaxBatchSize(runtime.NumCPU()))
|
||||
// Ensure the benchmark is bound by CPU and not waiting batch-delay time.
|
||||
b.SetParallelism(1)
|
||||
|
||||
|
@ -62,8 +62,8 @@ func BenchmarkPut(b *testing.B) {
|
|||
})
|
||||
b.Run("sequential", func(b *testing.B) {
|
||||
db := newDB(b,
|
||||
meta.WithBatchDelay(time.Millisecond*10),
|
||||
meta.WithBatchSize(1))
|
||||
meta.WithMaxBatchDelay(time.Millisecond*10),
|
||||
meta.WithMaxBatchSize(1))
|
||||
index := atomic.NewInt64(-1)
|
||||
objs := prepareObjects(b, b.N)
|
||||
b.ResetTimer()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue