Skip to content

refactor(diskann): decouple from libaio via dlopen#532

Merged
richyreachy merged 67 commits into
alibaba:mainfrom
richyreachy:refactor/diskann_dlopen
Jul 16, 2026
Merged

refactor(diskann): decouple from libaio via dlopen#532
richyreachy merged 67 commits into
alibaba:mainfrom
richyreachy:refactor/diskann_dlopen

Conversation

@richyreachy

@richyreachy richyreachy commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Currently, DiskAnn ships as a separate runtime-loaded .so (libzvec_diskann_plugin.so) file which requires a hard build-time dependency on libaio-dev.

This PR improves with a simpler, more robust design. Probing libaio.so file, a thread-safe singleton dlopens it and caches the syscall pointers. If libaio is absent, it will fall back to degrade to synchronous pread() with a warning.

The following shows the performance comparison on Cohere 1M between pread w/ and w/o AIO enabled. (Aliyun g9i, PL0, 10000 IOPS)

Pread w/ AIO Enabled

Result FP32-100 FP32-300 FP32-500 FP16-100 FP16-300 FP16-500
Search Mem(4 thread) 503M 503M 503M 486M 486M 486M
Recall@1 96.1% 98.9% 99% 95.3% 97.8% 98.4%
Recall@10 96.14% 98.6% 98.94% 95.86% 98.1% 98.63%
Recall@50 93.394% 97.782% 98.598% 93.452% 97.354% 98.188%
QPS(1 thread) 32.6 11.2 6.7 32.3 11.1 6.7
QPS(2 thread) 65.2 22.3 13.5 64.5 22.4 13.4
QPS(4 thread) 106.4 36.6 22.1 106.4 36.6 22.1

Pread w/o AIO Enabled

Result FP32-100 FP32-300 FP32-500 FP16-100 FP16-300 FP16-500
Search Mem(4 thread) 503M 503M 503M 486M 486M 486M
Recall@1 96.1% 98.9% 99% 95.3% 97.8% 98.4%
Recall@10 96.14% 98.6% 98.94% 95.86% 98.1% 98.63%
Recall@50 93.394% 97.782% 98.598% 93.452% 97.354% 98.188%
QPS(1 thread) 18.4 6.3 3.8 18.3 6.3 3.8
QPS(2 thread) 36.8 12.6 7.5 36.5 12.6 7.6
QPS(4 thread) 73.1 25.2 15.2 72.5 25.1 15.2

@richyreachy
richyreachy requested a review from egolearner June 30, 2026 08:54
@iaojnh

iaojnh commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

可以把workflow里,打包相关的libaio-devel依赖,在这个PR里移除

Comment thread python/tests/test_collection_diskann.py Outdated
Comment thread src/binding/python/exports.map Outdated
Comment thread src/include/zvec/core/interface/diskann_runtime.h Outdated
Comment thread .github/workflows/03-macos-linux-build.yml
Comment thread tools/core/bench_original.cc
Comment thread tools/core/recall_original.cc
Comment thread thirdparty/arrow/CMakeLists.txt Outdated
@chinaux
chinaux requested a review from JalinWang July 15, 2026 02:05
Comment thread examples/c++/CMakeLists.txt Outdated
Comment thread thirdparty/snowball/snowball-3.1.1
Comment thread examples/c++/CMakeLists.txt Outdated
Comment thread src/include/zvec/ailego/io/io_backend_type.h Outdated
iaojnh
iaojnh previously approved these changes Jul 16, 2026
Comment thread src/core/algorithm/diskann/diskann_file_reader.cc Outdated
Comment thread src/include/zvec/db/collection.h Outdated
Comment thread src/include/zvec/core/interface/index.h Outdated
Comment thread src/db/collection.cc Outdated
Comment thread src/core/algorithm/diskann/diskann_builder.cc Outdated

@egolearner egolearner left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@richyreachy
richyreachy merged commit ec8a78e into alibaba:main Jul 16, 2026
13 checks passed
@richyreachy
richyreachy deleted the refactor/diskann_dlopen branch July 16, 2026 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants