refactor(client): Limit prefetching to use at most one-third of the memory. #1000160740

Signed-off-by: Victor1319 <zengxuewei@oppo.com>
This commit is contained in:
Victor1319 2025-08-08 11:54:43 +08:00 committed by zhumingze1108
parent fc05b1d503
commit 8385bf3e0c
4 changed files with 4 additions and 4 deletions

View File

@ -255,6 +255,8 @@ func NewSuper(opt *proto.MountOptions) (s *Super, err error) {
NeedRemoteCache: true,
}
log.LogWarnf("ahead info enable %+v, totalMem %+v, timeout %+v, winCnt %+v", opt.AheadReadEnable, opt.AheadReadTotalMem, opt.AheadReadBlockTimeOut, opt.AheadReadWindowCnt)
s.ec, err = stream.NewExtentClient(extentConfig)
if err != nil {
return nil, errors.Trace(err, "NewExtentClient failed!")

View File

@ -1020,10 +1020,9 @@ func parseMountOption(cfg *config.Config) (*proto.MountOptions, error) {
if err != nil {
return nil, err
}
available = int64((total - used) / 2)
available = int64((total - used) / 3)
if available < opt.AheadReadTotalMem {
opt.AheadReadTotalMem = available
syslog.Printf("available ahead read mem: %v\n", available)
}
}
if opt.MountPoint == "" || opt.Volname == "" || opt.Owner == "" || opt.Master == "" {

View File

@ -906,7 +906,7 @@ func (dp *DataPartition) PersistMetadata() (err error) {
return
}
dp.metaAppliedID = dp.appliedID
log.LogInfof("PersistMetadata DataPartition(%v) data(%v)", dp.partitionID, string(metaData))
log.LogWarnf("PersistMetadata DataPartition(%v) data(%v)", dp.partitionID, string(metaData))
err = os.Rename(fileName, path.Join(dp.Path(), DataPartitionMetadataFileName))
return
}

View File

@ -26,7 +26,6 @@ import (
"syscall"
"time"
"github.com/cubefs/cubefs/flashnode"
"github.com/cubefs/cubefs/proto"
"github.com/cubefs/cubefs/util"
"github.com/cubefs/cubefs/util/auditlog"