enhance: Use a separate mmap config for chunk cache (#36276)

issue: https://github.com/milvus-io/milvus/issues/35273

Signed-off-by: bigsheeper <yihao.dai@zilliz.com>
This commit is contained in:
yihao.dai 2024-09-15 16:23:09 +08:00 committed by GitHub
parent 517f8b3755
commit 763fd0dfc5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 21 additions and 5 deletions

View File

@ -412,6 +412,7 @@ queryNode:
vectorIndex: false # Enable mmap for loading vector index
scalarField: false # Enable mmap for loading scalar data
scalarIndex: false # Enable mmap for loading scalar index
chunkCache: true # Enable mmap for chunk cache (raw vector retrieving).
# Enable memory mapping (mmap) to optimize the handling of growing raw data.
# By activating this feature, the memory overhead associated with newly added or modified data will be significantly minimized.
# However, this optimization may come at the cost of a slight decrease in query latency for the affected data segments.

View File

@ -1172,7 +1172,8 @@ func (s *LocalSegment) LoadIndex(ctx context.Context, indexInfo *querypb.FieldIn
}
// 4.
s.WarmupChunkCache(ctx, indexInfo.GetFieldID(), isDataMmapEnable(fieldSchema))
mmapChunkCache := paramtable.Get().QueryNodeCfg.MmapChunkCache.GetAsBool()
s.WarmupChunkCache(ctx, indexInfo.GetFieldID(), mmapChunkCache)
warmupChunkCacheSpan := tr.RecordSpan()
log.Info("Finish loading index",
zap.Duration("newLoadIndexInfoSpan", newLoadIndexInfoSpan),

View File

@ -376,8 +376,9 @@ func (node *QueryNode) Start() error {
growingmmapEnable := paramtable.Get().QueryNodeCfg.GrowingMmapEnabled.GetAsBool()
mmapVectorIndex := paramtable.Get().QueryNodeCfg.MmapVectorIndex.GetAsBool()
mmapVectorField := paramtable.Get().QueryNodeCfg.MmapVectorField.GetAsBool()
mmapScarlarIndex := paramtable.Get().QueryNodeCfg.MmapScalarIndex.GetAsBool()
mmapScarlarField := paramtable.Get().QueryNodeCfg.MmapScalarField.GetAsBool()
mmapScalarIndex := paramtable.Get().QueryNodeCfg.MmapScalarIndex.GetAsBool()
mmapScalarField := paramtable.Get().QueryNodeCfg.MmapScalarField.GetAsBool()
mmapChunkCache := paramtable.Get().QueryNodeCfg.MmapChunkCache.GetAsBool()
node.UpdateStateCode(commonpb.StateCode_Healthy)
@ -389,8 +390,9 @@ func (node *QueryNode) Start() error {
zap.Bool("growingmmapEnable", growingmmapEnable),
zap.Bool("mmapVectorIndex", mmapVectorIndex),
zap.Bool("mmapVectorField", mmapVectorField),
zap.Bool("mmapScarlarIndex", mmapScarlarIndex),
zap.Bool("mmapScarlarField", mmapScarlarField),
zap.Bool("mmapScalarIndex", mmapScalarIndex),
zap.Bool("mmapScalarField", mmapScalarField),
zap.Bool("mmapChunkCache", mmapChunkCache),
)
})

View File

@ -2337,6 +2337,7 @@ type queryNodeConfig struct {
MmapVectorIndex ParamItem `refreshable:"false"`
MmapScalarField ParamItem `refreshable:"false"`
MmapScalarIndex ParamItem `refreshable:"false"`
MmapChunkCache ParamItem `refreshable:"false"`
GrowingMmapEnabled ParamItem `refreshable:"false"`
FixedFileSizeForMmapManager ParamItem `refreshable:"false"`
MaxMmapDiskPercentageForMmapManager ParamItem `refreshable:"false"`
@ -2663,6 +2664,15 @@ This defaults to true, indicating that Milvus creates temporary index for growin
}
p.MmapScalarIndex.Init(base.mgr)
p.MmapChunkCache = ParamItem{
Key: "queryNode.mmap.chunkCache",
Version: "2.4.12",
DefaultValue: "true",
Doc: "Enable mmap for chunk cache (raw vector retrieving).",
Export: true,
}
p.MmapChunkCache.Init(base.mgr)
p.GrowingMmapEnabled = ParamItem{
Key: "queryNode.mmap.growingMmapEnabled",
Version: "2.4.6",

View File

@ -454,6 +454,8 @@ func TestComponentParam(t *testing.T) {
assert.Equal(t, 4, Params.BloomFilterApplyParallelFactor.GetAsInt())
assert.Equal(t, "/var/lib/milvus/data/mmap", Params.MmapDirPath.GetValue())
assert.Equal(t, true, Params.MmapChunkCache.GetAsBool())
})
t.Run("test dataCoordConfig", func(t *testing.T) {