title: Keeping global state in Flask Application
body: <p>This seems like a pretty obvious question, but a lot of the document around this is very confusing, and warn me <em>not</em> to keep a global state instead of telling me how to.</p>
  
  <p>For example, if I need to have a database connection pool (I'm not using SQLAlchemy), or a pool of object instances (both of which need to be <em>global</em> pools, centrally managed), how do I do that?</p>
  
  <p>If I use <code>flask.g</code>, that's not shared between threads, and if I use a python global, that's not shared between multiple processes of the same application (which, as I understand, can be spawned in the case of large production flask servers). Do I use <code>flask.current_app</code>? Do I make the pool a separate process itself? Something else?</p>