Skip to content

Commit

Permalink
perf(scripts): improve load balancing
Browse files Browse the repository at this point in the history
  • Loading branch information
mabw-rte committed Oct 2, 2024
1 parent 31acc52 commit a969ef7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,8 @@ resources/commit_id
watcher
*.lock

**/bucket
**/bucket

# local scripts
dummy_kill.sh
dummy_launch.sh
11 changes: 10 additions & 1 deletion scripts/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,18 @@ set -e
CUR_DIR=$(cd "$(dirname "$0")" && pwd)
BASE_DIR=$(dirname "$CUR_DIR")

min() {
echo $(( $1 < $2 ? $1 : $2 ))
}

workers=$(min 30 ${NB_WORKERS_ANTARES:-17}) # default to 17 and max is 30

if [ -z "$1" ] ; then
sh $CUR_DIR/pre-start.sh
gunicorn --config $BASE_DIR/conf/gunicorn.py --worker-class=uvicorn.workers.UvicornWorker antarest.wsgi:app
for ((i=0; i<workers; i++))
do
uvicorn antarest.wsgi:app --host 0.0.0.0 --port $((5000 + $i)) --log-level info --timeout-keep-alive 600 &
done
else
export PYTHONPATH=$BASE_DIR
python3 $BASE_DIR/antarest/main.py -c $ANTAREST_CONF --module "$1"
Expand Down

0 comments on commit a969ef7

Please sign in to comment.