Milvus 2.1 基準快速指南
封面
最近,我們更新了Milvus 2.1 的基準報告。使用 100 萬向量的資料集進行的測試證明,透過合併small-nq查詢,可以大幅提升 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
原始碼中找到並修改並發搜尋的設定。
- 建立集合並插入向量資料。
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:在目前的時間範圍內,失敗的要求數目佔 reqs 的百分比
Avg:目前時間範圍內的平均要求回應時間(單位:毫秒)
Min:當前時間跨度內的最小請求回應時間(單位:毫秒)
Max:目前時間範圍內的最大請求回應時間(單位:毫秒)
Median:目前時間範圍內的中位要求回應時間(單位:毫秒)
req/s:每秒的要求數目,即 QPS
failures/s:目前時間範圍內每秒平均失敗的要求數目
下載腳本和可執行檔案
benchmark適用於 Ubuntu
benchmark-mac適用於 macOS
下一步
隨著 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