Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the command to run a FastAPI app using Gunicorn with Uvicorn workers.
FastAPI
gunicorn -w 4 -k [1] myapp:app
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using default sync worker which blocks async calls.
Using eventlet or gevent which are not compatible with Uvicorn.
✗ Incorrect
Gunicorn uses the UvicornWorker class to run FastAPI apps asynchronously.
2fill in blank
mediumComplete the command to specify 2 worker processes for Gunicorn with Uvicorn.
FastAPI
gunicorn -w [1] -k uvicorn.workers.UvicornWorker myapp:app Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Setting workers to 1 when more concurrency is needed.
Using too many workers causing resource exhaustion.
✗ Incorrect
The -w option sets the number of worker processes; here it is 2.
3fill in blank
hardFix the error in the command to run Gunicorn with Uvicorn workers on port 8080.
FastAPI
gunicorn -w 3 -k uvicorn.workers.UvicornWorker myapp:app [1] 0.0.0.0:8080
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using --port alone without address.
Using --host which is not a Gunicorn option.
✗ Incorrect
Gunicorn uses -b or --bind to specify the address and port to bind.
4fill in blank
hardFill both blanks to bind Gunicorn to localhost on port 5000.
FastAPI
gunicorn -w 2 -k uvicorn.workers.UvicornWorker myapp:app [1] [2]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Binding to 0.0.0.0 when localhost is intended.
Using --host instead of -b or --bind.
✗ Incorrect
Use -b followed by address:port to bind Gunicorn to localhost:5000.
5fill in blank
hardFill all three blanks to run Gunicorn with 3 workers, Uvicorn worker class, and bind to all interfaces on port 8000.
FastAPI
gunicorn [1] [2] [3] myapp:app
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using --workers 4 instead of -w 3.
Omitting the worker class option.
Binding to localhost instead of all interfaces.
✗ Incorrect
Use -w 3 for workers, -k for worker class, and -b for binding address and port.