Bird
0
0

You want to optimize a Flask app for many users by adjusting connection pooling. Which combination of settings is best to handle 50 simultaneous users smoothly?

hard📝 state output Q15 of 15
Flask - Performance Optimization
You want to optimize a Flask app for many users by adjusting connection pooling. Which combination of settings is best to handle 50 simultaneous users smoothly?
ASQLALCHEMY_POOL_SIZE=50, SQLALCHEMY_MAX_OVERFLOW=0
BSQLALCHEMY_POOL_SIZE=20, SQLALCHEMY_MAX_OVERFLOW=10
CSQLALCHEMY_POOL_SIZE=5, SQLALCHEMY_MAX_OVERFLOW=5
DSQLALCHEMY_POOL_SIZE=10, SQLALCHEMY_MAX_OVERFLOW=40
Step-by-Step Solution
Solution:
  1. Step 1: Calculate total connections needed

    To handle 50 users, total connections should be at least 50.
  2. Step 2: Evaluate each option's total connections

    SQLALCHEMY_POOL_SIZE=10, SQLALCHEMY_MAX_OVERFLOW=40: 10 + 40 = 50 (meets requirement)
    SQLALCHEMY_POOL_SIZE=50, SQLALCHEMY_MAX_OVERFLOW=0: 50 + 0 = 50 (meets but no overflow flexibility)
    SQLALCHEMY_POOL_SIZE=5, SQLALCHEMY_MAX_OVERFLOW=5: 5 + 5 = 10 (too low)
    SQLALCHEMY_POOL_SIZE=20, SQLALCHEMY_MAX_OVERFLOW=10: 20 + 10 = 30 (too low)
  3. Step 3: Choose best option for flexibility

    SQLALCHEMY_POOL_SIZE=10, SQLALCHEMY_MAX_OVERFLOW=40 allows a smaller base pool with high overflow, balancing resource use and capacity.
  4. Final Answer:

    SQLALCHEMY_POOL_SIZE=10, SQLALCHEMY_MAX_OVERFLOW=40 -> Option D
  5. Quick Check:

    Pool + overflow ≥ users; flexible overflow is best [OK]
Quick Trick: Sum pool size and overflow to cover all users [OK]
Common Mistakes:
MISTAKES
  • Choosing too small total connections
  • Ignoring overflow flexibility
  • Setting pool size too high without overflow

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Flask Quizzes