title: nginx loadbalancing in uwsgi
body: <p>I am new to uwsgi and trying to understand how it works.</p>
  
  <p>In uwsgi say i have two setups say</p>
  
  <p>1)</p>
  
  <pre><code>uwsgi --socket /tmp/uwsgi.sock --socket 127.0.0.1:8000 --master --process 2 --workers 1
  </code></pre>
  
  <p>which is a single uwsgi process with 2 child processes each having three threads listening to port 8000</p>
  
  <p>2) </p>
  
  <pre><code>uwsgi --socket /tmp/uwsgi.sock --socket 127.0.0.1:8000 --master --process 2 --workers 3
  uwsgi --socket /tmp/uwsgi2.sock --socket 127.0.0.1:8001 --master --process 2 --workers 3
  </code></pre>
  
  <p>similarly 2 uwsgi processes listening to ports 8000 and 8001</p>
  
  <p>doubt 1 : Can we configure the uwsgi process to run like (2) and having them configured in nginx ?</p>
  
  <p>doubt 2 : when does nginx loadbalances the requests
   (a) if it has multiple uwsgi process listening to multiple ports 
   (b) if it has single uwsgi process with multiple child processes</p>
  
  <p>Which is the better (a) or (b) or is this is not the right way to use nginx to loadbalance uwsgi processes, if not how ?</p>