From 213838c9e4d275218844c1e63c86ef9f75534694 Mon Sep 17 00:00:00 2001 From: dylan Date: Tue, 13 Aug 2024 11:58:24 -0700 Subject: [PATCH] chore: set AVS_IS_LOADBALANCER config to true by default --- basic-search/search.py | 4 +++- prism-image-search/README.md | 7 ++++++- prism-image-search/prism/config.py | 4 +++- quote-semantic-search/README.md | 7 ++++++- quote-semantic-search/quote-search/config.py | 4 +++- 5 files changed, 21 insertions(+), 5 deletions(-) diff --git a/basic-search/search.py b/basic-search/search.py index 9b1b361..3dc1cc1 100644 --- a/basic-search/search.py +++ b/basic-search/search.py @@ -40,7 +40,9 @@ dest="load_balancer", action="store_true", required=False, - default=False, + # using a load balancer with AVS is best practice so this is the default + # you should set this to False if you are not using a load balancer with an AVS cluster of more than 1 node + default=True, help="Use this if the host is a load balancer.", ) args = arg_parser.parse_args() diff --git a/prism-image-search/README.md b/prism-image-search/README.md index 05570b9..57f300b 100644 --- a/prism-image-search/README.md +++ b/prism-image-search/README.md @@ -102,6 +102,11 @@ python3 -m pip install -r requirements.txt The application can be configured by setting the following environment variable. If not set defaults are used. +[!NOTE] +Using a load balancer with AVS is best practice. Therefore AVS_IS_LOADBAlANCER defaults to True. +This works fine for AVS clusters with a load balancer or clusters with only 1 node. If you are using +the examples with an AVS cluster larger than 1 node without load balancing you should set AVS_IS_LOADBAlANCER to False. + | Environment Variable | Default | Description | |------------------------|--------------------|-----------------------------------------------------------------| | APP_USERNAME | | If set, the username for basic authentication | @@ -116,7 +121,7 @@ If not set defaults are used. | AVS_INDEX_SET | image-index | The Aerospike set for storing the HNSW index | | AVS_INDEX_NAME | prism-image-search | The name of the index | | AVS_MAX_RESULTS | 20 | Maximum number of vector search results to return | -| AVS_IS_LOADBALANCER | False | If true, the first seed address will be treated as a load balancer node.``` +| AVS_IS_LOADBALANCER | True | If true, the first seed address will be treated as a load balancer node.``` ### Setup networking (optional) diff --git a/prism-image-search/prism/config.py b/prism-image-search/prism/config.py index 8bb3407..1a7d33f 100644 --- a/prism-image-search/prism/config.py +++ b/prism-image-search/prism/config.py @@ -30,4 +30,6 @@ class Config(object): AVS_VERIFY_TLS = get_bool_env("VERIFY_TLS", True) AVS_MAX_RESULTS = int(os.environ.get("AVS_MAX_RESULTS") or 20) MAX_CONTENT_LENGTH = int(os.environ.get("MAX_CONTENT_LENGTH") or 10485760) - AVS_IS_LOADBALANCER = get_bool_env("AVS_IS_LOADBALANCER", False) + # using a load balancer with AVS is best practice so this is the default + # you should set this to False if you are not using a load balancer with an AVS cluster of more than 1 node + AVS_IS_LOADBALANCER = get_bool_env("AVS_IS_LOADBALANCER", True) diff --git a/quote-semantic-search/README.md b/quote-semantic-search/README.md index f9cb5f2..2149bf3 100644 --- a/quote-semantic-search/README.md +++ b/quote-semantic-search/README.md @@ -92,6 +92,11 @@ python3 -m pip install -r requirements.txt The application can be configured by setting the following environment variable. If not set defaults are used. +[!NOTE] +Using a load balancer with AVS is best practice. Therefore AVS_IS_LOADBAlANCER defaults to True. +This works fine for AVS clusters with a load balancer or clusters with only 1 node. If you are using +the examples with an AVS cluster larger than 1 node without load balancing you should set AVS_IS_LOADBAlANCER to False. + | Environment Variable | Default | Description | |-----------------------------|--------------------|-----------------------------------------------------------------| | APP_USERNAME | | If set, the username for basic authentication | @@ -107,7 +112,7 @@ If not set defaults are used. | AVS_INDEX_SET | quote-index | The Aerospike set for storing the HNSW index | | AVS_INDEX_NAME | quote-search | The name of the index | | AVS_MAX_RESULTS | 20 | Maximum number of vector search results to return | -| AVS_IS_LOADBALANCER | False | If true, the first seed address will be treated as a load balancer node.``` +| AVS_IS_LOADBALANCER | True | If true, the first seed address will be treated as a load balancer node.``` ### Setup networking (optional) diff --git a/quote-semantic-search/quote-search/config.py b/quote-semantic-search/quote-search/config.py index a50fb25..c075ac9 100644 --- a/quote-semantic-search/quote-search/config.py +++ b/quote-semantic-search/quote-search/config.py @@ -29,7 +29,9 @@ class Config(object): AVS_MAX_RESULTS = int(os.environ.get("AVS_MAX_RESULTS") or 5) INDEXER_PARALLELISM = int(os.environ.get("APP_INDEXER_PARALLELISM") or 1) MAX_CONTENT_LENGTH = int(os.environ.get("MAX_CONTENT_LENGTH") or 10485760) - AVS_IS_LOADBALANCER = get_bool_env("AVS_IS_LOADBALANCER", False) + # using a load balancer with AVS is best practice so this is the default + # you should set this to False if you are not using a load balancer with an AVS cluster of more than 1 node + AVS_IS_LOADBALANCER = get_bool_env("AVS_IS_LOADBALANCER", True) DATASET_FILE_PATH = ( os.environ.get("DATASET_FILE_PATH") or "../container-volumes/quote-search/data/quotes.csv"