-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new metric support: ndcg@100, performance under conc_test
Signed-off-by: min.tian <[email protected]>
- Loading branch information
1 parent
5265f2f
commit 09306a0
Showing
9 changed files
with
282 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
|
||
|
||
from vectordb_bench.backend.cases import Case | ||
from vectordb_bench.frontend.components.check_results.expanderStyle import initMainExpanderStyle | ||
import plotly.express as px | ||
|
||
from vectordb_bench.frontend.const.styles import COLOR_MAP | ||
|
||
|
||
def drawChartsByCase(allData, cases: list[Case], st): | ||
initMainExpanderStyle(st) | ||
for case in cases: | ||
chartContainer = st.expander(case.name, True) | ||
caseDataList = [ | ||
data for data in allData if data["case_name"] == case.name] | ||
data = [{ | ||
"conc_num": caseData["conc_num_list"][i], | ||
"qps": caseData["conc_qps_list"][i], | ||
"latency_p99": caseData["conc_latency_p99_list"][i] * 1000, | ||
"db_name": caseData["db_name"], | ||
"db": caseData["db"] | ||
|
||
} for caseData in caseDataList for i in range(len(caseData["conc_num_list"]))] | ||
drawChart(data, chartContainer) | ||
|
||
|
||
def getRange(metric, data, padding_multipliers): | ||
minV = min([d.get(metric, 0) for d in data]) | ||
maxV = max([d.get(metric, 0) for d in data]) | ||
padding = maxV - minV | ||
rangeV = [ | ||
minV - padding * padding_multipliers[0], | ||
maxV + padding * padding_multipliers[1], | ||
] | ||
return rangeV | ||
|
||
|
||
def drawChart(data, st): | ||
if len(data) == 0: | ||
return | ||
|
||
x = "latency_p99" | ||
xrange = getRange(x, data, [0.05, 0.1]) | ||
|
||
y = "qps" | ||
yrange = getRange(y, data, [0.2, 0.1]) | ||
|
||
color = "db" | ||
color_discrete_map = COLOR_MAP | ||
color = "db_name" | ||
color_discrete_map = None | ||
line_group = "db_name" | ||
text = "conc_num" | ||
|
||
data.sort(key=lambda a: a["conc_num"]) | ||
|
||
fig = px.line( | ||
data, | ||
x=x, | ||
y=y, | ||
color=color, | ||
color_discrete_map=color_discrete_map, | ||
line_group=line_group, | ||
text=text, | ||
markers=True, | ||
# color_discrete_map=color_discrete_map, | ||
hover_data={ | ||
"conc_num": True, | ||
}, | ||
height=720, | ||
) | ||
fig.update_xaxes(range=xrange, title_text="Latency P99 (ms)") | ||
fig.update_yaxes(range=yrange, title_text="QPS") | ||
fig.update_traces(textposition="bottom right", | ||
texttemplate="conc-%{text:,.4~r}") | ||
# fig.update_layout( | ||
# margin=dict(l=0, r=0, t=40, b=0, pad=8), | ||
# legend=dict( | ||
# orientation="h", yanchor="bottom", y=1, xanchor="right", x=1, title="" | ||
# ), | ||
# ) | ||
st.plotly_chart(fig, use_container_width=True,) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
from dataclasses import asdict | ||
from vectordb_bench.backend.cases import CaseType | ||
from vectordb_bench.interface import benchMarkRunner | ||
from vectordb_bench.models import CaseResult, ResultLabel | ||
import pandas as pd | ||
|
||
|
||
def getNewResults(): | ||
allResults = benchMarkRunner.get_results() | ||
newResults: list[CaseResult] = [] | ||
|
||
for res in allResults: | ||
results = res.results | ||
for result in results: | ||
if result.label == ResultLabel.NORMAL: | ||
newResults.append(result) | ||
|
||
|
||
df = pd.DataFrame(formatData(newResults)) | ||
return df | ||
|
||
|
||
def formatData(caseResults: list[CaseResult]): | ||
data = [] | ||
for caseResult in caseResults: | ||
db = caseResult.task_config.db.value | ||
db_label = caseResult.task_config.db_config.db_label | ||
case_config = caseResult.task_config.case_config | ||
db_case_config = caseResult.task_config.db_case_config | ||
case = case_config.case_id.case_cls() | ||
filter_rate = case.filter_rate | ||
dataset = case.dataset.data.name | ||
metrics = asdict(caseResult.metrics) | ||
data.append( | ||
{ | ||
"db": db, | ||
"db_label": db_label, | ||
"case_name": case.name, | ||
"dataset": dataset, | ||
"filter_rate": filter_rate, | ||
**metrics, | ||
} | ||
) | ||
return data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
|
||
|
||
|
||
import streamlit as st | ||
from vectordb_bench.backend.cases import CaseType | ||
from vectordb_bench.frontend.components.check_results.footer import footer | ||
from vectordb_bench.frontend.components.check_results.expanderStyle import initMainExpanderStyle | ||
from vectordb_bench.frontend.components.check_results.priceTable import priceTable | ||
from vectordb_bench.frontend.components.check_results.headerIcon import drawHeaderIcon | ||
from vectordb_bench.frontend.components.check_results.nav import NavToResults, NavToRunTest | ||
from vectordb_bench.frontend.components.check_results.charts import drawMetricChart | ||
from vectordb_bench.frontend.components.check_results.filters import getshownData | ||
from vectordb_bench.frontend.components.concurrent.charts import drawChartsByCase | ||
from vectordb_bench.frontend.components.get_results.saveAsImage import getResults | ||
from vectordb_bench.frontend.const.styles import * | ||
from vectordb_bench.interface import benchMarkRunner | ||
from vectordb_bench.models import TestResult | ||
|
||
|
||
def main(): | ||
# set page config | ||
st.set_page_config( | ||
page_title="VDBBench Conc Perf", | ||
page_icon=FAVICON, | ||
layout="wide", | ||
# initial_sidebar_state="collapsed", | ||
) | ||
|
||
# header | ||
drawHeaderIcon(st) | ||
|
||
allResults = benchMarkRunner.get_results() | ||
|
||
def check_conc_data(res: TestResult): | ||
case_results = res.results | ||
count = 0 | ||
for case_result in case_results: | ||
if len(case_result.metrics.conc_num_list) > 0: | ||
count += 1 | ||
|
||
return count > 0 | ||
|
||
checkedResults = [res for res in allResults if check_conc_data(res)] | ||
|
||
|
||
st.title("VectorDB Benchmark (Concurrent Performance)") | ||
|
||
# results selector | ||
resultSelectorContainer = st.sidebar.container() | ||
shownData, _, showCases = getshownData( | ||
checkedResults, resultSelectorContainer) | ||
|
||
|
||
resultSelectorContainer.divider() | ||
|
||
# nav | ||
navContainer = st.sidebar.container() | ||
NavToRunTest(navContainer) | ||
NavToResults(navContainer) | ||
|
||
# save or share | ||
resultesContainer = st.sidebar.container() | ||
getResults(resultesContainer, "vectordb_bench_concurrent") | ||
|
||
drawChartsByCase(shownData, showCases, st.container()) | ||
|
||
# footer | ||
footer(st.container()) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import streamlit as st | ||
from vectordb_bench.frontend.components.check_results.headerIcon import drawHeaderIcon | ||
from vectordb_bench.frontend.components.tables.data import getNewResults | ||
from vectordb_bench.frontend.const.styles import FAVICON | ||
|
||
|
||
def main(): | ||
# set page config | ||
st.set_page_config( | ||
page_title="Table", | ||
page_icon=FAVICON, | ||
layout="wide", | ||
# initial_sidebar_state="collapsed", | ||
) | ||
|
||
# header | ||
drawHeaderIcon(st) | ||
|
||
df = getNewResults() | ||
st.dataframe(df, height=800) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
Oops, something went wrong.