The problem that we&#39;re experiencing is that our single web server is getting &quot;flooded&quot; (not in a bad way) with a lot of incoming connections, our site is growing (yey).  So I&#39;m trying to figure out the best way to accommodate the growth.  In our case, nginx itself is humming along just fine, but PHP is choking on requests both due to quantity of requests (it can&#39;t process them fast enough so there&#39;s growing queue) as well as due to delays in database (I think).  So I&#39;m upgrading the database and looking to add another web server box both to off load some of the load, as well as serve as a backup box, etc.<div>
<br></div><div>What I don&#39;t know how to do &quot;well&quot; yet, is how to maintain the code base the same across the 2 boxes (will using a shared directory work?)</div><div><br></div><div>Using Nginx to do simple load balancing I think is the right way to go for us for now, obviously I&#39;ll have to deal with session management issues primarily which can either be handled via a shared memcache configuration (can you have 2 memcache servers running that share the same space? -- or on a single server) or via the database.</div>
<div><br></div><div>Any suggestions that anyone has to help things along would be greatly appreciated. </div><div><br></div><div>I just love how easy Nginx is in terms of configuration and how fast it is, really that hasn&#39;t been the issue.  I now have to get PHP to process things more quickly :-).<br>
<br><div class="gmail_quote">On Wed, Sep 2, 2009 at 11:20 PM, Jeffrey &#39;jf&#39; Lim <span dir="ltr">&lt;<a href="mailto:jfs.world@gmail.com">jfs.world@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On Thu, Sep 3, 2009 at 11:10 AM, Ilan Berkner <span dir="ltr">&lt;<a href="mailto:iberkner@gmail.com" target="_blank">iberkner@gmail.com</a>&gt;</span> wrote:<br></div><div class="gmail_quote"><div class="im">
<blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">
Maybe I&#39;m not explaining myself correctly, maybe your suggestions are the right way to go, but I see a lot of nginx examples such as this:<div><br></div><div><span style="font-family:lucida,arial,sans-serif;font-size:12px;border-collapse:collapse"><table style="border-collapse:collapse;text-align:left;background-color:rgb(204, 204, 255);width:993px" cellpadding="2" cellspacing="2">


<tbody style="border-top-width:0px"><tr><td style="font-family:lucida,arial,sans-serif;font-size:12px">upstream phpproviders {<br>        server <a href="http://127.0.0.1:3000" target="_blank">127.0.0.1:3000</a>;<br>

        server <a href="http://127.0.0.1:3001" target="_blank">127.0.0.1:3001</a>;<br>        server <a href="http://127.0.0.1:3002" target="_blank">127.0.0.1:3002</a>;<br>    }<br></td></tr></tbody></table></span><br></div>

</blockquote></div><div><br>:) yeah, that works fine. I just saw the phrase &quot;additional (fastcgi) requests&quot; - and immediately thought u meant to refer to a priority system... (ie. where &quot;all requests go to this box. Until it&#39;s loaded. Then send the additional requests to that other box!&quot;)<br>

<br> <br></div><div class="im"><blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex"><div></div><div>In this example, different port numbers are used, but you can use different ip addresses.</div>


<div><br></div><div>inside the location / tag you would specify:</div><div><br></div><div>proxy_pass <a href="http://phpproviders" target="_blank">http://phpproviders</a></div><div><br></div><div>nginx in the simplest (default mode) would round robin the requests.</div>


<div><br></div><div>Is this not a good type of methodology?</div><div><br></div></blockquote></div><div><br>it depends really on what you want/need. If you want a simple setup, this could do. And if there is nothing requiring you to stick each request to any particular server (since you have session management in memcache; assuming you have enough memory, and dont have to forcibly retire sessions ahead of their intended expiry time!!!), then this could very well work for you.<br>

<br>-Jeff<br><br></div></div>
</blockquote></div><br></div>