Bird
0
0

How can you optimize a Flask polling endpoint to reduce server load when many clients poll frequently?

hard📝 Application Q9 of 15
Flask - WebSocket and Real-Time
How can you optimize a Flask polling endpoint to reduce server load when many clients poll frequently?
ADisable caching and generate fresh data every request
BIncrease polling frequency to get updates faster
CUse POST requests instead of GET for polling
DCache the response data and return cached results when unchanged
Step-by-Step Solution
Solution:
  1. Step 1: Identify server load causes

    Frequent polling causes many requests; generating data each time is costly.
  2. Step 2: Use caching to reduce load

    Cache data and return cached response if data unchanged to avoid recomputation.
  3. Final Answer:

    Cache the response data and return cached results when unchanged -> Option D
  4. Quick Check:

    Cache reduces load for frequent polling [OK]
Quick Trick: Cache polling responses to reduce server work [OK]
Common Mistakes:
MISTAKES
  • Increasing polling frequency increases load
  • Using POST instead of GET does not reduce load
  • Disabling caching increases server work

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Flask Quizzes