fix: Add AiSAQ index type RAM estimation implementation on the query node. (#45246)

Currently, the index type AiSAQ RAM usage estimation is not being
calculated correctly.
AiSAQ index type consumes less RAM usage while loading the index than
DISKANN does, and the query node module is missing the implementation of
the RAM usage estimation for that AiSAQ index type.
We suggest that the AiSAQ RAM usage estimation calculation should be as
follows:
 
UsedDiskMemoryRatioAisaq = 1024 (contrary to the UsedDiskMemoryRatio,
which is 4)
neededMemSize = indexInfo.IndexSize / UsedDiskMemoryRatioAisaq 
neededDiskSize = indexInfo.IndexSize

Reported issue is #45247

---------

Signed-off-by: Lior Friedman <lior.friedman@il.kioxia.com>
Signed-off-by: friedl <lior.friedman@kioxia.com>
Co-authored-by: friedl <lior.friedman@kioxia.com>
This commit is contained in:
Lior Friedman 2025-11-06 02:53:34 +02:00 committed by GitHub
parent 121eb912ba
commit a4d69031f1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 31 additions and 1 deletions

View File

@ -68,6 +68,11 @@ func (c *IndexAttrCache) GetIndexResourceUsage(indexInfo *querypb.FieldIndexInfo
neededDiskSize := indexInfo.IndexSize - neededMemSize
return uint64(neededMemSize), uint64(neededDiskSize), nil
}
if vecindexmgr.GetVecIndexMgrInstance().IsAISAQ(indexType) {
neededMemSize := indexInfo.IndexSize / UsedDiskMemoryRatioAisaq
neededDiskSize := indexInfo.IndexSize
return uint64(neededMemSize), uint64(neededDiskSize), nil
}
if indexType == indexparamcheck.IndexINVERTED {
neededMemSize := 0
// we will mmap the binlog if the index type is inverted index.

View File

@ -78,6 +78,25 @@ func (s *IndexAttrCacheSuite) TestDiskANN() {
s.EqualValues(75, disk)
}
func (s *IndexAttrCacheSuite) TestAISAQ() {
info := &querypb.FieldIndexInfo{
IndexParams: []*commonpb.KeyValuePair{
{Key: common.IndexTypeKey, Value: "AISAQ"},
},
CurrentIndexVersion: 0,
IndexSize: 1024,
}
memory, disk, err := s.c.GetIndexResourceUsage(info, paramtable.Get().QueryNodeCfg.MemoryIndexLoadPredictMemoryUsageFactor.GetAsFloat(), nil)
s.Require().NoError(err)
_, has := s.c.loadWithDisk.Get(typeutil.NewPair[string, int32]("AISAQ", 0))
s.False(has, "AISAQ shall never be checked load with disk")
s.EqualValues(16, memory)
s.EqualValues(1024, disk)
}
func (s *IndexAttrCacheSuite) TestInvertedIndex() {
info := &querypb.FieldIndexInfo{
IndexParams: []*commonpb.KeyValuePair{

View File

@ -67,6 +67,7 @@ import (
const (
UsedDiskMemoryRatio = 4
UsedDiskMemoryRatioAisaq = 64
)
var errRetryTimerNotified = errors.New("retry timer notified")

View File

@ -77,6 +77,7 @@ type VecIndexMgr interface {
IsNoTrainIndex(indexType IndexType) bool
IsVecIndex(indexType IndexType) bool
IsDiskANN(indexType IndexType) bool
IsAISAQ(indexType IndexType) bool
IsGPUVecIndex(indexType IndexType) bool
IsDiskVecIndex(indexType IndexType) bool
IsMMapSupported(indexType IndexType) bool
@ -108,6 +109,10 @@ func (mgr *vecIndexMgrImpl) IsDiskANN(indexType IndexType) bool {
return indexType == "DISKANN"
}
func (mgr *vecIndexMgrImpl) IsAISAQ(indexType IndexType) bool {
return indexType == "AISAQ"
}
func (mgr *vecIndexMgrImpl) init() {
size := int(C.GetIndexListSize())
if size == 0 {