vectordb-bench 0.0.1__1.tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of vectordb-bench might be problematic. Click here for more details.
- vectordb-bench-0.0.1/LICENSE +21 -0
- vectordb-bench-0.0.1/PKG-INFO +207 -0
- vectordb-bench-0.0.1/README.md +193 -0
- vectordb-bench-0.0.1/pyproject.toml +53 -0
- vectordb-bench-0.0.1/setup.cfg +4 -0
- vectordb-bench-0.0.1/tests/test_bench_runner.py +60 -0
- vectordb-bench-0.0.1/tests/test_dataset.py +53 -0
- vectordb-bench-0.0.1/tests/test_elasticsearch_cloud.py +86 -0
- vectordb-bench-0.0.1/tests/test_models.py +70 -0
- vectordb-bench-0.0.1/tests/test_utils.py +39 -0
- vectordb-bench-0.0.1/vectordb_bench/__init__.py +30 -0
- vectordb-bench-0.0.1/vectordb_bench/__main__.py +39 -0
- vectordb-bench-0.0.1/vectordb_bench/backend/__init__.py +0 -0
- vectordb-bench-0.0.1/vectordb_bench/backend/assembler.py +57 -0
- vectordb-bench-0.0.1/vectordb_bench/backend/cases.py +124 -0
- vectordb-bench-0.0.1/vectordb_bench/backend/clients/__init__.py +57 -0
- vectordb-bench-0.0.1/vectordb_bench/backend/clients/api.py +179 -0
- vectordb-bench-0.0.1/vectordb_bench/backend/clients/elastic_cloud/config.py +56 -0
- vectordb-bench-0.0.1/vectordb_bench/backend/clients/elastic_cloud/elastic_cloud.py +152 -0
- vectordb-bench-0.0.1/vectordb_bench/backend/clients/milvus/config.py +123 -0
- vectordb-bench-0.0.1/vectordb_bench/backend/clients/milvus/milvus.py +182 -0
- vectordb-bench-0.0.1/vectordb_bench/backend/clients/pinecone/config.py +15 -0
- vectordb-bench-0.0.1/vectordb_bench/backend/clients/pinecone/pinecone.py +113 -0
- vectordb-bench-0.0.1/vectordb_bench/backend/clients/qdrant_cloud/config.py +16 -0
- vectordb-bench-0.0.1/vectordb_bench/backend/clients/qdrant_cloud/qdrant_cloud.py +169 -0
- vectordb-bench-0.0.1/vectordb_bench/backend/clients/weaviate_cloud/config.py +45 -0
- vectordb-bench-0.0.1/vectordb_bench/backend/clients/weaviate_cloud/weaviate_cloud.py +151 -0
- vectordb-bench-0.0.1/vectordb_bench/backend/clients/zilliz_cloud/config.py +34 -0
- vectordb-bench-0.0.1/vectordb_bench/backend/clients/zilliz_cloud/zilliz_cloud.py +35 -0
- vectordb-bench-0.0.1/vectordb_bench/backend/dataset.py +393 -0
- vectordb-bench-0.0.1/vectordb_bench/backend/result_collector.py +15 -0
- vectordb-bench-0.0.1/vectordb_bench/backend/runner/__init__.py +12 -0
- vectordb-bench-0.0.1/vectordb_bench/backend/runner/mp_runner.py +124 -0
- vectordb-bench-0.0.1/vectordb_bench/backend/runner/serial_runner.py +164 -0
- vectordb-bench-0.0.1/vectordb_bench/backend/task_runner.py +290 -0
- vectordb-bench-0.0.1/vectordb_bench/backend/utils.py +85 -0
- vectordb-bench-0.0.1/vectordb_bench/base.py +6 -0
- vectordb-bench-0.0.1/vectordb_bench/frontend/components/check_results/charts.py +175 -0
- vectordb-bench-0.0.1/vectordb_bench/frontend/components/check_results/data.py +86 -0
- vectordb-bench-0.0.1/vectordb_bench/frontend/components/check_results/filters.py +97 -0
- vectordb-bench-0.0.1/vectordb_bench/frontend/components/check_results/headerIcon.py +18 -0
- vectordb-bench-0.0.1/vectordb_bench/frontend/components/check_results/nav.py +21 -0
- vectordb-bench-0.0.1/vectordb_bench/frontend/components/check_results/priceTable.py +48 -0
- vectordb-bench-0.0.1/vectordb_bench/frontend/components/run_test/autoRefresh.py +10 -0
- vectordb-bench-0.0.1/vectordb_bench/frontend/components/run_test/caseSelector.py +87 -0
- vectordb-bench-0.0.1/vectordb_bench/frontend/components/run_test/dbConfigSetting.py +47 -0
- vectordb-bench-0.0.1/vectordb_bench/frontend/components/run_test/dbSelector.py +36 -0
- vectordb-bench-0.0.1/vectordb_bench/frontend/components/run_test/generateTasks.py +21 -0
- vectordb-bench-0.0.1/vectordb_bench/frontend/components/run_test/hideSidebar.py +10 -0
- vectordb-bench-0.0.1/vectordb_bench/frontend/components/run_test/submitTask.py +69 -0
- vectordb-bench-0.0.1/vectordb_bench/frontend/const.py +391 -0
- vectordb-bench-0.0.1/vectordb_bench/frontend/pages/qps_with_price.py +60 -0
- vectordb-bench-0.0.1/vectordb_bench/frontend/pages/run_test.py +59 -0
- vectordb-bench-0.0.1/vectordb_bench/frontend/utils.py +6 -0
- vectordb-bench-0.0.1/vectordb_bench/frontend/vdb_benchmark.py +42 -0
- vectordb-bench-0.0.1/vectordb_bench/interface.py +239 -0
- vectordb-bench-0.0.1/vectordb_bench/log_util.py +103 -0
- vectordb-bench-0.0.1/vectordb_bench/metric.py +53 -0
- vectordb-bench-0.0.1/vectordb_bench/models.py +234 -0
- vectordb-bench-0.0.1/vectordb_bench/results/result_20230609_standard.json +3228 -0
- vectordb-bench-0.0.1/vectordb_bench.egg-info/PKG-INFO +207 -0
- vectordb-bench-0.0.1/vectordb_bench.egg-info/SOURCES.txt +64 -0
- vectordb-bench-0.0.1/vectordb_bench.egg-info/dependency_links.txt +1 -0
- vectordb-bench-0.0.1/vectordb_bench.egg-info/entry_points.txt +2 -0
- vectordb-bench-0.0.1/vectordb_bench.egg-info/requires.txt +21 -0
- vectordb-bench-0.0.1/vectordb_bench.egg-info/top_level.txt +1 -0
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2023 Zilliztech
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
@@ -0,0 +1,207 @@
|
|
1
|
+
Metadata-Version: 2.1
|
2
|
+
Name: vectordb-bench
|
3
|
+
Version: 0.0.1
|
4
|
+
Summary: VectorDBBench is not just an offering of benchmark results for mainstream vector databases and cloud services, it's your go-to tool for the ultimate performance and cost-effectiveness comparison. Designed with ease-of-use in mind, VectorDBBench is devised to help users, even non-professionals, reproduce results or test new systems, making the hunt for the optimal choice amongst a plethora of cloud services and open-source vector databases a breeze.
|
5
|
+
Author-email: XuanYang-cn <xuan.yang@zilliz.com>
|
6
|
+
Project-URL: repository, https://github.com/zilliztech/VectorDBBench
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
9
|
+
Classifier: Operating System :: OS Independent
|
10
|
+
Requires-Python: >=3.11
|
11
|
+
Description-Content-Type: text/markdown
|
12
|
+
Provides-Extra: test
|
13
|
+
License-File: LICENSE
|
14
|
+
|
15
|
+
# VectorDBBench: A Benchmark Tool for VectorDB
|
16
|
+
|
17
|
+
## Quick Start
|
18
|
+
### Prerequirement
|
19
|
+
``` shell
|
20
|
+
python >= 3.11
|
21
|
+
```
|
22
|
+
### Install
|
23
|
+
``` shell
|
24
|
+
pip install vectordb-bench
|
25
|
+
```
|
26
|
+
### Run
|
27
|
+
|
28
|
+
``` shell
|
29
|
+
init_bench
|
30
|
+
```
|
31
|
+
## What is VectorDBBench
|
32
|
+
VectorDBBench is not just an offering of benchmark results for mainstream vector databases and cloud services, it's your go-to tool for the ultimate performance and cost-effectiveness comparison. Designed with ease-of-use in mind, VectorDBBench is devised to help users, even non-professionals, reproduce results or test new systems, making the hunt for the optimal choice amongst a plethora of cloud services and open-source vector databases a breeze.
|
33
|
+
|
34
|
+
Understanding the importance of user experience, we provide an intuitive visual interface. This not only empowers users to initiate benchmarks at ease, but also to view comparative result reports, thereby reproducing benchmark results effortlessly.
|
35
|
+
To add more relevance and practicality, we provide cost-effectiveness reports particularly for cloud services. This allows for a more realistic and applicable benchmarking process.
|
36
|
+
|
37
|
+
Closely mimicking real-world production environments, we've set up diverse testing scenarios including insertion, searching, and filtered searching. To provide you with credible and reliable data, we've included public datasets from actual production scenarios, such as SIFT, GIST, Cohere, and more. It's fascinating to discover how a relatively unknown open-source database might excel in certain circumstances!
|
38
|
+
|
39
|
+
Prepare to delve into the world of VectorDBBench, and let it guide you in uncovering your perfect vector database match.
|
40
|
+
|
41
|
+
## Build on your own
|
42
|
+
### Install requirements
|
43
|
+
``` shell
|
44
|
+
pip install -e '.[test]'
|
45
|
+
```
|
46
|
+
### Run test server
|
47
|
+
```
|
48
|
+
$ python -m vectordb_bench
|
49
|
+
```
|
50
|
+
|
51
|
+
OR:
|
52
|
+
|
53
|
+
```shell
|
54
|
+
$ init_bench
|
55
|
+
```
|
56
|
+
### Check coding styles
|
57
|
+
```shell
|
58
|
+
$ ruff check vectordb_bench
|
59
|
+
```
|
60
|
+
|
61
|
+
Add `--fix` if you want to fix the coding styles automatically
|
62
|
+
|
63
|
+
```shell
|
64
|
+
$ ruff check vectordb_bench --fix
|
65
|
+
```
|
66
|
+
|
67
|
+
## How does it work?
|
68
|
+
### Result Page
|
69
|
+

|
70
|
+
This is the main page of VectorDBBench, which displays the standard benchmark results we provide. Additionally, results of all tests performed by users themselves will also be shown here. We also offer the ability to select and compare results from multiple tests simultaneously.
|
71
|
+
|
72
|
+
The standard benchmark results displayed here include all 12 cases that we currently support for all our clients (Milvus, Zilliz Cloud, Elastic Search, Qdrant Cloud, and Weaviate Cloud). However, as some systems may not be able to complete all the tests successfully due to issues like Out of Memory (OOM) or timeouts, not all clients are included in every case.
|
73
|
+
### Run Test Page
|
74
|
+

|
75
|
+
This is the page to run a test:
|
76
|
+
1. Initially, you select the systems to be tested - multiple selections are allowed. Once selected, corresponding forms will pop up to gather necessary information for using the chosen databases. The db_label is used to differentiate different instances of the same system. We recommend filling in the host size or instance type here (as we do in our standard results).
|
77
|
+
2. The next step is to select the test cases you want to perform. You can select multiple cases at once, and a form to collect corresponding parameters will appear.
|
78
|
+
3. Finally, you'll need to provide a task label to distinguish different test results. Using the same label for different tests will result in the previous results being overwritten.
|
79
|
+
Now we can only run one task at the same time.
|
80
|
+
|
81
|
+
## Module
|
82
|
+
### Code Structure
|
83
|
+

|
84
|
+
### Client
|
85
|
+
Our client module is designed with flexibility and extensibility in mind, aiming to integrate APIs from different systems seamlessly. As of now, it supports Milvus, Zilliz Cloud, Elastic Search, Pinecone, Qdrant, and Weaviate. Stay tuned for more options, as we are consistently working on extending our reach to other systems.
|
86
|
+
### Benchmark Cases
|
87
|
+
We've developed an array of 12 comprehensive benchmark cases to test vector databases' various capabilities, each designed to give you a different piece of the puzzle. These cases are categorized into three main types:
|
88
|
+
#### Capacity Case
|
89
|
+
- **Large Dim:** Tests the database's loading capacity by inserting large-dimension vectors (GIST 100K vectors, 960 dimensions) until fully loaded. The final number of inserted vectors is reported.
|
90
|
+
- **Small Dim:** Similar to the Large Dim case but uses small-dimension vectors (SIFT 100K vectors, 128 dimensions).
|
91
|
+
#### Search Performance Case
|
92
|
+
- **XLarge Dataset:** Measures search performance with a massive dataset (LAION 100M vectors, 768 dimensions) at varying parallel levels. The results include index building time, recall, latency, and maximum QPS.
|
93
|
+
- **Large Dataset:** Similar to the XLarge Dataset case, but uses a slightly smaller dataset (Cohere 10M vectors, 768 dimensions).
|
94
|
+
- **Medium Dataset:** A case using a medium dataset (Cohere 1M vectors, 768 dimensions).
|
95
|
+
- **Small Dataset:** This case uses a small dataset (Cohere 100K vectors, 768 dimensions).
|
96
|
+
#### Filtering Search Performance Case
|
97
|
+
- **Large Dataset, Low Filtering Rate:** Evaluates search performance with a large dataset (Cohere 10M vectors, 768 dimensions) under a low filtering rate (1% vectors) at different parallel levels.
|
98
|
+
- **Medium Dataset, Low Filtering Rate:** This case uses a medium dataset (Cohere 1M vectors, 768 dimensions) with a similar low filtering rate.
|
99
|
+
- **Small Dataset, Low Filtering Rate:** This case uses a small dataset (Cohere 100K vectors, 768 dimensions) with a low filtering rate.
|
100
|
+
- **Large Dataset, High Filtering Rate:** It tests with a large dataset (Cohere 10M vectors, 768 dimensions) but under a high filtering rate (99% vectors).
|
101
|
+
- **Medium Dataset, High Filtering Rate:** This case uses a medium dataset (Cohere 1M vectors, 768 dimensions) with a high filtering rate.
|
102
|
+
- **Small Dataset, High Filtering Rate:** Finally, this case uses a small dataset (Cohere 100K vectors, 768 dimensions) under a high filtering rate.
|
103
|
+
For a quick reference, here is a table summarizing the key aspects of each case:
|
104
|
+
|
105
|
+
Case No. | Case Type | Dataset Size | Dataset Type | Filtering Rate | Results |
|
106
|
+
|----------|-----------|--------------|--------------|----------------|---------|
|
107
|
+
1 | Capacity Case | Large Dim | GIST 100K vectors, 960 dimensions | N/A | Number of inserted vectors |
|
108
|
+
2 | Capacity Case | Small Dim | SIFT 100K vectors, 128 dimensions | N/A | Number of inserted vectors |
|
109
|
+
3 | Search Performance Case | XLarge Dataset | LAION 100M vectors, 768 dimensions | N/A | Index building time, recall, latency, maximum QPS |
|
110
|
+
4 | Search Performance Case | Large Dataset | Cohere 10M vectors, 768 dimensions | N/A | Index building time, recall, latency, maximum QPS |
|
111
|
+
5 | Search Performance Case | Medium Dataset | Cohere 1M vectors, 768 dimensions | N/A | Index building time, recall, latency, maximum QPS |
|
112
|
+
6 | Search Performance Case | Small Dataset | Cohere 100K vectors, 768 dimensions | N/A | Index building time, recall, latency, maximum QPS |
|
113
|
+
7 | Filtering Search Performance Case | Large Dataset, Low Filtering Rate | Cohere 10M vectors, 768 dimensions | 1% vectors | Index building time, recall, latency, maximum QPS |
|
114
|
+
8 | Filtering Search Performance Case | Medium Dataset, Low Filtering Rate | Cohere 1M vectors, 768 dimensions | 1% vectors | Index building time, recall, latency, maximum QPS |
|
115
|
+
9 | Filtering Search Performance Case | Small Dataset, Low Filtering Rate | Cohere 100K vectors, 768 dimensions | 1% vectors | Index building time, recall, latency, maximum QPS |
|
116
|
+
10 | Filtering Search Performance Case | Large Dataset, High Filtering Rate | Cohere 10M vectors, 768 dimensions | 99% vectors | Index building time, recall, latency, maximum QPS |
|
117
|
+
11 | Filtering Search Performance Case | Medium Dataset, High Filtering Rate | Cohere 1M vectors, 768 dimensions | 99% vectors | Index building time, recall, latency, maximum QPS |
|
118
|
+
12 | Filtering Search Performance Case | Small Dataset, High Filtering Rate | Cohere 100K vectors, 768 dimensions | 99% vectors | Index building time, recall, latency, maximum QPS |
|
119
|
+
|
120
|
+
Each case provides an in-depth examination of a vector database's abilities, providing you a comprehensive view of the database's performance.
|
121
|
+
|
122
|
+
## Goals
|
123
|
+
Our goals of this benchmark are:
|
124
|
+
### Reproducibility & Usability
|
125
|
+
One of the primary goals of VectorDBBench is to enable users to reproduce benchmark results swiftly and easily, or to test their customized scenarios. We believe that lowering the barriers to entry for conducting these tests will enhance the community's understanding and improvement of vector databases. We aim to create an environment where any user, regardless of their technical expertise, can quickly set up and run benchmarks, and view and analyze results in an intuitive manner.
|
126
|
+
### Representability & Realism
|
127
|
+
VectorDBBench aims to provide a more comprehensive, multi-faceted testing environment that accurately represents the complexity of vector databases. By moving beyond a simple speed test for algorithms, we hope to contribute to a better understanding of vector databases in real-world scenarios. By incorporating as many complex scenarios as possible, including a variety of test cases and datasets, we aim to reflect realistic conditions and offer tangible significance to our community. Our goal is to deliver benchmarking results that can drive tangible improvements in the development and usage of vector databases.
|
128
|
+
|
129
|
+
## Contribution
|
130
|
+
### General Guidelines
|
131
|
+
1. Fork the repository and create a new branch for your changes.
|
132
|
+
2. Adhere to coding conventions and formatting guidelines.
|
133
|
+
3. Use clear commit messages to document the purpose of your changes.
|
134
|
+
### Adding New Clients
|
135
|
+
**Step 1: Creating New Client Files**
|
136
|
+
|
137
|
+
1. Navigate to the vectordb_bench/backend/clients directory.
|
138
|
+
2. Create a new folder for your client, for example, "new_client".
|
139
|
+
3. Inside the "new_client" folder, create two files: new_client.py and config.py.
|
140
|
+
|
141
|
+
**Step 2: Implement new_client.py and config.py**
|
142
|
+
|
143
|
+
1. Open new_client.py and define the NewClient class, which should inherit from the clients/api.py file's VectorDB abstract class. The VectorDB class serves as the API for benchmarking, and all DB clients must implement this abstract class.
|
144
|
+
Example implementation in new_client.py:
|
145
|
+
new_client.py
|
146
|
+
```python
|
147
|
+
from ..api import VectorDB
|
148
|
+
class NewClient(VectorDB):
|
149
|
+
# Implement the abstract methods defined in the VectorDB class
|
150
|
+
# ...
|
151
|
+
```
|
152
|
+
2. Open config.py and implement the DBConfig and optional DBCaseConfig classes.
|
153
|
+
1. The DBConfig class should be an abstract class that provides information necessary to establish connections with the database. It is recommended to use the pydantic.SecretStr data type to handle sensitive data such as tokens, URIs, or passwords.
|
154
|
+
2. The DBCaseConfig class is optional and allows for providing case-specific configurations for the database. If not provided, it defaults to EmptyDBCaseConfig.
|
155
|
+
Example implementation in config.py:
|
156
|
+
```python
|
157
|
+
from pydantic import SecretStr
|
158
|
+
from clients.api import DBConfig, DBCaseConfig
|
159
|
+
|
160
|
+
class NewDBConfig(DBConfig):
|
161
|
+
# Implement the required configuration fields for the database connection
|
162
|
+
# ...
|
163
|
+
token: SecretStr
|
164
|
+
uri: str
|
165
|
+
|
166
|
+
class NewDBCaseConfig(DBCaseConfig):
|
167
|
+
# Implement optional case-specific configuration fields
|
168
|
+
# ...
|
169
|
+
```
|
170
|
+
**Step 3: Importing the DB Client and Updating Initialization**
|
171
|
+
|
172
|
+
In this final step, you will import your DB client into clients/__init__.py and update the initialization process.
|
173
|
+
1. Open clients/__init__.py and import your NewClient from new_client.py.
|
174
|
+
2. Add your NewClient to the DB enum.
|
175
|
+
3. Update the db2client dictionary by adding an entry for your NewClient.
|
176
|
+
Example implementation in clients/__init__.py:
|
177
|
+
```python
|
178
|
+
#clients/__init__.py
|
179
|
+
|
180
|
+
from .new_client.new_client import NewClient
|
181
|
+
|
182
|
+
#Add NewClient to the DB enum
|
183
|
+
class DB(Enum):
|
184
|
+
...
|
185
|
+
DB.NewClient = "NewClient"
|
186
|
+
|
187
|
+
#Add NewClient to the db2client dictionary
|
188
|
+
db2client = {
|
189
|
+
DB.Milvus: Milvus,
|
190
|
+
...
|
191
|
+
DB.NewClient: NewClient
|
192
|
+
}
|
193
|
+
```
|
194
|
+
That's it! You have successfully added a new DB client to the vectordb_bench project.
|
195
|
+
|
196
|
+
## Rules
|
197
|
+
### Installation
|
198
|
+
The system under test can be installed in any form to achieve optimal performance. This includes but is not limited to binary deployment, Docker, and cloud services.
|
199
|
+
### Fine-Tuning
|
200
|
+
For the system under test, we use the default server-side configuration to maintain the authenticity and representativeness of our results.
|
201
|
+
For the Client, we welcome any parameter tuning to obtain better results.
|
202
|
+
### Incomplete Results
|
203
|
+
Many databases may not be able to complete all test cases due to issues such as Out of Memory (OOM), crashes, or timeouts. In these scenarios, we will clearly state these occurrences in the test results.
|
204
|
+
### Unpublishable Results
|
205
|
+
Although we are trying to support as many clients as possible for benchmarking, due to the restrictions imposed by the [Dewitt Clause](https://cube.dev/blog/dewitt-clause-or-can-you-benchmark-a-database), we're unable to publish all benchmark results. This means that users may not be able to fully compare performance data for certain databases on our platform, despite the support we have integrated for these systems.
|
206
|
+
### Mistake Or Misrepresentation
|
207
|
+
We strive for accuracy in learning and supporting various vector databases, yet there might be oversights or misapplications. For any such occurrences, feel free to [raise an issue](https://github.com/zilliztech/VectorDBBench/issues/new) or make amendments on our GitHub page.
|
@@ -0,0 +1,193 @@
|
|
1
|
+
# VectorDBBench: A Benchmark Tool for VectorDB
|
2
|
+
|
3
|
+
## Quick Start
|
4
|
+
### Prerequirement
|
5
|
+
``` shell
|
6
|
+
python >= 3.11
|
7
|
+
```
|
8
|
+
### Install
|
9
|
+
``` shell
|
10
|
+
pip install vectordb-bench
|
11
|
+
```
|
12
|
+
### Run
|
13
|
+
|
14
|
+
``` shell
|
15
|
+
init_bench
|
16
|
+
```
|
17
|
+
## What is VectorDBBench
|
18
|
+
VectorDBBench is not just an offering of benchmark results for mainstream vector databases and cloud services, it's your go-to tool for the ultimate performance and cost-effectiveness comparison. Designed with ease-of-use in mind, VectorDBBench is devised to help users, even non-professionals, reproduce results or test new systems, making the hunt for the optimal choice amongst a plethora of cloud services and open-source vector databases a breeze.
|
19
|
+
|
20
|
+
Understanding the importance of user experience, we provide an intuitive visual interface. This not only empowers users to initiate benchmarks at ease, but also to view comparative result reports, thereby reproducing benchmark results effortlessly.
|
21
|
+
To add more relevance and practicality, we provide cost-effectiveness reports particularly for cloud services. This allows for a more realistic and applicable benchmarking process.
|
22
|
+
|
23
|
+
Closely mimicking real-world production environments, we've set up diverse testing scenarios including insertion, searching, and filtered searching. To provide you with credible and reliable data, we've included public datasets from actual production scenarios, such as SIFT, GIST, Cohere, and more. It's fascinating to discover how a relatively unknown open-source database might excel in certain circumstances!
|
24
|
+
|
25
|
+
Prepare to delve into the world of VectorDBBench, and let it guide you in uncovering your perfect vector database match.
|
26
|
+
|
27
|
+
## Build on your own
|
28
|
+
### Install requirements
|
29
|
+
``` shell
|
30
|
+
pip install -e '.[test]'
|
31
|
+
```
|
32
|
+
### Run test server
|
33
|
+
```
|
34
|
+
$ python -m vectordb_bench
|
35
|
+
```
|
36
|
+
|
37
|
+
OR:
|
38
|
+
|
39
|
+
```shell
|
40
|
+
$ init_bench
|
41
|
+
```
|
42
|
+
### Check coding styles
|
43
|
+
```shell
|
44
|
+
$ ruff check vectordb_bench
|
45
|
+
```
|
46
|
+
|
47
|
+
Add `--fix` if you want to fix the coding styles automatically
|
48
|
+
|
49
|
+
```shell
|
50
|
+
$ ruff check vectordb_bench --fix
|
51
|
+
```
|
52
|
+
|
53
|
+
## How does it work?
|
54
|
+
### Result Page
|
55
|
+

|
56
|
+
This is the main page of VectorDBBench, which displays the standard benchmark results we provide. Additionally, results of all tests performed by users themselves will also be shown here. We also offer the ability to select and compare results from multiple tests simultaneously.
|
57
|
+
|
58
|
+
The standard benchmark results displayed here include all 12 cases that we currently support for all our clients (Milvus, Zilliz Cloud, Elastic Search, Qdrant Cloud, and Weaviate Cloud). However, as some systems may not be able to complete all the tests successfully due to issues like Out of Memory (OOM) or timeouts, not all clients are included in every case.
|
59
|
+
### Run Test Page
|
60
|
+

|
61
|
+
This is the page to run a test:
|
62
|
+
1. Initially, you select the systems to be tested - multiple selections are allowed. Once selected, corresponding forms will pop up to gather necessary information for using the chosen databases. The db_label is used to differentiate different instances of the same system. We recommend filling in the host size or instance type here (as we do in our standard results).
|
63
|
+
2. The next step is to select the test cases you want to perform. You can select multiple cases at once, and a form to collect corresponding parameters will appear.
|
64
|
+
3. Finally, you'll need to provide a task label to distinguish different test results. Using the same label for different tests will result in the previous results being overwritten.
|
65
|
+
Now we can only run one task at the same time.
|
66
|
+
|
67
|
+
## Module
|
68
|
+
### Code Structure
|
69
|
+

|
70
|
+
### Client
|
71
|
+
Our client module is designed with flexibility and extensibility in mind, aiming to integrate APIs from different systems seamlessly. As of now, it supports Milvus, Zilliz Cloud, Elastic Search, Pinecone, Qdrant, and Weaviate. Stay tuned for more options, as we are consistently working on extending our reach to other systems.
|
72
|
+
### Benchmark Cases
|
73
|
+
We've developed an array of 12 comprehensive benchmark cases to test vector databases' various capabilities, each designed to give you a different piece of the puzzle. These cases are categorized into three main types:
|
74
|
+
#### Capacity Case
|
75
|
+
- **Large Dim:** Tests the database's loading capacity by inserting large-dimension vectors (GIST 100K vectors, 960 dimensions) until fully loaded. The final number of inserted vectors is reported.
|
76
|
+
- **Small Dim:** Similar to the Large Dim case but uses small-dimension vectors (SIFT 100K vectors, 128 dimensions).
|
77
|
+
#### Search Performance Case
|
78
|
+
- **XLarge Dataset:** Measures search performance with a massive dataset (LAION 100M vectors, 768 dimensions) at varying parallel levels. The results include index building time, recall, latency, and maximum QPS.
|
79
|
+
- **Large Dataset:** Similar to the XLarge Dataset case, but uses a slightly smaller dataset (Cohere 10M vectors, 768 dimensions).
|
80
|
+
- **Medium Dataset:** A case using a medium dataset (Cohere 1M vectors, 768 dimensions).
|
81
|
+
- **Small Dataset:** This case uses a small dataset (Cohere 100K vectors, 768 dimensions).
|
82
|
+
#### Filtering Search Performance Case
|
83
|
+
- **Large Dataset, Low Filtering Rate:** Evaluates search performance with a large dataset (Cohere 10M vectors, 768 dimensions) under a low filtering rate (1% vectors) at different parallel levels.
|
84
|
+
- **Medium Dataset, Low Filtering Rate:** This case uses a medium dataset (Cohere 1M vectors, 768 dimensions) with a similar low filtering rate.
|
85
|
+
- **Small Dataset, Low Filtering Rate:** This case uses a small dataset (Cohere 100K vectors, 768 dimensions) with a low filtering rate.
|
86
|
+
- **Large Dataset, High Filtering Rate:** It tests with a large dataset (Cohere 10M vectors, 768 dimensions) but under a high filtering rate (99% vectors).
|
87
|
+
- **Medium Dataset, High Filtering Rate:** This case uses a medium dataset (Cohere 1M vectors, 768 dimensions) with a high filtering rate.
|
88
|
+
- **Small Dataset, High Filtering Rate:** Finally, this case uses a small dataset (Cohere 100K vectors, 768 dimensions) under a high filtering rate.
|
89
|
+
For a quick reference, here is a table summarizing the key aspects of each case:
|
90
|
+
|
91
|
+
Case No. | Case Type | Dataset Size | Dataset Type | Filtering Rate | Results |
|
92
|
+
|----------|-----------|--------------|--------------|----------------|---------|
|
93
|
+
1 | Capacity Case | Large Dim | GIST 100K vectors, 960 dimensions | N/A | Number of inserted vectors |
|
94
|
+
2 | Capacity Case | Small Dim | SIFT 100K vectors, 128 dimensions | N/A | Number of inserted vectors |
|
95
|
+
3 | Search Performance Case | XLarge Dataset | LAION 100M vectors, 768 dimensions | N/A | Index building time, recall, latency, maximum QPS |
|
96
|
+
4 | Search Performance Case | Large Dataset | Cohere 10M vectors, 768 dimensions | N/A | Index building time, recall, latency, maximum QPS |
|
97
|
+
5 | Search Performance Case | Medium Dataset | Cohere 1M vectors, 768 dimensions | N/A | Index building time, recall, latency, maximum QPS |
|
98
|
+
6 | Search Performance Case | Small Dataset | Cohere 100K vectors, 768 dimensions | N/A | Index building time, recall, latency, maximum QPS |
|
99
|
+
7 | Filtering Search Performance Case | Large Dataset, Low Filtering Rate | Cohere 10M vectors, 768 dimensions | 1% vectors | Index building time, recall, latency, maximum QPS |
|
100
|
+
8 | Filtering Search Performance Case | Medium Dataset, Low Filtering Rate | Cohere 1M vectors, 768 dimensions | 1% vectors | Index building time, recall, latency, maximum QPS |
|
101
|
+
9 | Filtering Search Performance Case | Small Dataset, Low Filtering Rate | Cohere 100K vectors, 768 dimensions | 1% vectors | Index building time, recall, latency, maximum QPS |
|
102
|
+
10 | Filtering Search Performance Case | Large Dataset, High Filtering Rate | Cohere 10M vectors, 768 dimensions | 99% vectors | Index building time, recall, latency, maximum QPS |
|
103
|
+
11 | Filtering Search Performance Case | Medium Dataset, High Filtering Rate | Cohere 1M vectors, 768 dimensions | 99% vectors | Index building time, recall, latency, maximum QPS |
|
104
|
+
12 | Filtering Search Performance Case | Small Dataset, High Filtering Rate | Cohere 100K vectors, 768 dimensions | 99% vectors | Index building time, recall, latency, maximum QPS |
|
105
|
+
|
106
|
+
Each case provides an in-depth examination of a vector database's abilities, providing you a comprehensive view of the database's performance.
|
107
|
+
|
108
|
+
## Goals
|
109
|
+
Our goals of this benchmark are:
|
110
|
+
### Reproducibility & Usability
|
111
|
+
One of the primary goals of VectorDBBench is to enable users to reproduce benchmark results swiftly and easily, or to test their customized scenarios. We believe that lowering the barriers to entry for conducting these tests will enhance the community's understanding and improvement of vector databases. We aim to create an environment where any user, regardless of their technical expertise, can quickly set up and run benchmarks, and view and analyze results in an intuitive manner.
|
112
|
+
### Representability & Realism
|
113
|
+
VectorDBBench aims to provide a more comprehensive, multi-faceted testing environment that accurately represents the complexity of vector databases. By moving beyond a simple speed test for algorithms, we hope to contribute to a better understanding of vector databases in real-world scenarios. By incorporating as many complex scenarios as possible, including a variety of test cases and datasets, we aim to reflect realistic conditions and offer tangible significance to our community. Our goal is to deliver benchmarking results that can drive tangible improvements in the development and usage of vector databases.
|
114
|
+
|
115
|
+
## Contribution
|
116
|
+
### General Guidelines
|
117
|
+
1. Fork the repository and create a new branch for your changes.
|
118
|
+
2. Adhere to coding conventions and formatting guidelines.
|
119
|
+
3. Use clear commit messages to document the purpose of your changes.
|
120
|
+
### Adding New Clients
|
121
|
+
**Step 1: Creating New Client Files**
|
122
|
+
|
123
|
+
1. Navigate to the vectordb_bench/backend/clients directory.
|
124
|
+
2. Create a new folder for your client, for example, "new_client".
|
125
|
+
3. Inside the "new_client" folder, create two files: new_client.py and config.py.
|
126
|
+
|
127
|
+
**Step 2: Implement new_client.py and config.py**
|
128
|
+
|
129
|
+
1. Open new_client.py and define the NewClient class, which should inherit from the clients/api.py file's VectorDB abstract class. The VectorDB class serves as the API for benchmarking, and all DB clients must implement this abstract class.
|
130
|
+
Example implementation in new_client.py:
|
131
|
+
new_client.py
|
132
|
+
```python
|
133
|
+
from ..api import VectorDB
|
134
|
+
class NewClient(VectorDB):
|
135
|
+
# Implement the abstract methods defined in the VectorDB class
|
136
|
+
# ...
|
137
|
+
```
|
138
|
+
2. Open config.py and implement the DBConfig and optional DBCaseConfig classes.
|
139
|
+
1. The DBConfig class should be an abstract class that provides information necessary to establish connections with the database. It is recommended to use the pydantic.SecretStr data type to handle sensitive data such as tokens, URIs, or passwords.
|
140
|
+
2. The DBCaseConfig class is optional and allows for providing case-specific configurations for the database. If not provided, it defaults to EmptyDBCaseConfig.
|
141
|
+
Example implementation in config.py:
|
142
|
+
```python
|
143
|
+
from pydantic import SecretStr
|
144
|
+
from clients.api import DBConfig, DBCaseConfig
|
145
|
+
|
146
|
+
class NewDBConfig(DBConfig):
|
147
|
+
# Implement the required configuration fields for the database connection
|
148
|
+
# ...
|
149
|
+
token: SecretStr
|
150
|
+
uri: str
|
151
|
+
|
152
|
+
class NewDBCaseConfig(DBCaseConfig):
|
153
|
+
# Implement optional case-specific configuration fields
|
154
|
+
# ...
|
155
|
+
```
|
156
|
+
**Step 3: Importing the DB Client and Updating Initialization**
|
157
|
+
|
158
|
+
In this final step, you will import your DB client into clients/__init__.py and update the initialization process.
|
159
|
+
1. Open clients/__init__.py and import your NewClient from new_client.py.
|
160
|
+
2. Add your NewClient to the DB enum.
|
161
|
+
3. Update the db2client dictionary by adding an entry for your NewClient.
|
162
|
+
Example implementation in clients/__init__.py:
|
163
|
+
```python
|
164
|
+
#clients/__init__.py
|
165
|
+
|
166
|
+
from .new_client.new_client import NewClient
|
167
|
+
|
168
|
+
#Add NewClient to the DB enum
|
169
|
+
class DB(Enum):
|
170
|
+
...
|
171
|
+
DB.NewClient = "NewClient"
|
172
|
+
|
173
|
+
#Add NewClient to the db2client dictionary
|
174
|
+
db2client = {
|
175
|
+
DB.Milvus: Milvus,
|
176
|
+
...
|
177
|
+
DB.NewClient: NewClient
|
178
|
+
}
|
179
|
+
```
|
180
|
+
That's it! You have successfully added a new DB client to the vectordb_bench project.
|
181
|
+
|
182
|
+
## Rules
|
183
|
+
### Installation
|
184
|
+
The system under test can be installed in any form to achieve optimal performance. This includes but is not limited to binary deployment, Docker, and cloud services.
|
185
|
+
### Fine-Tuning
|
186
|
+
For the system under test, we use the default server-side configuration to maintain the authenticity and representativeness of our results.
|
187
|
+
For the Client, we welcome any parameter tuning to obtain better results.
|
188
|
+
### Incomplete Results
|
189
|
+
Many databases may not be able to complete all test cases due to issues such as Out of Memory (OOM), crashes, or timeouts. In these scenarios, we will clearly state these occurrences in the test results.
|
190
|
+
### Unpublishable Results
|
191
|
+
Although we are trying to support as many clients as possible for benchmarking, due to the restrictions imposed by the [Dewitt Clause](https://cube.dev/blog/dewitt-clause-or-can-you-benchmark-a-database), we're unable to publish all benchmark results. This means that users may not be able to fully compare performance data for certain databases on our platform, despite the support we have integrated for these systems.
|
192
|
+
### Mistake Or Misrepresentation
|
193
|
+
We strive for accuracy in learning and supporting various vector databases, yet there might be oversights or misapplications. For any such occurrences, feel free to [raise an issue](https://github.com/zilliztech/VectorDBBench/issues/new) or make amendments on our GitHub page.
|
@@ -0,0 +1,53 @@
|
|
1
|
+
[build-system]
|
2
|
+
requires = ["setuptools>=67.0", "wheel"]
|
3
|
+
build-backend = "setuptools.build_meta"
|
4
|
+
|
5
|
+
[tool.setuptools.package-data]
|
6
|
+
"vectordb_bench.results" = ["*.json"]
|
7
|
+
|
8
|
+
[project]
|
9
|
+
name = "vectordb-bench"
|
10
|
+
authors = [
|
11
|
+
{name="XuanYang-cn", email="xuan.yang@zilliz.com"},
|
12
|
+
]
|
13
|
+
description = "VectorDBBench is not just an offering of benchmark results for mainstream vector databases and cloud services, it's your go-to tool for the ultimate performance and cost-effectiveness comparison. Designed with ease-of-use in mind, VectorDBBench is devised to help users, even non-professionals, reproduce results or test new systems, making the hunt for the optimal choice amongst a plethora of cloud services and open-source vector databases a breeze."
|
14
|
+
|
15
|
+
readme = "README.md"
|
16
|
+
requires-python = ">=3.11"
|
17
|
+
classifiers = [
|
18
|
+
"Programming Language :: Python :: 3",
|
19
|
+
"License :: OSI Approved :: MIT License",
|
20
|
+
"Operating System :: OS Independent",
|
21
|
+
]
|
22
|
+
dependencies = [
|
23
|
+
"pytz",
|
24
|
+
"streamlit-autorefresh",
|
25
|
+
"streamlit>=1.23.0",
|
26
|
+
"streamlit_extras",
|
27
|
+
"grpcio==1.53.0", # for qdrant-client and pymilvus
|
28
|
+
"grpcio-tools==1.53.0", # for qdrant-client and pymilvus
|
29
|
+
"pymilvus", # with pandas, numpy, ujson
|
30
|
+
"qdrant-client",
|
31
|
+
"pinecone-client",
|
32
|
+
"weaviate-client",
|
33
|
+
"elasticsearch",
|
34
|
+
"plotly",
|
35
|
+
"pydantic==v1.10.7", # for qdrant-client
|
36
|
+
"environs",
|
37
|
+
"scikit-learn",
|
38
|
+
"s3fs",
|
39
|
+
"psutil",
|
40
|
+
]
|
41
|
+
version = "0.0.1"
|
42
|
+
|
43
|
+
[project.optional-dependencies]
|
44
|
+
test = [
|
45
|
+
"ruff",
|
46
|
+
"pytest",
|
47
|
+
]
|
48
|
+
|
49
|
+
[project.urls]
|
50
|
+
"repository" = "https://github.com/zilliztech/VectorDBBench"
|
51
|
+
|
52
|
+
[project.scripts]
|
53
|
+
init_bench = "vectordb_bench.__main__:main"
|
@@ -0,0 +1,60 @@
|
|
1
|
+
import time
|
2
|
+
import logging
|
3
|
+
from vectordb_bench.interface import BenchMarkRunner
|
4
|
+
from vectordb_bench.models import (
|
5
|
+
DB, IndexType, CaseType, TaskConfig, CaseConfig,
|
6
|
+
)
|
7
|
+
|
8
|
+
log = logging.getLogger(__name__)
|
9
|
+
|
10
|
+
class TestBenchRunner:
|
11
|
+
def test_get_results(self):
|
12
|
+
runner = BenchMarkRunner()
|
13
|
+
|
14
|
+
result = runner.get_results()
|
15
|
+
log.info(f"test result: {result}")
|
16
|
+
|
17
|
+
def test_performance_case_whole(self):
|
18
|
+
runner = BenchMarkRunner()
|
19
|
+
|
20
|
+
task_config=TaskConfig(
|
21
|
+
db=DB.Milvus,
|
22
|
+
db_config=DB.Milvus.config(),
|
23
|
+
db_case_config=DB.Milvus.case_config_cls(index=IndexType.Flat)(),
|
24
|
+
case_config=CaseConfig(case_id=CaseType.PerformanceSZero),
|
25
|
+
)
|
26
|
+
|
27
|
+
runner.run([task_config])
|
28
|
+
runner._sync_running_task()
|
29
|
+
result = runner.get_results()
|
30
|
+
log.info(f"test result: {result}")
|
31
|
+
|
32
|
+
def test_performance_case_clean(self):
|
33
|
+
runner = BenchMarkRunner()
|
34
|
+
|
35
|
+
task_config=TaskConfig(
|
36
|
+
db=DB.Milvus,
|
37
|
+
db_config=DB.Milvus.config(),
|
38
|
+
db_case_config=DB.Milvus.case_config_cls(index=IndexType.Flat)(),
|
39
|
+
case_config=CaseConfig(case_id=CaseType.PerformanceSZero),
|
40
|
+
)
|
41
|
+
|
42
|
+
runner.run([task_config])
|
43
|
+
time.sleep(3)
|
44
|
+
runner.stop_running()
|
45
|
+
|
46
|
+
def test_performance_case_no_error(self):
|
47
|
+
task_config=TaskConfig(
|
48
|
+
db=DB.ZillizCloud,
|
49
|
+
db_config=DB.ZillizCloud.config(uri="xxx", user="abc", password="1234"),
|
50
|
+
db_case_config=DB.ZillizCloud.case_config_cls()(),
|
51
|
+
case_config=CaseConfig(case_id=CaseType.PerformanceSZero),
|
52
|
+
)
|
53
|
+
|
54
|
+
t = task_config.copy()
|
55
|
+
d = t.json(exclude={'db_config': {'password', 'api_key'}})
|
56
|
+
log.info(f"{d}")
|
57
|
+
|
58
|
+
import ujson
|
59
|
+
loads = ujson.loads(d)
|
60
|
+
log.info(f"{loads}")
|
@@ -0,0 +1,53 @@
|
|
1
|
+
import pytest
|
2
|
+
import logging
|
3
|
+
|
4
|
+
from vectordb_bench.backend import dataset as ds
|
5
|
+
|
6
|
+
log = logging.getLogger(__name__)
|
7
|
+
class TestDataSet:
|
8
|
+
@pytest.mark.skip("not ready in s3")
|
9
|
+
def test_init_dataset(self):
|
10
|
+
testdatasets = [ds.get(d, lb) for d in ds.Name for lb in ds.Label if ds.get(d, lb) is not None]
|
11
|
+
for t in testdatasets:
|
12
|
+
t._validate_local_file()
|
13
|
+
|
14
|
+
@pytest.mark.skip("not ready in s3")
|
15
|
+
def test_init_gist(self):
|
16
|
+
g = ds.GIST_S()
|
17
|
+
log.debug(f"GIST SMALL: {g}")
|
18
|
+
assert g.name == "GIST"
|
19
|
+
assert g.label == "SMALL"
|
20
|
+
assert g.size == 100_000
|
21
|
+
|
22
|
+
gists = [ds.get(ds.Name.GIST, lb) for lb in ds.Label if ds.get(ds.Name.GIST, lb) is not None]
|
23
|
+
for t in gists:
|
24
|
+
t._validate_local_file()
|
25
|
+
|
26
|
+
def test_init_cohere(self):
|
27
|
+
coheres = [ds.get(ds.Name.Cohere, lb) for lb in ds.Label if ds.get(ds.Name.Cohere, lb) is not None]
|
28
|
+
for t in coheres:
|
29
|
+
t._validate_local_file()
|
30
|
+
|
31
|
+
def test_init_sift(self):
|
32
|
+
sifts = [ds.get(ds.Name.SIFT, lb) for lb in ds.Label if ds.get(ds.Name.SIFT, lb) is not None]
|
33
|
+
for t in sifts:
|
34
|
+
t._validate_local_file()
|
35
|
+
|
36
|
+
@pytest.mark.skip("runs locally")
|
37
|
+
def test_iter_dataset_cohere(self):
|
38
|
+
cohere_s = ds.get(ds.Name.Cohere, ds.Label.SMALL)
|
39
|
+
assert cohere_s.prepare()
|
40
|
+
|
41
|
+
for f in cohere_s:
|
42
|
+
log.debug(f"iter to: {f.columns}")
|
43
|
+
|
44
|
+
# @pytest.mark.skip("runs locally")
|
45
|
+
def test_dataset_download(self):
|
46
|
+
cohere_s = ds.get(ds.Name.Cohere, ds.Label.SMALL)
|
47
|
+
assert cohere_s.prepare()
|
48
|
+
|
49
|
+
|
50
|
+
cohere_m = ds.get(ds.Name.Cohere, ds.Label.MEDIUM)
|
51
|
+
cohere_m._validate_local_file()
|
52
|
+
assert cohere_m.prepare() is True
|
53
|
+
assert cohere_m.prepare() is True
|