mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
wal: use larger buffer
This commit is contained in:
parent
1c80c33e72
commit
9cf49f68e9
16
wal.go
16
wal.go
|
@ -1,6 +1,7 @@
|
||||||
package tsdb
|
package tsdb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bufio"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"hash/crc32"
|
"hash/crc32"
|
||||||
"io"
|
"io"
|
||||||
|
@ -11,7 +12,6 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/coreos/etcd/pkg/fileutil"
|
"github.com/coreos/etcd/pkg/fileutil"
|
||||||
"github.com/coreos/etcd/pkg/ioutil"
|
|
||||||
"github.com/fabxc/tsdb/labels"
|
"github.com/fabxc/tsdb/labels"
|
||||||
"github.com/go-kit/kit/log"
|
"github.com/go-kit/kit/log"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
@ -165,7 +165,8 @@ func (w *WAL) Close() error {
|
||||||
|
|
||||||
type walEncoder struct {
|
type walEncoder struct {
|
||||||
mtx sync.Mutex
|
mtx sync.Mutex
|
||||||
w *ioutil.PageWriter
|
// w *ioutil.PageWriter
|
||||||
|
w *bufio.Writer
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -178,12 +179,13 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
func newWALEncoder(f *os.File) (*walEncoder, error) {
|
func newWALEncoder(f *os.File) (*walEncoder, error) {
|
||||||
offset, err := f.Seek(0, os.SEEK_CUR)
|
// offset, err := f.Seek(0, os.SEEK_CUR)
|
||||||
if err != nil {
|
// if err != nil {
|
||||||
return nil, err
|
// return nil, err
|
||||||
}
|
// }
|
||||||
enc := &walEncoder{
|
enc := &walEncoder{
|
||||||
w: ioutil.NewPageWriter(f, walPageBytes, int(offset)),
|
// w: ioutil.NewPageWriter(f, walPageBytes, int(offset)),
|
||||||
|
w: bufio.NewWriterSize(f, 4*1024*1024),
|
||||||
}
|
}
|
||||||
return enc, nil
|
return enc, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue