提交 c568ccc1 编写于 作者: D Davies Liu

limit the used memory up to 200% of --buffer-size

上级 e4331d6c
......@@ -273,6 +273,9 @@ func (f *fileWriter) Write(ctx meta.Context, off uint64, data []byte) syscall.Er
if utils.UsedMemory() > f.w.bufferSize {
// slow down
time.Sleep(time.Millisecond * 10)
for utils.UsedMemory() > f.w.bufferSize*2 {
time.Sleep(time.Millisecond * 100)
}
}
f.Lock()
defer f.Unlock()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册