Skip to content

Commit 21e87cd

Browse files
Caroline-an777alwayslove2013
authored andcommitted
set navigator
1 parent 3db3f5d commit 21e87cd

14 files changed

Lines changed: 458 additions & 58 deletions

File tree

vectordb_bench/frontend/components/check_results/headerIcon.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,22 @@
44
def drawHeaderIcon(st):
55
st.markdown(
66
f"""
7-
<div class="headerIconContainer"></div>
7+
<a href="/vdb_benchmark" target="_self">
8+
<div class="headerIconContainer"></div>
9+
</a>
810
9-
<style>
10-
.headerIconContainer {{
11-
position: relative;
12-
top: 0px;
13-
height: 50px;
14-
width: 100%;
15-
border-bottom: 2px solid #E8EAEE;
16-
background-image: url({HEADER_ICON});
17-
background-repeat: no-repeat;
18-
}}
19-
</style
20-
""",
11+
<style>
12+
.headerIconContainer {{
13+
position: relative;
14+
top: 0px;
15+
height: 50px;
16+
width: 100%;
17+
border-bottom: 2px solid #E8EAEE;
18+
background-image: url({HEADER_ICON});
19+
background-repeat: no-repeat;
20+
cursor: pointer;
21+
}}
22+
</style>
23+
""",
2124
unsafe_allow_html=True,
2225
)

vectordb_bench/frontend/components/check_results/nav.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,23 @@ def NavToResults(st, key="nav-to-results"):
2020
navClick = st.button("< &nbsp;&nbsp;Back to Results", key=key)
2121
if navClick:
2222
switch_page("vdb benchmark")
23+
24+
25+
def NavToPages(st):
26+
options = [
27+
{"name": "Run Test", "link": "run_test"},
28+
{"name": "Results", "link": "results"},
29+
{"name": "Concurrent", "link": "concurrent"},
30+
{"name": "Label Filter", "link": "label_filter"},
31+
{"name": "Quries Per Dollar", "link": "quries_per_dollar"},
32+
{"name": "Tables", "link": "tables"},
33+
{"name": "Custom", "link": "custom"},
34+
{"name": "Streaming", "link": "streaming"},
35+
]
36+
37+
html = ""
38+
for i, option in enumerate(options):
39+
html += f'<a href="/{option["link"]}" target="_self" style="text-decoration: none; padding: 0.1px 0.2px;">{option["name"]}</a>'
40+
if i < len(options) - 1:
41+
html += '<span style="color: #888; margin: 0 5px;">|</span>'
42+
st.markdown(html, unsafe_allow_html=True)
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
def explainPrams(st):
2+
st.markdown("## descriptions")
3+
st.markdown("### 1.Overview")
4+
st.markdown(
5+
"""
6+
- **VectorDBBench** is an open-source benchmarking tool designed specifically for vector databases. Its main features include:
7+
- (1) An easy-to-use **web UI** for configuration of tests and visual analysis of results.
8+
- (2) A comprehensive set of **standards for testing and metric collection**.
9+
- (3) Support for **various scenarios**, including additional support for **Filter** and **Streaming** based on standard tests.
10+
- VectorDBBench embraces open-source and welcome contributions of code and test result submissions. The testing process and extended scenarios of VectorDBBench, as well as the intention behind our design will be introduced as follows.
11+
"""
12+
)
13+
st.markdown("### 2.Dataset")
14+
st.markdown(
15+
"""
16+
- We provide two embedding datasets:
17+
- (1)*[Cohere 768dim](https://huggingface.co/datasets/Cohere/wikipedia-22-12)*, generated using the **Cohere** model based on the Wikipedia corpus.
18+
- (2)*[Cohere 1024dim](https://huggingface.co/datasets/Cohere/beir-embed-english-v3)*, generated using the **Cohere** embed-english-v3.0 model based on the bioasq corpus.
19+
- (3)*OpenAI 1536dim*, generated using the **OpenAI** model based on the [C4 corpus](https://huggingface.co/datasets/legacy-datasets/c4).
20+
"""
21+
)
22+
st.markdown("### 3.Standard Test")
23+
st.markdown(
24+
"""
25+
The test is actually divided into 3 sub-processes
26+
- **3.1 Test Part 1 - Load (Insert + Optimize)**
27+
- (1) Use a single process to perform serial inserts until all data is inserted, and record the time taken as **insert_duration**.
28+
- (2) For most vector databases, index construction requires additional time to optimize to achieve an optimal state, and record the time taken as **optimize_duration**.
29+
- (3) **Load_duration (insert_duration + optimize_duration)** can be understood as the time from the start of insertion until the database is ready to query.
30+
- load_duration can serve as a reference for the insert capability of a vector database to some extent. However, it should be noted that some vector databases may perform better under **concurrent insert operations**.
31+
- **3.2 Test Part 2 - Serial Search Test**
32+
- (1) Use a single process to perform serial searches, record the results and time taken for each search, and calculate **recall** and **latency**.
33+
- (2) **Recall**: For vector databases, most searches are approximately nearest neighbor(ANN) searches rather than perfectly accurate results. In production environments, commonly targeted recall rates are 0.9 or 0.95.
34+
- Note that there is a **trade-off** between **accuracy** and **search performance**. By adjusting parameters, it is possible to sacrifice some accuracy in exchange for better performance. We recommend comparing performance while ensuring that the recall rates remain reasonably close.
35+
- (3) **Latency**:**p99** rather than average. **latency_p99** focuses on **the slowest 1% of requests**. In many high-demand applications, ensuring that most user requests stay within acceptable latency limits is critical, whereas **latency_avg** can be skewed by faster requests.
36+
- **serial_latency** can serve as a reference for a database's search capability to some extent. However, serial_latency is significantly affected by network conditions. We recommend running the test client and database server within the same local network.
37+
- **3.3 Test Part 3 - Concurrent Search Test**
38+
- (1) Create multiple processes, each perform serial searches independently to test the database's **maximum throughput(max-qps)**.
39+
- (2) Since different databases may reach peak throughput under different conditions, we conduct multiple test rounds. The number of processes **starts at 1 by default and gradually increases up to 80**, with each test group running for **30 seconds**.
40+
- Detailed latency and QPS metrics at different concurrency levels can be viewed on the <a href="concurrent" target="_self" style="text-decoration: none;">*concurrent*</a> page.
41+
- The highest recorded QPS value from these tests will be selected as the final max-qps.
42+
""",
43+
unsafe_allow_html=True,
44+
)
45+
st.markdown("### 4.Filter Search Test")
46+
st.markdown(
47+
"""
48+
- Compared to the Standard Test, the **Filter Search** introduces additional scalar constraints (e.g. **color == red**) during the Search Test. Different **filter_ratios** present varying levels of challenge to the VectorDB's search performance.
49+
- We provide an additional **string column** containing 10 labels with different distribution ratios (50%,20%,10%,5%,2%,1%,0.5%,0.2%,0.1%). For each label, we conduct both a **Serial Test** and a **Concurrency Test** to observe the VectorDB's performance in terms of **QPS, latency, and recall** under different filtering conditions.
50+
"""
51+
)
52+
st.markdown("### 5.Streaming Search Test")
53+
st.markdown(
54+
"""
55+
Different from Standard's load and search separation, Streaming Search Test primarily focuses on **search performance during the insertion process**.
56+
Different **base dataset sizes** and varying **insertion rates** set distinct challenges to the VectorDB's search capabilities.
57+
VectorDBBench will send insert requests at a **fixed rate**, maintaining consistent insertion pressure. The search test consists of three steps as follows:
58+
- 1.**Streaming Search**
59+
- Users can configure **multiple search stages**. When the inserted data volume reaches a specified stage, a **Serial Test** and a **Concurrent Test** will be conducted, recording qps, latency, and recall performance.
60+
- 2.**Streaming Final Search**
61+
- After all of the data is inserted, a Serial Test and a Concurrent Test are immediately performed, recording qps, latency, and recall performance.
62+
- Note: at this time, the insertion pressure drops to zero since data insertion is complete.
63+
- 3.**Optimized Search (Optional)**
64+
- Users can optionally perform an additional optimization step followed by a Serial Test and a Concurrent Test, recording qps, latency, and recall performance. This step **compares performance in Streaming section with the theoretically optimal performance**.
65+
"""
66+
)
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
def pagestyle():
2+
html_content = """
3+
<style>
4+
.grid-container {
5+
display: grid;
6+
grid-template-columns: repeat(3, 1fr);
7+
grid-template-rows: repeat(3, auto);
8+
gap: 20px;
9+
padding: 20px 0;
10+
}
11+
12+
.title-row {
13+
grid-column: 1 / 4;
14+
text-align: left;
15+
margin: 20px 0;
16+
}
17+
18+
.title-row h2 {
19+
font-size: 35px;
20+
color: #333;
21+
font-weight: 600;
22+
}
23+
24+
.last-row {
25+
grid-column: 1 / 7;
26+
display: grid;
27+
grid-template-columns: repeat(6, 1fr);
28+
gap: 40px;
29+
}
30+
31+
.last-row > :nth-child(1) {
32+
grid-column: 2 / 4;
33+
}
34+
35+
.last-row > :nth-child(2) {
36+
grid-column: 4 / 6;
37+
gap: 40px;
38+
}
39+
.section-card {
40+
width: 100%;
41+
height: 350px;
42+
padding: 15px;
43+
border-radius: 10px;
44+
background-color: #f0f2f6;
45+
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
46+
transition: transform 0.3s ease, box-shadow 0.3s ease;
47+
text-align: center;
48+
overflow: hidden;
49+
cursor: pointer;
50+
display: flex;
51+
flex-direction: column;
52+
}
53+
.section-card:hover {
54+
transform: scale(1.05);
55+
box-shadow: 0 10px 20px rgba(0,0,0,0.2);
56+
z-index: 100;
57+
}
58+
.section-image {
59+
width: 100%;
60+
height: 185px;
61+
object-fit: cover;
62+
border-radius: 5px;
63+
margin-bottom: 10px;
64+
}
65+
.section-title {
66+
font-size: 18px;
67+
font-weight: bold;
68+
margin-bottom: 10px;
69+
color: #262730;
70+
}
71+
.section-description {
72+
font-size: 14px;
73+
color: #555;
74+
height: 80px;
75+
overflow-y: auto;
76+
margin-bottom: 10px;
77+
}
78+
.scroll-container {
79+
width: 100%;
80+
overflow-x: auto;
81+
white-space: nowrap;
82+
margin-top: auto;
83+
padding: 10px 0;
84+
border-top: 1px solid #eee;
85+
}
86+
.scroll-content {
87+
display: inline-block;
88+
white-space: nowrap;
89+
padding: 0 10px;
90+
}
91+
.scroll-item {
92+
display: inline-block;
93+
width: 50px;
94+
height: 30px;
95+
margin-right: 10px;
96+
background-color: #ddd;
97+
border-radius: 5px;
98+
text-align: center;
99+
line-height: 30px;
100+
}
101+
</style>
102+
103+
<div class="grid-container">
104+
"""
105+
return html_content
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
import base64
2+
from PIL import Image
3+
from io import BytesIO
4+
import os
5+
6+
from vectordb_bench.frontend.components.welcome.pagestyle import pagestyle
7+
8+
9+
def get_image_as_base64(image_path):
10+
try:
11+
if image_path.startswith("http"):
12+
return image_path
13+
14+
path = os.path.expanduser(image_path)
15+
img = Image.open(path)
16+
buffered = BytesIO()
17+
img.save(buffered, format="PNG")
18+
return f"data:image/png;base64,{base64.b64encode(buffered.getvalue()).decode()}"
19+
except Exception as e:
20+
raise (f"wrong loading: {e}")
21+
22+
23+
def welcomePrams(st):
24+
st.title("Welcome to VectorDB Benchmark!")
25+
options = [
26+
{
27+
"title": "Results",
28+
"description": (
29+
"<span style='font-size: 17px;'>"
30+
"Select a specific run or compare all results side by side to view the results of previous tests."
31+
"</span>"
32+
),
33+
"image": "/Users/zilliz/static/results.png",
34+
"link": "results",
35+
},
36+
{
37+
"title": "Quries Per Dollar",
38+
"description": (
39+
"<span style='font-size: 17px;'>"
40+
"To view the results of quries per dollar.<br> "
41+
"(similar to qps in Results) "
42+
"</span>"
43+
),
44+
"image": "/Users/zilliz/static/qpd.png",
45+
"link": "quries_per_dollar",
46+
},
47+
{
48+
"title": "Tables",
49+
"description": (
50+
"<span style='font-size: 17px;'>" "To view the results of differnt datasets in tables." "</span>"
51+
),
52+
"image": "/Users/zilliz/static/tables.png",
53+
"link": "tables",
54+
},
55+
{
56+
"title": "Concurrent Performance",
57+
"description": (
58+
"<span style='font-size: 17px;'>"
59+
"To view the variation of qps with latency under different concurrent."
60+
"</span>"
61+
),
62+
"image": "/Users/zilliz/static/concurrent.png",
63+
"link": "concurrent",
64+
},
65+
{
66+
"title": "Label Filter",
67+
"description": (
68+
"<span style='font-size: 17px;'>"
69+
"To view the perfomance of datasets under different filter ratios "
70+
"</span>"
71+
),
72+
"image": "/Users/zilliz/static/label_filter.png",
73+
"link": "label_filter",
74+
},
75+
{
76+
"title": "Streaming Performance",
77+
"description": (
78+
"<span style='font-size: 17px;'>"
79+
"To view the perfomance of datasets under different search stages and insertion rates. "
80+
"</span>"
81+
),
82+
"image": "/Users/zilliz/static/streaming.png",
83+
"link": "streaming",
84+
},
85+
{
86+
"title": "Run Test",
87+
"description": (
88+
"<span style='font-size: 17px;'>"
89+
"Select the databases and cases to test.<br>"
90+
"The test results will be displayed in Results."
91+
"</span>"
92+
),
93+
"image": "/Users/zilliz/static/run_test.png",
94+
"link": "run_test",
95+
},
96+
{
97+
"title": "Custom Dataset",
98+
"description": (
99+
"<span style='font-size: 17px;'>"
100+
"Define users' own datasets with detailed descriptions of setting each parameter."
101+
"</span>"
102+
),
103+
"image": "/Users/zilliz/static/custom.png",
104+
"link": "custom",
105+
},
106+
]
107+
108+
html_content = pagestyle()
109+
110+
for option in options:
111+
option["image"] = get_image_as_base64(option["image"])
112+
113+
for i, option in enumerate(options[:6]):
114+
html_content += f"""
115+
<a href="/{option['link']}" target="_self" style="text-decoration: none;">
116+
<div class="section-card">
117+
<img src="{option['image']}" class="section-image" alt="{option['title']}">
118+
<div class="section-title">{option['title']}</div>
119+
<div class="section-description">{option['description']}</div>
120+
</div>
121+
</a>
122+
"""
123+
124+
html_content += """
125+
</div>
126+
<div class="title-row">
127+
<h2>Set And Run</h2>
128+
</div>
129+
<div class="last-row">
130+
"""
131+
132+
for option in options[6:8]:
133+
html_content += f"""
134+
<a href="/{option['link']}" target="_self" style="text-decoration: none;">
135+
<div class="section-card">
136+
<img src="{option['image']}" class="section-image" alt="{option['title']}">
137+
<div class="section-title">{option['title']}</div>
138+
<div class="section-description">{option['description']}</div>
139+
</div>
140+
</a>
141+
"""
142+
143+
html_content += """
144+
</div>
145+
"""
146+
147+
st.html(html_content)

vectordb_bench/frontend/pages/concurrent.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from vectordb_bench.frontend.components.check_results.nav import (
55
NavToResults,
66
NavToRunTest,
7+
NavToPages,
78
)
89
from vectordb_bench.frontend.components.check_results.filters import getshownData
910
from vectordb_bench.frontend.components.concurrent.charts import drawChartsByCase
@@ -25,6 +26,9 @@ def main():
2526
# header
2627
drawHeaderIcon(st)
2728

29+
# navigate
30+
NavToPages(st)
31+
2832
allResults = benchmark_runner.get_results()
2933

3034
def check_conc_data(res: TestResult):

0 commit comments

Comments
 (0)