Skip to content

Commit

Permalink
Merge #135844
Browse files Browse the repository at this point in the history
135844: vecbench: add vector benchmarking CLI r=drewkimball a=andy-kimball

Add a CLI that makes it easy to benchmark the quality and performance of vector indexing. The CLI downloads test datasets from a GCP bucket and then builds and searches the index. It outputs results in a spreadsheet-friendly format like this:
```
  unsplash-512-euclidean
  1000000 train vectors, 1000 test vectors, 512 dimensions, 16/128 min/max partitions, base beam size 8

  beam	recall	leaf	all	full	partns	qps
  1	22.10%	91	247	23.61	4.00	1357.12
  2	31.35%	182	339	27.65	5.00	1867.50
  4	47.86%	362	610	31.96	8.00	1783.30
  8	67.96%	727	1220	35.70	15.00	1729.00
  16	82.00%	1450	2302	40.41	27.00	1629.65
  32	90.70%	2894	4462	44.17	51.00	1301.63
  64	95.61%	5783	8772	47.30	99.00	791.74
  128	98.32%	11559	17374	49.60	195.00	535.10
  256	99.47%	23099	34391	50.83	387.00	298.24
  512	99.83%	46150	57517	51.28	644.00	189.69
```

Epic: CRDB-42943

Release note: None

Co-authored-by: Andrew Kimball <andyk@cockroachlabs.com>
  • Loading branch information
craig[bot] and andy-kimball committed Nov 22, 2024
2 parents 56c7675 + 24802ff commit 5c5c9d6
Show file tree
Hide file tree
Showing 7 changed files with 567 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ artifacts
/bin.*
/lib
/lib.*
/tmp
.buildinfo
# cockroach-data, cockroach{,.race}-{darwin,linux,windows}-*
/cockroach*
Expand All @@ -33,6 +32,8 @@ work-Fuzz*
# Instrumentation artifacts.
/instrument*
.instrumentor_exclusions.tmp
# Temp files.
tmp/

# Custom or private env vars (e.g. internal keys, access tokens, etc).
customenv.mk
Expand Down
2 changes: 2 additions & 0 deletions pkg/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -1265,6 +1265,8 @@ GO_TARGETS = [
"//pkg/cmd/urlcheck/lib/urlcheck:urlcheck",
"//pkg/cmd/urlcheck:urlcheck",
"//pkg/cmd/urlcheck:urlcheck_lib",
"//pkg/cmd/vecbench:vecbench",
"//pkg/cmd/vecbench:vecbench_lib",
"//pkg/cmd/whoownsit:whoownsit",
"//pkg/cmd/whoownsit:whoownsit_lib",
"//pkg/cmd/workload:workload",
Expand Down
25 changes: 25 additions & 0 deletions pkg/cmd/vecbench/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")

go_library(
name = "vecbench_lib",
srcs = ["main.go"],
importpath = "github.com/cockroachdb/cockroach/pkg/cmd/vecbench",
visibility = ["//visibility:private"],
deps = [
"//pkg/sql/vecindex",
"//pkg/sql/vecindex/quantize",
"//pkg/sql/vecindex/vecstore",
"//pkg/util/stop",
"//pkg/util/timeutil",
"//pkg/util/vector",
"@com_github_cockroachdb_errors//:errors",
"@com_github_cockroachdb_errors//oserror",
"@com_google_cloud_go_storage//:storage",
],
)

go_binary(
name = "vecbench",
embed = [":vecbench_lib"],
visibility = ["//visibility:public"],
)
Loading

0 comments on commit 5c5c9d6

Please sign in to comment.