From 3ec32e7dcbd09ca61ebc9f689506457477f10e25 Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Mon, 25 Mar 2024 11:40:08 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4pebble=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/utils/kvstore/store.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/internal/utils/kvstore/store.go b/internal/utils/kvstore/store.go index 9946a61..e6f7f40 100644 --- a/internal/utils/kvstore/store.go +++ b/internal/utils/kvstore/store.go @@ -6,6 +6,7 @@ import ( "errors" "fmt" "github.com/TeaOSLab/EdgeNode/internal/events" + "github.com/TeaOSLab/EdgeNode/internal/utils" "github.com/cockroachdb/pebble" "github.com/iwind/TeaGo/Tea" "io" @@ -89,7 +90,13 @@ func (this *Store) Open() error { Logger: NewLogger(), } - // TODO 需要修改 BytesPerSync 和 WALBytesPerSync 等等默认参数 + var memoryMB = utils.SystemMemoryGB() * 1 + if memoryMB > 256 { + memoryMB = 256 + } + if memoryMB > 4 { + opt.MemTableSize = uint64(memoryMB) << 20 + } rawDB, err := pebble.Open(this.path, opt) if err != nil {