Load balancing
From Resin 3.0
(Difference between revisions)
(renamed tag to directive) |
|||
Line 1: | Line 1: | ||
[[Category:Configuration]] [[Category:Cluster]] | [[Category:Configuration]] [[Category:Cluster]] | ||
− | Resin documentation is at http://www.caucho.com/resin | + | 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|Cluster]]. A frontend Resin server proxies requests to the backend servers and sends the results to the clients. | Load balancing spreads the load among multiple backend Resin servers in a [[cluster|Cluster]]. A frontend Resin server proxies requests to the backend servers and sends the results to the clients. | ||
Line 27: | Line 27: | ||
# A LoadBalanceServlet to dispatch requests to the backend | # A LoadBalanceServlet to dispatch requests to the backend | ||
− | ==== | + | ==== resin.xml ==== |
<resin xmlns="http://caucho.com/ns/resin" | <resin xmlns="http://caucho.com/ns/resin" | ||
xmlns:resin="http://caucho.com/ns/resin/core"> | xmlns:resin="http://caucho.com/ns/resin/core"> | ||
− | <server> | + | <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> | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + |
Revision as of 07:13, 14 January 2009
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.
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
Frontend Configuration
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>