Load balancing
From Resin 3.0
This article requires cleanup and may refer to a legacy version of Resin.
Please visit http://www.caucho.com/documentation/ for the most up-to-date documentation. |
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
- dispatches requests to the backend servers, generally using sticky sessions
- acts as a Proxy Cache for the backend cluster
- pools the proxy sockets for efficiency
The Backend Cluster
- does the actual work: the database querying and form processing
- manages persistent sessions
resin.xml
The frontend needs to configure:
- The external HTTP and HTTPS ports its listening to
- The cluster-definition of the backend cluster
- 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>