Installing and Using the Feature
The acceleration feature of the Milvus database is mainly applied to the HNSW and ScaNN index algorithms. The optimization feature is provided in the form of a patch file. After Milvus is compiled, apply the patch file to the Knowhere source code, and then perform compilation again to use the optimization feature. This patch is developed for Milvus 2.4.5.
The open source Milvus source code does not include the index-related component Knowhere, which requires to pull the Knowhere source code during Milvus compilation and integrate it into the database. This feature is used to optimize the index query and its patch file is added to the Knowhere source code. Therefore, Milvus needs to be compiled twice. The first compilation is to obtain the Knowhere source code. After the patch file is loaded into Knowhere, the second compilation is performed to enable the optimization feature.
In addition, you are advised to enable the BIOS prefetch function in advance, which can be combined with the software prefetch in the patch file. Through modifying the prefetch step, the performance can be further improved. For details, see Performing Configuration Before Installation.
- Download the Milvus installation package and save it to the home directory ~. Compile and install Milvus by following instrucions in the Milvus Database Installation Guide.
For details, see Table 2 OS and software requirements. It is assumed that all environment requirements of Milvus are met by default.
- Obtain the patch file 0001-hnsw-scann-sve-pf.patch for the acceleration optimization feature and upload it to the home directory.
For details, see Table 2 OS and software requirements.
- Go to the ./cmake_build/thirdparty/knowhere/knowhere-src directory in the installation directory and integrate the acceleration optimization feature: If no command output is displayed, the integration is successful.
1 2
cd cmake_build/thirdparty/knowhere/knowhere-src git apply --whitespace=nowarn < ~/0001-hnsw-scann-sve-pf.patch
- In the ./cmake_build/thirdparty/knowhere/knowhere-build directory, compile the Knowhere component and use the optimization feature:
1 2 3
cd ../knowhere-build make -sj cp -r ../../../lib/libknowhere.so ../../../../internal/core/output/lib64/
- Check whether the acceleration feature is enabled:
1strings ~/milvus/internal/core/output/lib64/libknowhere.so | grep sve
If SVE-related information is returned, the acceleration feature is enabled successfully.
1GNU C++17 10.3.1 -march=armv8-a+sve -mlittle-endian -mabi=lp64 -g -O3 -O3 -std=gnu++17 -std=gnu++17 -std=gnu++17 -fopenmp -fPIC
- Perform tests on the ANN-Benchmarks GIST dataset to obtain the performance improvement after the acceleration optimization feature is used, as shown in Figure 1 Performance comparison before and after acceleration optimization. For details about the test procedure, see Milvus Database ANN-Benchmarks Test Guide.
