Milvus on-disk index

vernolog·2024년 12월 8일
post-thumbnail

이 글은 DiskANN이라는 디스크 기반 인덱싱 알고리즘을 소개한다. DiskANN은 Vamana 그래프를 기반으로 하며, 대규모 데이터셋 내 효율적인 검색을 지원한다. 질의 성능을 향상시키기 위해, 각 벡터 필드의 인덱스 유형을 지정할 수 있다.

Prerequisites

  • DiskANN은 기본값으로 비활성화되어 있음. disk-vased index보다 memory-based index를 선호한다면, 성능 향상을 위해 이 기능을 비활성화하는 것을 권장
  • 비활성화하려면, Milvus 설정 파일에서 queryNode.enableDisk 값을 false로 설정하면 됨. 활성화하려면, queryNode.enableDisk 값을 true로 설정.
  • Milvus 인스턴스는 Ubuntu 18.04.6 이상의 버전에서 실행되어야 함.
  • 최상의 성능을 위해, Milvus 데이터 경로는 NVMe SSD에 마운트되어야 함.
    • Milvus Standalone 인스턴스의 경우, 데이터 경로는 인스턴스가 실행되는 컨테이너의 /var/lib/milvus/data임.
    • Milvus Cluster 인스턴스의 경우, 데이터 경로는 QueryNodes와 IndexNodes가 실행되는 컨테이너의 /var/lib/milvus/data임.

Limits

DiskANN을 사용한다면 아래와 같은 제약사항 존재

  • 데이터에는 최소 1차원의 실수(float) 벡터만 사용해야 함.
  • 벡터 간 거리 측정에는, 유클리드 거리(L2), 내적(IP), 또는 코사인 거리(COSINE)만 사용 가능.

Index and search settings

  • DiskANN index 방법은 사용한다면 index type을 DISKANN 로 설정. index parameters는 따로 없다
  • Search parameters
    ParameterDescriptionRangeDefault Value
    search_listSize of the candidate list, a larger size offers a higher recall rate with degraded performance.[topk, int32_max]16

DiskANN 관련 파라미터는 ${MILVUS_ROOT_PATH}/configs/milvus.yaml 파일에서 수정하여 성능을 향상시킬 수 있다.

...
DiskIndex:
  MaxDegree: 56
  SearchListSize: 100
  PQCodeBugetGBRatio: 0.125
  SearchCacheBudgetGBRatio: 0.125
  BeamWidthRatio: 4.0
...
ParameterDescriptionValue RangeDefault Value
MaxDegreeMaximum degree of the Vamana graph.A larger value offers a higher recall rate but increases the size of and time to build the index.[1, 512]56
SearchListSizeSize of the candidate list.A larger value increases the time spent on building the index but offers a higher recall rate.Set it to a value smaller than MaxDegree unless you need to reduce the index-building time.[1, int32_max]100
PQCodeBugetGBRatioSize limit on the PQ code.A larger value offers a higher recall rate but increases memory usage.(0.0, 0.25]0.125
SearchCacheBudgetGBRatioRatio of cached node numbers to raw data.A larger value improves index-building performance with increased memory usage.[0.0, 0.3)0.10
BeamWidthRatioRatio between the maximum number of IO requests per search iteration and CPU number.[1, max(128 / CPU number, 16)]4.0

Troubleshooting

How to deal with the io_setup() failed; returned -11, errno=11:Resource temporarily unavailable error?

The Linux kernel provides the Asynchronous non-blocking I/O (AIO) feature that allows a process to initiate multiple I/O operations simultaneously without having to wait for any of them to complete. This helps boost performance for applications that can overlap processing and I/O.

The performance can be tuned using the /proc/sys/fs/aio-max-nr virtual file in the proc file system. The aio-max-nr parameter determines the maximum number of allowable concurrent requests.

The aio-max-nr defaults to 65535, you can set it up to 10485760.

참고자료

0개의 댓글