Load balancing

From Resin 3.0

Revision as of 07:13, 14 January 2009 by Ferg (Talk | contribs)
Jump to: navigation, search


Resin documentation is at http://www.caucho.com/resin/doc/balance.xtp

Load balancing spreads the load among multiple backend Resin servers in a Cluster. A frontend Resin server proxies requests to the backend servers and sends the results to the clients.

We'll use 192.168.0.10 as the frontend machine and 192.168.0.20 through 192.168.0.28 as the backend machines.

The frontend server and the backend cluster have different configurations since they perform different roles.

Contents

The Frontend Server

  1. dispatches requests to the backend servers, generally using sticky sessions
  2. acts as a Proxy Cache for the backend cluster
  3. pools the proxy sockets for efficiency

The Backend Cluster

  1. does the actual work: the database querying and form processing
  2. manages persistent sessions

resin.xml

The frontend needs to configure:

  1. The external HTTP and HTTPS ports its listening to
  2. The cluster-definition of the backend cluster
  3. A LoadBalanceServlet to dispatch requests to the backend

resin.xml

<resin xmlns="http://caucho.com/ns/resin"
       xmlns:resin="http://caucho.com/ns/resin/core">
  <cluster id="load-balance">
      <server-default>
        <http host="*" port="80"/>
      </server-default>

      <server id="web-a" address="192.168.0.10" port="6800"/>

      <host id="">
          <web-app id="">
             <rewrite-dispatch>
                 <load-balance regexp="" cluster="app-tier"/>
             </rewrite-dispatch>
          </web-app>
       </host>
   </cluster>

    <cluster id="app-tier">
         <root-directory>/var/www/</root-directory>

         <server id="app-a" address="192.168.0.20" port="6800"/>
         <server id="app-b" address="192.168.0.21" port="6800"/>
         <server id="app-c" address="192.168.0.22" port="6800"/>

          <host id="">
              <web-app-deploy path="webapps"/>
          </host> 
       </cluster>
 </resin>
Personal tools