Bird
0
0

Why does Gunicorn recommend using multiple worker processes instead of threads for Flask apps in production?

hard📝 Conceptual Q10 of 15
Flask - Performance Optimization
Why does Gunicorn recommend using multiple worker processes instead of threads for Flask apps in production?
AGunicorn does not support threading at all
BThreads consume more memory than processes in Python
CBecause Python's Global Interpreter Lock (GIL) limits threads, multiple processes improve concurrency
DProcesses are easier to debug than threads
Step-by-Step Solution
Solution:
  1. Step 1: Understand Python's GIL impact

    The GIL allows only one thread to execute Python bytecode at a time, limiting thread concurrency.
  2. Step 2: Why multiple processes help

    Multiple processes each have their own Python interpreter, bypassing the GIL and improving concurrency.
  3. Final Answer:

    Because Python's Global Interpreter Lock (GIL) limits threads, multiple processes improve concurrency -> Option C
  4. Quick Check:

    GIL limits threads, processes improve concurrency [OK]
Quick Trick: Multiple processes bypass Python's GIL for better concurrency [OK]
Common Mistakes:
MISTAKES
  • Thinking threads use less memory than processes
  • Believing Gunicorn does not support threads
  • Assuming debugging ease drives process choice

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Flask Quizzes