本文介绍云原生多模数据库Lindorm向量引擎的性能测试流程。
测试环境
-
客户端ECS规格
建议选择ecs.c9i.16xlarge及以上规格。
CPU
内存
磁盘
操作系统
64核
128GB
2TB
Ubuntu 22.04 64位 UEFI版
-
服务端Lindorm规格
引擎
引擎版本
CPU
内存
磁盘
搜索引擎
3.10.16及以上
8核
32GB
320GB 性能型云存储
向量引擎
3.10.16及以上
32核
128GB
ECS与Lindorm实例需位于相同地域和可用区,并使用相同的VPC网络,且需要将ECS地址加入到Lindorm白名单。
测试工具准备
本文使用VectorDBBench作为性能评估的基准测试工具。
-
安装Python 3.11及以上版本的环境。
sudo apt update sudo apt install python3.11 sudo apt install python3.11-venv -
安装VectorDBBench项目和相关依赖。
git clone https://github.com/zilliztech/VectorDBBench.git cd VectorDBBench #创建虚拟环境 python3.11 -m venv venv source venv/bin/activate #安装python依赖 pip3 install -U pip -i https://mirrors.aliyun.com/pypi/simple pip3 install --no-cache-dir -r install/requirements_py3.11.txt -i https://mirrors.aliyun.com/pypi/simple pip3 install -e . -i https://mirrors.aliyun.com/pypi/simple #启动Web页面 init_bench
性能测试
测试支持Web页面和命令行两种方式。Web页面方式操作直观,适合初次测试;命令行方式适合批量执行或重复测试。
通过Web页面运行测试
-
在Run Test页面选择数据库Lindorm。
-
设置Lindorm实例信息和索引名称。
表单还包含 version(可选,用于标记结果)、db_label(可选,用于标记结果)和 note(可选备注)字段,其中 port 默认值为
30070。参数
说明
host & port
搜索引擎的Elasticsearch兼容连接地址。如何获取,请参见Elasticsearch兼容地址。
重要请务必使用专有网络地址。
user & password
访问向量引擎的用户名和密码。
默认用户名和密码的获取方式:在控制台的左侧导航栏,选择 数据库连接,单击搜索引擎页签,在搜索引擎页签可获取。
index_name
创建的向量索引的名称。
-
选择测试项并填写索引配置。
-
通用参数说明
参数
说明
filter_type
融合查询使用的查询模式,可选efficient_filter|pre_filter|post_filter。推荐选择efficient_filter。
k_expand_scope
post_filter模式下将使用该值替换k值,用来实现放大k值的效果。
number_of_regions
设置向量索引的regions数,如果需要测试单节点的性能表现,可将该值设置为1。
-
索引参数说明
HNSW索引
在 STEP 2: Choose the case(s) 页面,勾选 Search Performance Test (100M Dataset, 768 Dim) 测试用例,数据库选择 Lindorm。将 IndexType 设置为 HNSW,filter_type 设置为 efficient_filter,k_expand_scope 设置为 1000,number_of_regions 设置为 2。
参数
说明
M
每一层图的最大出边数量。
推荐值:32。
efConstruction
索引构建时动态列表的长度。
推荐值:400。
efSearch
索引查询时动态列表的长度。通常用于提升召回精度,但会增加性能开销。
推荐值:100。
IVFPQ索引
在搜索性能测试(100M Dataset, 768 Dim)配置面板中,将 IndexType 设置为 IVF_PQ,filter_type 设置为 efficient_filter,k_expand_scope 设置为 1000,number_of_regions 设置为 1。
参数
说明
nlist
聚类中心的数量。
推荐值:
,n为数据总量。 nprobe
要查询的聚类单元的数量。通常用于提升召回精度,但会增加性能开销。
推荐值:nlist * 0.004。
reorder-factor
使用原始向量进行重排序,获取原始向量的比例为
topk * reorder_factor,通常用于提升召回精度,但会增加性能开销。推荐值:2。
client_refactor
是否在客户端进行重排序。
推荐值:true。
centroids_hnsw_M
若在聚类中心搜索时使用HNSW算法,设定HNSW算法的每一层图的最大出边数量。
推荐值:32。
centroids_hnsw_efConstruction
若在聚类中心搜索时使用HNSW算法,设定HNSW算法在索引构建时动态列表的长度。
推荐值:500。
centroids_hnsw_efSearch
若在聚类中心搜索时使用HNSW算法,设定HNSW算法在查询时动态列表的长度。
推荐值:200。
IVFBQ索引
勾选 Search Performance Test (100M Dataset, 768 Dim),选择 IndexType 为
IVF_BQ,设置 filter_type 为efficient_filter、k_expand_scope 为1000、_number_of_regions 为1。其余参数说明及推荐值见下表。参数
说明
nlist
聚类中心的数量。
推荐值:
,n为数据总量。 nprobe
要查询的聚类单元的数量。通常用于提升召回精度,但会增加性能开销。
推荐值:nlist * 0.004。
reorder-factor
使用原始向量进行重排序,获取原始向量的比例为
topk * reorder_factor,通常用于提升召回精度,但会增加性能开销。推荐值:2。
client_refactor
是否在客户端进行重排序。
推荐值:true。
centroids_hnsw_M
若在聚类中心搜索时使用HNSW算法,设定HNSW算法的每一层图的最大出边数量。
推荐值:32。
centroids_hnsw_efConstruction
若在聚类中心搜索时使用HNSW算法,设定HNSW算法在索引构建时动态列表的长度。
推荐值:500。
centroids_hnsw_efSearch
若在聚类中心搜索时使用HNSW算法,设定HNSW算法在查询时动态列表的长度。
推荐值:200。
exbits
用于指定额外字节数来表示量化后的向量。exbits越大,召回率越高,内存占用越高。
推荐值:2。
-
通过命令行运行测试
-
如果多次重复跑性能测试,可以在下述命令后面加上
--skip-drop-old --skip-load跳过索引创建和数据导入。#HNSW索引 vectordbbench lindormhnsw --case-type Performance768D10M --index-name <index_name> --k 10 --host <host> --port <port> --user <user> --password <password> --m <M> --ef-construction <efConstruction> --ef-search <efSearch> #IVFPQ索引 vectordbbench lindormivfpq --case-type Performance768D10M --index-name <index_name> --k 10 --host <host> --port <port> --user <user> --password <password> --lists <nlist> --probes <nprobe> --m <centroids_hnsw_M> --ef-construction <centroids_hnsw_efConstruction> --ef-search <centroids_hnsw_efSearch> --reorder-factor <reorder_factor> #IVFBQ索引 vectordbbench lindormivfbq --case-type Performance768D10M --index-name <index_name> --k 10 --host <host> --port <port> --user <user> --password <password> --lists <nlist> --probes <nprobe> --exbits <exbits> --m <centroids_hnsw_M> --ef-construction <centroids_hnsw_efConstruction> --ef-search <centroids_hnsw_efSearch> --reorder-factor <reorder_factor> -
运行测试
如果需要跳过索引创建和数据导入,勾选Index already exists。
在 Task Label 中输入任务标签。根据需要勾选 Dataset from Aliyun (Shanghai) 以从阿里云OSS上海节点下载数据集。设置 K value(最近邻搜索数量,默认为 10)、num of concurrencies(搜索并发数,如
32,64,128,160)和 concurrency duration(每次并发搜索测试持续时间,默认为 30 秒)。完成配置后,单击 Run Your Test。
测试结果
在Results页面查看测试结果。以下测试数据基于单节点32核128GB向量引擎。

测试指标说明
|
测试指标 |
说明 |
|
QPS |
每秒处理的读写操作数,单位为次/秒。 |
|
Recall |
查询返回的正确topk最近邻向量的百分比。 |
|
Serial_latency_P95 |
95%的请求延迟低于该值,单位为毫秒。 |
|
Serial_latency_P99 |
99%的请求延迟低于该值,单位为毫秒。 |
HNSW索引Search Performance
|
参数 |
值 |
|
M |
32 |
|
efConstruction |
400 |
|
number_of_regions |
1 重要
该值对于性能测试结果影响较大,本文档基于单节点32C128G向量引擎进行测试,需要将该值设置为1。 |
|
数据集 |
efSearch |
topk |
serial_latency_p95(ms) |
serial_latency_p99(ms) |
qps |
recall |
|
Cohere 1M |
350 |
10 |
1.7 |
1.9 |
42761.0247 |
0.9918 |
|
900 |
100 |
2.9 |
3.4 |
16799.0671 |
0.9905 |
|
|
Cohere 10M |
250 |
10 |
1.9 |
2.3 |
33730.4316 |
0.981 |
|
1000 |
100 |
4.1 |
4.5 |
10163.782 |
0.9808 |
|
|
Bioasq 1M |
520 |
10 |
2 |
2.5 |
31060.1343 |
0.9501 |
|
820 |
100 |
2.8 |
3.2 |
17748.6457 |
0.9504 |
|
|
Bioasq 10M |
1000 |
10 |
3.2 |
3.6 |
13943.0958 |
0.9405 |
|
1000 |
100 |
3.6 |
4 |
11846.4252 |
0.938 |