fix: resolve timeout and performance issues in buffer write mode and AOF writes
- resolve timeout issue after small-batch writes in buffer mode - address high disk usage and write bottleneck caused by forced AOF file sync
This commit is contained in:
parent
3f253b327e
commit
b7412933ea
|
@ -204,9 +204,6 @@ func (r *Redis) SendBytesBuff(buf []byte) {
|
|||
}
|
||||
|
||||
func (r *Redis) flushBuff() {
|
||||
if atomic.AddUint64(&r.sendCount, 1)%100 != 0 {
|
||||
return
|
||||
}
|
||||
if !r.timer.Stop() {
|
||||
select {
|
||||
case <-r.timer.C:
|
||||
|
@ -214,6 +211,9 @@ func (r *Redis) flushBuff() {
|
|||
}
|
||||
}
|
||||
r.timer.Reset(time.Second)
|
||||
if atomic.AddUint64(&r.sendCount, 1)%100 != 0 {
|
||||
return
|
||||
}
|
||||
r.flush()
|
||||
}
|
||||
|
||||
|
|
|
@ -50,10 +50,6 @@ func (w *AOFWriter) Write(buf []byte) {
|
|||
w.Close()
|
||||
w.openFile(w.offset)
|
||||
}
|
||||
err = w.file.Sync()
|
||||
if err != nil {
|
||||
log.Panicf(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
func (w *AOFWriter) Close() {
|
||||
|
|
Loading…
Reference in New Issue