Skip to content

Starter for FastAPI introduction - QA version

License

Notifications You must be signed in to change notification settings

cris-oddball/fastapi0-qa

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Starter for FastAPI

This repo is nothing more than instructions for the first level of a FastAPI app. Fork the repo.

Installation Instructions

Application

Set up the application based on the FastAPI docs. Prepare one GET route for /status and have it return {'message': 'System is healthy'}

Locust

Use the documentation to prepare a locustfile.py that calls the /status endpoint.

Testing

Record Keeping

Each individual computer will have different results, but there should be consistency in the ratios between all engineers. Keep track of all settings and results.

Single Worker

Run fastapi dev <python file> in a terminal.

Run locust --processes 4 in another terminal and open the web interface at http://0.0.0.0:8089.

Set locust to:

  • 60 users
  • 10 ramp up
  • Host will be what FastAPI told you (probably http://127.0.0.1:8000)
  • Under advanced settings type 30s.

Record results, specifically: # of Requests, Fails, 95 percentile, Average, Max, and Current RPS.

Initial Code 07/12/24

# of Requests Fails P95 Average Max Current RPS
211479 0 9 ms 6.82 ms 38 ms 7982.1

Multiple Workers

NOTE: If you select "New" from the interface it will put the two runs next to each other (great for later tests).

Run gunicorn main:app -b 127.0.0.1:8000 --pythonpath app -k uvicorn.workers.UvicornWorker -w 4

Run locust --processes 4 in another terminal and open the web interface at http://0.0.0.0:8089.

Set locust to:

  • 60 users
  • 10 ramp up
  • Host will be what FastAPI told you (probably http://127.0.0.1:8000)
  • Under advanced settings type 30s.

Record results, specifically: # of Requests, Fails, 95 percentile, Average, Max, and Current RPS.

Initial Code

# of Requests Fails P95 Average Max Current RPS
383125 0 12 3.37 ms 128ms 15300.1

Experiment

Try any other combinations you think may be interesting.

About

Starter for FastAPI introduction - QA version

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 100.0%