Package: vectordb-bench
VectorDBBench: A Benchmark Tool for VectorDBLeaderboard:https://zilliz.com/benchmarkQuick StartPrerequirementpython>=3.11InstallInstall vectordb-bench with only PyMilvuspipinstallvectordb-benchInstall all database clientspipinstallvectordb-bench[all]Install the specific database clientpipinstallvectordb-bench[pinecone]All the database client supportedOptional database clientinstall commandpymilvus(default)pip install vectordb-benchallpip install vectordb-bench[all]qdrantpip install vectordb-bench[qdrant]pineconepip install vectordb-bench[pinecone]weaviatepip install vectordb-bench[weaviate]elasticpip install vectordb-bench[elastic]pgvectorpip install vectordb-bench[pgvector]pgvecto.rspip install vectordb-bench[pgvecto_rs]redispip install vectordb-bench[redis]chromadbpip install vectordb-bench[chromadb]Runinit_benchWhat is VectorDBBenchVectorDBBench 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.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.
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.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 asSIFT,GIST,Cohere, and a dataset generated by OpenAI from an opensourceraw dataset. It's fascinating to discover how a relatively unknown open-source database might excel in certain circumstances!Prepare to delve into the world of VectorDBBench, and let it guide you in uncovering your perfect vector database match.LeaderboardIntroductionTo facilitate the presentation of test results and provide a comprehensive performance analysis report, we offer aleaderboard page. It allows us to choose from QPS, QP$, and latency metrics, and provides a comprehensive assessment of a system's performance based on the test results of various cases and a set of scoring mechanisms (to be introduced later). On this leaderboard, we can select the systems and models to be compared, and filter out cases we do not want to consider. Comprehensive scores are always ranked from best to worst, and the specific test results of each query will be presented in the list below.Scoring RulesFor each case, select a base value and score each system based on relative values.For QPS and QP$, we use the highest value as the reference, denoted asbase_QPSorbase_QP$, and the score of each system is(QPS/base_QPS) * 100or(QP$/base_QP$) * 100.For Latency, we use the lowest value as the reference, that is,base_Latency, and the score of each system is(base_Latency + 10ms)/(Latency + 10ms) * 100.We want to give equal weight to different cases, and not let a case with high absolute result values become the sole reason for the overall scoring. Therefore, when scoring different systems in each case, we need to use relative values.Also, for Latency, we add 10ms to the numerator and denominator to ensure that if every system performs particularly well in a case, its advantage will not be infinitely magnified when latency tends to 0.For systems that fail or timeout in a particular case, we will give them a score based on a value worse than the worst result by a factor of two. For example, in QPS or QP$, it would be half the lowest value. For Latency, it would be twice the maximum value.For each system, we will take the geometric mean of its scores in all cases as its comprehensive score for a particular metric.Build on your ownInstall requirementspipinstall-e'.[test]'pipinstall-e'.[pinecone]'Run test server$ python -m vectordb_benchOR:$init_benchCheck coding styles$ruffcheckvectordb_benchAdd--fixif you want to fix the coding styles automatically$ruffcheckvectordb_bench--fixHow does it work?Result PageThis 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.The standard benchmark results displayed here include all 15 cases that we currently support for 6 of our clients (Milvus, Zilliz Cloud, Elastic Search, Qdrant Cloud, Weaviate Cloud and PgVector). 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.All standard benchmark results are generated by a client running on an 8 core, 32 GB host, which is located in the same region as the server being tested. The client host is equipped with anIntel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHzprocessor. Also all the servers for the open-source systems tested in our benchmarks run on hosts with the same type of processor.Run Test PageThis is the page to run a test: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).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.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.
Now we can only run one task at the same time.ModuleCode StructureClientOur 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 Cloud, Weaviate Cloud, PgVector, Redis, and Chroma. Stay tuned for more options, as we are consistently working on extending our reach to other systems.Benchmark CasesWe've developed an array of 15 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:Capacity CaseLarge 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.Small Dim:Similar to the Large Dim case but uses small-dimension vectors (SIFT 500K vectors, 128 dimensions).Search Performance CaseXLarge 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.Large Dataset:Similar to the XLarge Dataset case, but uses a slightly smaller dataset (10M-768dim, 5M-1536dim).Medium Dataset:A case using a medium dataset (1M-768dim, 500K-1536dim).Filtering Search Performance CaseLarge Dataset, Low Filtering Rate:Evaluates search performance with a large dataset (10M-768dim, 5M-1536dim) under a low filtering rate (1% vectors) at different parallel levels.Medium Dataset, Low Filtering Rate:This case uses a medium dataset (1M-768dim, 500K-1536dim) with a similar low filtering rate.Large Dataset, High Filtering Rate:It tests with a large dataset (10M-768dim, 5M-1536dim) but under a high filtering rate (99% vectors).Medium Dataset, High Filtering Rate:This case uses a medium dataset (1M-768dim, 500K-1536dim) with a high filtering rate.
For a quick reference, here is a table summarizing the key aspects of each case:Case No.Case TypeDataset SizeFiltering RateResults1Capacity CaseSIFT 500K vectors, 128 dimensionsN/ANumber of inserted vectors2Capacity CaseGIST 100K vectors, 960 dimensionsN/ANumber of inserted vectors3Search Performance CaseLAION 100M vectors, 768 dimensionsN/AIndex building time, recall, latency, maximum QPS4Search Performance CaseCohere 10M vectors, 768 dimensionsN/AIndex building time, recall, latency, maximum QPS5Search Performance CaseCohere 1M vectors, 768 dimensionsN/AIndex building time, recall, latency, maximum QPS6Filtering Search Performance CaseCohere 10M vectors, 768 dimensions1% vectorsIndex building time, recall, latency, maximum QPS7Filtering Search Performance CaseCohere 1M vectors, 768 dimensions1% vectorsIndex building time, recall, latency, maximum QPS8Filtering Search Performance CaseCohere 10M vectors, 768 dimensions99% vectorsIndex building time, recall, latency, maximum QPS9Filtering Search Performance CaseCohere 1M vectors, 768 dimensions99% vectorsIndex building time, recall, latency, maximum QPS10Search Performance CaseOpenAI generated 500K vectors, 1536 dimensionsN/AIndex building time, recall, latency, maximum QPS11Search Performance CaseOpenAI generated 5M vectors, 1536 dimensionsN/AIndex building time, recall, latency, maximum QPS12Filtering Search Performance CaseOpenAI generated 500K vectors, 1536 dimensions1% vectorsIndex building time, recall, latency, maximum QPS13Filtering Search Performance CaseOpenAI generated 5M vectors, 1536 dimensions1% vectorsIndex building time, recall, latency, maximum QPS14Filtering Search Performance CaseOpenAI generated 500K vectors, 1536 dimensions99% vectorsIndex building time, recall, latency, maximum QPS15Filtering Search Performance CaseOpenAI generated 5M vectors, 1536 dimensions99% vectorsIndex building time, recall, latency, maximum QPSEach case provides an in-depth examination of a vector database's abilities, providing you a comprehensive view of the database's performance.GoalsOur goals of this benchmark are:Reproducibility & UsabilityOne 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.Representability & RealismVectorDBBench 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.ContributionGeneral GuidelinesFork the repository and create a new branch for your changes.Adhere to coding conventions and formatting guidelines.Use clear commit messages to document the purpose of your changes.Adding New ClientsStep 1: Creating New Client FilesNavigate to the vectordb_bench/backend/clients directory.Create a new folder for your client, for example, "new_client".Inside the "new_client" folder, create two files: new_client.py and config.py.Step 2: Implement new_client.py and config.pyOpen 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.
Example implementation in new_client.py:
new_client.pyfrom..apiimportVectorDBclassNewClient(VectorDB):# Implement the abstract methods defined in the VectorDB class# ...Open config.py and implement the DBConfig and optional DBCaseConfig classes.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.The DBCaseConfig class is optional and allows for providing case-specific configurations for the database. If not provided, it defaults to EmptyDBCaseConfig.
Example implementation in config.py:frompydanticimportSecretStrfromclients.apiimportDBConfig,DBCaseConfigclassNewDBConfig(DBConfig):# Implement the required configuration fields for the database connection# ...token:SecretStruri:strclassNewDBCaseConfig(DBCaseConfig):# Implement optional case-specific configuration fields# ...Step 3: Importing the DB Client and Updating InitializationIn this final step, you will import your DB client into clients/init.py and update the initialization process.Open clients/init.py and import your NewClient from new_client.py.Add your NewClient to the DB enum.Update the db2client dictionary by adding an entry for your NewClient.
Example implementation in clients/init.py:#clients/__init__.py# Add NewClient to the DB enumclassDB(Enum):...DB.NewClient="NewClient"@propertydefinit_cls(self)->Type[VectorDB]:...ifself==DB.NewClient:from.new_client.new_clientimportNewClientreturnNewClient...@propertydefconfig_cls(self)->Type[DBConfig]:...ifself==DB.NewClient:from.new_client.configimportNewClientConfigreturnNewClientConfig...defcase_config_cls(self,...)ifself==DB.NewClient:from.new_client.configimportNewClientCaseConfigreturnNewClientCaseConfigThat's it! You have successfully added a new DB client to the vectordb_bench project.RulesInstallationThe 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.Fine-TuningFor the system under test, we use the default server-side configuration to maintain the authenticity and representativeness of our results.
For the Client, we welcome any parameter tuning to obtain better results.Incomplete ResultsMany 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.Mistake Or MisrepresentationWe strive for accuracy in learning and supporting various vector databases, yet there might be oversights or misapplications. For any such occurrences, feel free toraise an issueor make amendments on our GitHub page.TimeoutIn our pursuit to ensure that our benchmark reflects the reality of a production environment while guaranteeing the practicality of the system, we have implemented a timeout plan based on our experiences for various tests.1. Capacity Case:For Capacity Case, we have assigned an overall timeout.2. Other Cases:For other cases, we have set two timeouts:Data Loading Timeout:This timeout is designed to filter out systems that are too slow in inserting data, thus ensuring that we are only considering systems that is able to cope with the demands of a real-world production environment within a reasonable time frame.Optimization Preparation Timeout: This timeout is established to avoid excessive optimization strategies that might work for benchmarks but fail to deliver in real production environments. By doing this, we ensure that the systems we consider are not only suitable for testing environments but also applicable and efficient in production scenarios.This multi-tiered timeout approach allows our benchmark to be more representative of actual production environments and assists us in identifying systems that can truly perform in real-world scenarios.CaseData SizeTimeout TypeValueCapacity CaseN/ALoading timeout24 hoursOther Cases1M vectors, 768 dimensions500K vectors, 1536 dimensionsLoading timeout2.5 hoursOptimization timeout15 minsOther Cases10M vectors, 768 dimensions5M vectors, 1536 dimensionsLoading timeout25 hoursOptimization timeout2.5 hoursOther Cases100M vectors, 768 dimensionsLoading timeout250 hoursOptimization timeout25 hoursNote:Some datapoints in the standard benchmark results that voilate this timeout will be kept for now for reference. We will remove them in the future.