mirror of https://github.com/milvus-io/milvus.git
				
				
				
			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>pull/36310/head
							parent
							
								
									517f8b3755
								
							
						
					
					
						commit
						763fd0dfc5
					
				| 
						 | 
					@ -412,6 +412,7 @@ queryNode:
 | 
				
			||||||
    vectorIndex: false # Enable mmap for loading vector index
 | 
					    vectorIndex: false # Enable mmap for loading vector index
 | 
				
			||||||
    scalarField: false # Enable mmap for loading scalar data
 | 
					    scalarField: false # Enable mmap for loading scalar data
 | 
				
			||||||
    scalarIndex: false # Enable mmap for loading scalar index
 | 
					    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. 
 | 
					    # 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. 
 | 
					    # 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.
 | 
					    # However, this optimization may come at the cost of a slight decrease in query latency for the affected data segments.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1172,7 +1172,8 @@ func (s *LocalSegment) LoadIndex(ctx context.Context, indexInfo *querypb.FieldIn
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// 4.
 | 
						// 4.
 | 
				
			||||||
	s.WarmupChunkCache(ctx, indexInfo.GetFieldID(), isDataMmapEnable(fieldSchema))
 | 
						mmapChunkCache := paramtable.Get().QueryNodeCfg.MmapChunkCache.GetAsBool()
 | 
				
			||||||
 | 
						s.WarmupChunkCache(ctx, indexInfo.GetFieldID(), mmapChunkCache)
 | 
				
			||||||
	warmupChunkCacheSpan := tr.RecordSpan()
 | 
						warmupChunkCacheSpan := tr.RecordSpan()
 | 
				
			||||||
	log.Info("Finish loading index",
 | 
						log.Info("Finish loading index",
 | 
				
			||||||
		zap.Duration("newLoadIndexInfoSpan", newLoadIndexInfoSpan),
 | 
							zap.Duration("newLoadIndexInfoSpan", newLoadIndexInfoSpan),
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -376,8 +376,9 @@ func (node *QueryNode) Start() error {
 | 
				
			||||||
		growingmmapEnable := paramtable.Get().QueryNodeCfg.GrowingMmapEnabled.GetAsBool()
 | 
							growingmmapEnable := paramtable.Get().QueryNodeCfg.GrowingMmapEnabled.GetAsBool()
 | 
				
			||||||
		mmapVectorIndex := paramtable.Get().QueryNodeCfg.MmapVectorIndex.GetAsBool()
 | 
							mmapVectorIndex := paramtable.Get().QueryNodeCfg.MmapVectorIndex.GetAsBool()
 | 
				
			||||||
		mmapVectorField := paramtable.Get().QueryNodeCfg.MmapVectorField.GetAsBool()
 | 
							mmapVectorField := paramtable.Get().QueryNodeCfg.MmapVectorField.GetAsBool()
 | 
				
			||||||
		mmapScarlarIndex := paramtable.Get().QueryNodeCfg.MmapScalarIndex.GetAsBool()
 | 
							mmapScalarIndex := paramtable.Get().QueryNodeCfg.MmapScalarIndex.GetAsBool()
 | 
				
			||||||
		mmapScarlarField := paramtable.Get().QueryNodeCfg.MmapScalarField.GetAsBool()
 | 
							mmapScalarField := paramtable.Get().QueryNodeCfg.MmapScalarField.GetAsBool()
 | 
				
			||||||
 | 
							mmapChunkCache := paramtable.Get().QueryNodeCfg.MmapChunkCache.GetAsBool()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		node.UpdateStateCode(commonpb.StateCode_Healthy)
 | 
							node.UpdateStateCode(commonpb.StateCode_Healthy)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -389,8 +390,9 @@ func (node *QueryNode) Start() error {
 | 
				
			||||||
			zap.Bool("growingmmapEnable", growingmmapEnable),
 | 
								zap.Bool("growingmmapEnable", growingmmapEnable),
 | 
				
			||||||
			zap.Bool("mmapVectorIndex", mmapVectorIndex),
 | 
								zap.Bool("mmapVectorIndex", mmapVectorIndex),
 | 
				
			||||||
			zap.Bool("mmapVectorField", mmapVectorField),
 | 
								zap.Bool("mmapVectorField", mmapVectorField),
 | 
				
			||||||
			zap.Bool("mmapScarlarIndex", mmapScarlarIndex),
 | 
								zap.Bool("mmapScalarIndex", mmapScalarIndex),
 | 
				
			||||||
			zap.Bool("mmapScarlarField", mmapScarlarField),
 | 
								zap.Bool("mmapScalarField", mmapScalarField),
 | 
				
			||||||
 | 
								zap.Bool("mmapChunkCache", mmapChunkCache),
 | 
				
			||||||
		)
 | 
							)
 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2337,6 +2337,7 @@ type queryNodeConfig struct {
 | 
				
			||||||
	MmapVectorIndex                     ParamItem `refreshable:"false"`
 | 
						MmapVectorIndex                     ParamItem `refreshable:"false"`
 | 
				
			||||||
	MmapScalarField                     ParamItem `refreshable:"false"`
 | 
						MmapScalarField                     ParamItem `refreshable:"false"`
 | 
				
			||||||
	MmapScalarIndex                     ParamItem `refreshable:"false"`
 | 
						MmapScalarIndex                     ParamItem `refreshable:"false"`
 | 
				
			||||||
 | 
						MmapChunkCache                      ParamItem `refreshable:"false"`
 | 
				
			||||||
	GrowingMmapEnabled                  ParamItem `refreshable:"false"`
 | 
						GrowingMmapEnabled                  ParamItem `refreshable:"false"`
 | 
				
			||||||
	FixedFileSizeForMmapManager         ParamItem `refreshable:"false"`
 | 
						FixedFileSizeForMmapManager         ParamItem `refreshable:"false"`
 | 
				
			||||||
	MaxMmapDiskPercentageForMmapManager 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.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{
 | 
						p.GrowingMmapEnabled = ParamItem{
 | 
				
			||||||
		Key:          "queryNode.mmap.growingMmapEnabled",
 | 
							Key:          "queryNode.mmap.growingMmapEnabled",
 | 
				
			||||||
		Version:      "2.4.6",
 | 
							Version:      "2.4.6",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -454,6 +454,8 @@ func TestComponentParam(t *testing.T) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		assert.Equal(t, 4, Params.BloomFilterApplyParallelFactor.GetAsInt())
 | 
							assert.Equal(t, 4, Params.BloomFilterApplyParallelFactor.GetAsInt())
 | 
				
			||||||
		assert.Equal(t, "/var/lib/milvus/data/mmap", Params.MmapDirPath.GetValue())
 | 
							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) {
 | 
						t.Run("test dataCoordConfig", func(t *testing.T) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue