The best clustering configuration will depend on your traffic needs, existing
infrastructure, and budget. One possible clustering configuration is pictured below:
There are three layers to this setup:
- Load-balancer Between users and the application servers is a
load-balancing device. The device may be hardware-based or software-based. Every
user has a session (represented by a unique cookie value) that allows stateful
data to be maintained while they are using the application. Each session is
created on a particular application server. The load-balancer must be
"session-aware," meaning that it inspects the cookie value and always sends a
given user's requests to the same application server during a given session.
Without session-aware load balancing, the load-balancer could send requests to
any application server in the cluster, scrambling results for a given user.
- Application Servers In the middle-tier, multiple application servers are
set up and the clustering feature is enabled. Caches between the application
instances are automatically synchronized. If a particular application server
fails, the load-balancer detects this and removes the server from the cluster.
- Database All instances in a cluster must share the same database.
Note: You're unlikely to see any performance improvement at all with a cluster of only
two nodes.