Servers & Workers — Running FastAPI in Production — Concept Check
Questions on Servers & Workers — Running FastAPI in Production. Production = multiple Uvicorn worker processes behind a reverse proxy: workers ≈ cores for async apps, --proxy-headers so the app sees real client IPs and HTTPS, and graceful shutdown so deploys drop zero requests.
Questions in this quiz
8 questions on Servers & Workers — Running FastAPI in Production — Concept Check. Work through them here, then start the quiz to answer them and see your score.
1.A FastAPI application in production is experiencing slow response times. The `vmstat` command shows high `si`/`so` values. What could be the issue?
- AIncorrect proxy headers configuration
- BLack of graceful shutdown
- CInsufficient RAM causing swap usage
- DToo many Uvicorn workers
2.You notice that client IPs are logged as 127.0.0.1 in your FastAPI application behind a proxy. What configuration is likely missing?
- A--proxy-headers
- B--workers 4
- C--forwarded-allow-ips
- D--timeout-graceful-shutdown
3.A FastAPI service is deployed with 8 Uvicorn workers on a 4-core machine. What is a potential issue with this setup?
- AWorkers should equal double the cores plus one
- BEach worker requires a separate proxy
- CMore workers always improve performance
- DExcessive worker count can lead to context switching overhead
4.After deploying a FastAPI application, users report broken links with 'http://' instead of 'https://'. What might be the cause?
- AInsufficient memory allocation
- BIncorrect worker count
- CToo many Uvicorn workers
- DMissing --proxy-headers option
5.During a rolling deployment, some requests are dropped. What is a likely cause?
- AImproper SIGTERM handling
- BExcessive memory usage
- CIncorrect proxy configuration
- DToo many workers
6.What is the recommended initial worker count for an async-heavy FastAPI application?
- AEqual to the number of CPU cores
- BDouble the number of CPU cores plus one
- COne worker per gigabyte of RAM
- DFour workers regardless of cores
7.A FastAPI app behind a proxy logs all client IPs as the proxy's IP. What configuration might be incorrect?
- A--proxy-headers is not set
- BMissing readiness probes
- CIncorrect worker count
- DToo many Uvicorn workers
8.What happens if a Uvicorn worker crashes in production?
- AAll workers stop serving requests
- BThe master process replaces the crashed worker
- CThe application shuts down
- DThe crashed worker restarts automatically