Skip to content

Commit

Permalink
Remove L0SlowdownThreshold
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryanfsdf committed Jul 9, 2019
1 parent 621dd5a commit 2516ab5
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 31 deletions.
1 change: 0 additions & 1 deletion cmd/pebble/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ func newPebbleDB(dir string) DB {
MemTableStopWritesThreshold: 4,
MinFlushRate: 4 << 20,
L0CompactionThreshold: 2,
L0SlowdownWritesThreshold: 20,
L0StopWritesThreshold: 32,
LBaseMaxBytes: 64 << 20, // 64 MB
Levels: []pebble.LevelOptions{{
Expand Down
22 changes: 1 addition & 21 deletions db.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@ package pebble // import "github.com/petermattis/pebble"
import (
"errors"
"fmt"
"github.com/petermattis/pebble/internal/rate"
"io"
"sync"
"sync/atomic"
"time"

"github.com/petermattis/pebble/internal/arenaskl"
"github.com/petermattis/pebble/internal/base"
"github.com/petermattis/pebble/internal/rate"
"github.com/petermattis/pebble/internal/record"
"github.com/petermattis/pebble/vfs"
)
Expand Down Expand Up @@ -399,9 +398,6 @@ func (d *DB) commitApply(b *Batch, mem *memTable) error {
func (d *DB) commitWrite(b *Batch, wg *sync.WaitGroup) (*memTable, error) {
d.mu.Lock()

// Throttle writes if there are too many L0 tables.
d.throttleWrite()

if b.flushable != nil {
b.flushable.seqNum = b.seqNum()
}
Expand Down Expand Up @@ -797,22 +793,6 @@ func (d *DB) walPreallocateSize() int {
return size
}

func (d *DB) throttleWrite() {
if len(d.mu.versions.currentVersion().files[0]) <= d.opts.L0SlowdownWritesThreshold {
return
}
// fmt.Printf("L0 slowdown writes threshold\n")
// We are getting close to hitting a hard limit on the number of L0
// files. Rather than delaying a single write by several seconds when we hit
// the hard limit, start delaying each individual write by 1ms to reduce
// latency variance.
//
// TODO(peter): Use more sophisticated rate limiting.
d.mu.Unlock()
time.Sleep(1 * time.Millisecond)
d.mu.Lock()
}

func (d *DB) makeRoomForWrite(b *Batch) error {
force := b == nil || b.flushable != nil
for {
Expand Down
8 changes: 0 additions & 8 deletions internal/base/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,6 @@ type Options struct {
// The number of files necessary to trigger an L0 compaction.
L0CompactionThreshold int

// Soft limit on the number of L0 files. Writes are slowed down when this
// threshold is reached.
L0SlowdownWritesThreshold int

// Hard limit on the number of L0 files. Writes are stopped when this
// threshold is reached.
L0StopWritesThreshold int
Expand Down Expand Up @@ -340,9 +336,6 @@ func (o *Options) EnsureDefaults() *Options {
if o.L0CompactionThreshold <= 0 {
o.L0CompactionThreshold = 4
}
if o.L0SlowdownWritesThreshold <= 0 {
o.L0SlowdownWritesThreshold = 8
}
if o.L0StopWritesThreshold <= 0 {
o.L0StopWritesThreshold = 12
}
Expand Down Expand Up @@ -418,7 +411,6 @@ func (o *Options) String() string {
fmt.Fprintf(&buf, " comparer=%s\n", o.Comparer.Name)
fmt.Fprintf(&buf, " disable_wal=%t\n", o.DisableWAL)
fmt.Fprintf(&buf, " l0_compaction_threshold=%d\n", o.L0CompactionThreshold)
fmt.Fprintf(&buf, " l0_slowdown_writes_threshold=%d\n", o.L0SlowdownWritesThreshold)
fmt.Fprintf(&buf, " l0_stop_writes_threshold=%d\n", o.L0StopWritesThreshold)
fmt.Fprintf(&buf, " lbase_max_bytes=%d\n", o.LBaseMaxBytes)
fmt.Fprintf(&buf, " max_manifest_file_size=%d\n", o.MaxManifestFileSize)
Expand Down
1 change: 0 additions & 1 deletion internal/base/options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ func TestOptionsString(t *testing.T) {
comparer=leveldb.BytewiseComparator
disable_wal=false
l0_compaction_threshold=4
l0_slowdown_writes_threshold=8
l0_stop_writes_threshold=12
lbase_max_bytes=67108864
max_manifest_file_size=134217728
Expand Down

0 comments on commit 2516ab5

Please sign in to comment.