Skip to content

Commit fc951ce

Browse files
committed
Updated using Colab
1 parent 270d94c commit fc951ce

1 file changed

Lines changed: 16 additions & 21 deletions

File tree

‎alloydb/notebooks/columnar_engine_accelerated_hnsw_vector_search_benchmark.ipynb‎

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,6 @@
5252
"id": "markdown-header"
5353
}
5454
},
55-
{
56-
"cell_type": "markdown",
57-
"metadata": {
58-
"id": "ce84cca6"
59-
},
60-
"source": [
61-
"## Resources\n",
62-
"\n",
63-
"* [Get Started with AlloyDB](https://cloud.google.com/alloydb/docs/quickstart)"
64-
]
65-
},
6655
{
6756
"cell_type": "code",
6857
"source": [
@@ -71,19 +60,25 @@
7160
"# 1. CONFIGURATION\n",
7261
"# ==========================================\n",
7362
"# @markdown ### **⚙️ 1. Cluster Configuration**\n",
74-
"project_id = \"your-project-id\" # @param {type:\"string\"}\n",
75-
"region = \"your-region-id\" # @param {type:\"string\"}\n",
76-
"cluster_id = \"your-cluster-id\" # @param {type:\"string\"}\n",
77-
"instance_id = \"your-instance-id\" # @param {type:\"string\"}\n",
63+
"project_id = \"\" # @param {type:\"string\", placeholder:\"Project ID\"}\n",
64+
"region = \"\" # @param {type:\"string\", placeholder: \"Region (e.g. us-central1)\"}\n",
65+
"cluster_name = \"\" # @param {type:\"string\", placeholder: \"Cluster name\"}\n",
66+
"instance_name = \"\" # @param {type:\"string\", placeholder: \"Instance Name\"}\n",
7867
"\n",
7968
"# @markdown ### **🔐 2. Database Credentials**\n",
80-
"db_user = \"your-database-user\" # @param {type:\"string\"}\n",
81-
"db_name = \"your-database-name\" # @param {type:\"string\"}\n",
69+
"# @markdown *Note: Password will be requested securely when the benchmark is executed.*\n",
70+
"db_user = \"\" # @param {type:\"string\", placeholder: \"DB User\"}\n",
71+
"db_name = \"\" # @param {type:\"string\", placeholder: \"DB Name\"}\n",
8272
"\n",
8373
"# @markdown ### **⚙️ 3. Benchmark Settings**\n",
8474
"# @markdown *Note: Increasing these values will provide more intensive testing, but will slow down the benchmark runtime.*\n",
85-
"test_queries = 1000 # @param {type:\"integer\"}\n",
86-
"search_limit = 10 # @param {type:\"integer\"}\n",
75+
"# @markdown ### **⚙️ 3. Benchmark Settings**\n",
76+
"# @markdown *Note: Increasing these values will provide more intensive testing, but will slow down the benchmark runtime.*\n",
77+
"# @markdown * `test_queries`: The total number of test queries to run during the benchmark. Increasing this value provides a more stable average but slows down the overall runtime.\n",
78+
"# @markdown * `search_limit`: The number of nearest neighbors to retrieve per query (i.e., the `LIMIT` on the vector similarity search, equivalent to top-k).\n",
79+
"\n",
80+
"test_queries = 1000 # @param [100, 1000, 10000] {type:\"raw\"}\n",
81+
"search_limit = 10 # @param [10, 100] {type:\"raw\"}\n",
8782
"vector_dim = 100 # Fixed for GloVe-100 dataset\n",
8883
"\n",
8984
"import getpass\n",
@@ -228,7 +223,7 @@
228223
"async def monitor_index_progress(connector):\n",
229224
" try:\n",
230225
" poll_conn = await connector.connect(\n",
231-
" f\"projects/{project_id}/locations/{region}/clusters/{cluster_id}/instances/{instance_id}\",\n",
226+
" f\"projects/{project_id}/locations/{region}/clusters/{cluster_name}/instances/{instance_name}\",\n",
232227
" \"asyncpg\", user=db_user, password=db_pass, db=db_name, ip_type=\"PUBLIC\"\n",
233228
" )\n",
234229
" except Exception:\n",
@@ -400,7 +395,7 @@
400395
" console.print(\"\\n[bold blue]Step 1/9:[/bold blue] 🔌 Initializing AlloyDB AsyncConnector...\")\n",
401396
" connector = AsyncConnector()\n",
402397
" conn = await connector.connect(\n",
403-
" f\"projects/{project_id}/locations/{region}/clusters/{cluster_id}/instances/{instance_id}\",\n",
398+
" f\"projects/{project_id}/locations/{region}/clusters/{cluster_name}/instances/{instance_name}\",\n",
404399
" \"asyncpg\", user=db_user, password=db_pass, db=db_name, ip_type=\"PUBLIC\"\n",
405400
" )\n",
406401
"\n",

0 commit comments

Comments
 (0)