From f9b5186afc2ff3a633344f4a568ac17da7545972 Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Wed, 24 Apr 2024 16:04:36 -0400 Subject: [PATCH] Trial and error fixes... --- .env.default | 2 +- .../site-enabled_aether_fastapi_gunicorn.conf | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.env.default b/.env.default index 62ee492..76c20d3 100644 --- a/.env.default +++ b/.env.default @@ -71,7 +71,7 @@ AE_DB_PASSWORD="the password with $$ escape" # wait_timeout (MariaDB) is how long to keep an idle DB connection AE_DB_WAIT_TIMEOUT=1800 # Not yet used! # connection_timeout (MariaDB) is how long to try and create a new DB connection; bad handshake -AE_DB_CONNECTION_TIMEOUT=15 +AE_DB_CONNECTION_TIMEOUT=15 # (in seconds; default=15) # pool_recycle (SQLAlchemy) is how long to keep using a particular connection that has passed a certain age AE_DB_POOL_RECYCLE=1800 diff --git a/conf/nginx/site-enabled_aether_fastapi_gunicorn.conf b/conf/nginx/site-enabled_aether_fastapi_gunicorn.conf index 3b716d8..e6b0446 100644 --- a/conf/nginx/site-enabled_aether_fastapi_gunicorn.conf +++ b/conf/nginx/site-enabled_aether_fastapi_gunicorn.conf @@ -150,6 +150,8 @@ server { upstream fastapi_backend { # Balancing: Comment out both ip_hash and least_conn to use the default of round robin + # hash $binary_remote_addr consistent; + # IP hash for sticky sessions/connections load balancing method # ip_hash; @@ -163,13 +165,13 @@ upstream fastapi_backend { # larger number will recieve more requests # Example of 20 vs 10: 20 will recieve twice as many requests as 10 - server aether_api_gunicorn:5005 weight=20 max_fails=2 fail_timeout=30s; - server aether_api_gunicorn_red:5005 weight=20 max_fails=2 fail_timeout=30s; - server aether_api_gunicorn_green:5005 weight=20 max_fails=2 fail_timeout=30s; - server aether_api_gunicorn_blue:5005 weight=20 max_fails=2 fail_timeout=30s; - server aether_api_gunicorn_black:5005 weight=20 max_fails=2 fail_timeout=30s; + server aether_api_gunicorn:5005 weight=20 max_fails=1 fail_timeout=7s; + server aether_api_gunicorn_red:5005 weight=20 max_fails=1 fail_timeout=7s; + server aether_api_gunicorn_green:5005 weight=20 max_fails=1 fail_timeout=7s; + server aether_api_gunicorn_blue:5005 weight=20 max_fails=1 fail_timeout=7s; + server aether_api_gunicorn_black:5005 weight=20 max_fails=1 fail_timeout=7s; # server aether_api_gunicorn_white:5005 weight=20 max_fails=2 fail_timeout=30s; # maintain up to 20 idle connections to the group of upstream servers - # keepalive 20; + keepalive 16; }