title: load balancing/routing an application made with socketio and flask
body: <p>I'm a bit of noob when it comes to deploying web apps and wanted to make sure a little app I'm building will work with the tech I'm trying to use.</p>
  <p>I have some experience with flask, but have only ever used the test server. My understanding is that with nginx or apache, if I write a flask app, each user who visits my website could get a different instance of the flask app, exactly how that will work is a little confusing to me.</p>
  <p>The app I want to make is similar to chatrooms/a game like &quot;among us&quot;. When a user comes to the website, they join a big &quot;lobby&quot; and can either join a &quot;room&quot; that already exists, or launch a new room and generate a code/ID that they can pass to their friends so that their friends can join the same session (I think a socketio &quot;room&quot; can be used for this).</p>
  <p>However, if each client is connected to their own flask instance, will every server instance be able to see the &quot;rooms&quot; on the other instances? Suppose my app becomes really popular and I want to scale the lobby across multiple machines/AWS instances in the future, is there anything I can do now to ensure this works? Or is scaling across multiple machines equivalent to scaling across instances on a single machine as far as the flask-socketio/nginx stack is concerned.</p>
  <p>Basically, how do I ensure that the lobby part of the code is scalable. Is there anything I need to do to ensure every user has the ability to connect to rooms with other users even if they get a different instance of the flask app?</p>