Milvus 2.1 基准测试快速指南
封面
最近,我们更新了Milvus 2.1 的基准报告。使用 100 万向量数据集进行的测试证明,通过合并小查询,QPS 可以显著提高。
下面是一些简单的脚本,您可以轻松重现测试结果。
操作步骤
部署 Milvus 单机或集群。在本例中,Milvus 服务器的 IP 地址是 10.100.31.105。
部署客户端。在本例中,我们使用 Ubuntu 18.04 和 Python 3.8.13 进行部署。运行以下代码安装 PyMilvus 2.1.1。
pip install pymilvus==2.1.1
下载并复制以下文件到与客户端相同的工作目录。在本例中,工作目录是
/go_ben
.benchmark
(适用于 Ubuntu)或benchmark-mac
(适用于 macOS)
注意
benchmark
和 是使用 Go SDK 2.1.1 开发和编译的可执行文件。它们仅用于进行并发搜索。benchmark-mac
Ubuntu 用户请下载
benchmark
;macOS 用户请下载benchmark-mac
。访问
benchmark
或benchmark-mac
需要可执行权限。Mac 用户需要通过在 "系统偏好设置 "中配置 "安全与隐私 "来信任
benchmark-mac
文件。有关并发搜索的设置可在
go_benchmark.py
源代码中找到并修改。
- 创建 Collections 并插入向量数据。
root@milvus-pytest:/go_ben# python collection_prepare.py 10.100.31.105
- 打开
/tmp/collection_prepare.log
查看运行结果。
...
08/11/2022 17:33:34 PM - INFO - Build index costs 263.626
08/11/2022 17:33:54 PM - INFO - Collection prepared completed
- 调用
benchmark
(或 macOS 上的benchmark-mac
)进行并发搜索。
root@milvus-pytest:/go_ben# python go_benchmark.py 10.100.31.105 ./benchmark
[write_json_file] Remove file(search_vector_file.json).
[write_json_file] Write json file:search_vector_file.json done.
Params of go_benchmark: ['./benchmark', 'locust', '-u', '10.100.31.105:19530', '-q', 'search_vector_file.json', '-s', '{\n "collection_name": "random_1m",\n "partition_names": [],\n "fieldName": "embedding",\n "index_type": "HNSW",\n "metric_type": "L2",\n "params": {\n "sp_value": 64,\n "dim": 128\n },\n "limit": 1,\n "expr": null,\n "output_fields": [],\n "timeout": 600\n}', '-p', '10', '-f', 'json', '-t', '60', '-i', '20', '-l', 'go_log_file.log']
[2022-08-11 11:37:39.811][ INFO] - Name # reqs # fails | Avg Min Max Median | req/s failures/s (benchmark_run.go:212:sample)
[2022-08-11 11:37:39.811][ INFO] - go search 9665 0(0.00%) | 20.679 6.499 81.761 12.810 | 483.25 0.00 (benchmark_run.go:213:sample)
[2022-08-11 11:37:59.811][ INFO] - Name # reqs # fails | Avg Min Max Median | req/s failures/s (benchmark_run.go:212:sample)
[2022-08-11 11:37:59.811][ INFO] - go search 19448 0(0.00%) | 20.443 6.549 78.121 13.401 | 489.22 0.00 (benchmark_run.go:213:sample)
[2022-08-11 11:38:19.811][ INFO] - Name # reqs # fails | Avg Min Max Median | req/s failures/s (benchmark_run.go:212:sample)
[2022-08-11 11:38:19.811][ INFO] - go search 29170 0(0.00%) | 20.568 6.398 76.887 12.828 | 486.15 0.00 (benchmark_run.go:213:sample)
[2022-08-11 11:38:19.811][ DEBUG] - go search run finished, parallel: 10(benchmark_run.go:95:benchmark)
[2022-08-11 11:38:19.811][ INFO] - Name # reqs # fails | Avg Min Max Median | req/s failures/s (benchmark_run.go:159:samplingLoop)
[2022-08-11 11:38:19.811][ INFO] - go search 29180 0(0.00%) | 20.560 6.398 81.761 13.014 | 486.25 0.00 (benchmark_run.go:160:samplingLoop)
Result of go_benchmark: {'response': True, 'err_code': 0, 'err_message': ''}
- 打开当前目录下的
go_log_file.log
文件,查看详细搜索日志。以下是搜索日志中的搜索信息。reqs:从并发开始到当前时刻(当前时间跨度)的搜索请求数
fails(失败):失败请求数占当前时间跨度内请求数的百分比
Avg:当前时间跨度内的平均请求响应时间(单位:毫秒)
Min:当前时间跨度内的最小请求响应时间(单位:毫秒)
Max:当前时间跨度内的最大请求响应时间(单位:毫秒)
中位数:当前时间跨度内请求响应时间的中位数(单位:毫秒)
req/s:每秒请求数,即 QPS
failures/s:当前时间跨度内每秒请求失败的平均次数。
下载脚本和可执行文件
用于 Ubuntu 的benchmark
用于 macOS 的benchmark-mac
下一步
随着 Milvus 2.1 的正式发布,我们准备了一系列介绍新功能的博客。请阅读本系列博客中的更多内容:
- 操作步骤
- 下载脚本和可执行文件
- 下一步
On This Page
Try Managed Milvus for Free
Zilliz Cloud is hassle-free, powered by Milvus and 10x faster.
Get StartedLike the article? Spread the word