-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(ml): added locustfile #2926
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
export NUM_ENDPOINTS=3 | ||
export PYTHONPATH=app | ||
|
||
gunicorn app.main:app --worker-class uvicorn.workers.UvicornWorker \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While the app normally just uses uvicorn
, gunicorn
has a --daemon flag so it can run in the background.
locust --host http://$HOST --web-host 127.0.0.1 \ | ||
--run-time 120s --users $(($CONCURRENCY * $NUM_ENDPOINTS)) $(if $HEADLESS; then echo "--headless"; fi) | ||
|
||
if [[ -e $PID_FILE ]]; then kill $(cat $PID_FILE); fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file contains the process ID for gunicorn
. Terminating it like this respects other gunicorn
processes that might be running in the background, whereas something like pkill gunicorn
is indiscriminate.
If you are running the development stack in Docker, can we still use the method in the description? |
|
Scratch that, there's no need. If you run the dev stack then you can just run |
Description
This PR adds support for Locust, a performance measurement tool. The benefit of this is being able to easily quantify and visualize ML performance. In turn, this makes it easier to understand the performance implications of a change, identify bottlenecks, and find the most appropriate defaults. Besides
locustfile.py
itself, it also adds a small Bash script to deploy the app locally, start Locust, and terminate the app once done.Testing
This PR has been tested to work with the provided poetry.lock dependencies
cd machine_learning
localhost:8089
to see the web UIStart swarming