title: How to speed up Flask response download speed
body: <p>My frontend web app is calling my python Flask API on an endpoint that is cached and returns a JSON that is about 80,000 lines long and 1.7 megabytes.</p>
  
  <p>It takes my UI about 7.5 seconds to download all of it.
  <a href="https://i.stack.imgur.com/ypWyk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ypWyk.png" alt="ui_loading_time"></a></p>
  
  <p>It takes Chrome when calling the path directly about 6.5 seconds.
  <a href="https://i.stack.imgur.com/TuFzC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TuFzC.png" alt="enter image description here"></a></p>
  
  <p>I know that I can split up this endpoint for performance gains, but out of curiosity, what are some other great options to improve the download speed of all this content?</p>
  
  <p>Options I can think of so far:</p>
  
  <p>1) compressing the content.  But then I would have to decompress it on the frontend</p>
  
  <p>2) Use something like gRPC</p>
  
  <p>Further info:
  My flask server is using WSGIServer from gevent and the endpoint code is below. PROJECT_DATA_CACHE is the already Jsonified data that is returned:</p>
  
  <pre><code>@blueprint_2.route("/projects")
  def getInitialProjectsData():
      global PROJECT_DATA_CACHE
      if PROJECT_DATA_CACHE:
          return PROJECT_DATA_CACHE
      else:
          LOGGER.debug('No cache available for GET /projects')
          updateProjectsCache()
          return PROJECT_DATA_CACHE
  </code></pre>