Skip to content

Commit

Permalink
chore: set AVS_IS_LOADBALANCER config to true by default
Browse files Browse the repository at this point in the history
  • Loading branch information
dwelch-spike committed Aug 13, 2024
1 parent aa540cc commit 213838c
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 5 deletions.
4 changes: 3 additions & 1 deletion basic-search/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
7 changes: 6 additions & 1 deletion prism-image-search/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand All @@ -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)

Expand Down
4 changes: 3 additions & 1 deletion prism-image-search/prism/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
7 changes: 6 additions & 1 deletion quote-semantic-search/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand All @@ -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)

Expand Down
4 changes: 3 additions & 1 deletion quote-semantic-search/quote-search/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 213838c

Please sign in to comment.