Load Balancing

General Principles#


In order to load balance dotCMS:

  • Your database must be fully configured and running with dotCMS.
  • All nodes should be connected to the cluster (see Cluster Setup) and connected to the same centralized database.
  • To use the dotCMS authoring tools, you must use a load balancer that has sticky session support enabled and running in front of your dotCMS instances.

Redis#

As an alternative to the use of sticky sessions, Tomcat sessions can be persisted and managed via a Redis server within a cluster. This requires setting several configuration properties, as in the example below.

TOMCAT_REDIS_SESSION_ENABLED: 'true'
TOMCAT_REDIS_SESSION_HOST: 'redis.example.com'
TOMCAT_REDIS_SESSION_PASSWORD: 'RedisPassword'
TOMCAT_REDIS_SESSION_USERNAME: 'RedisUsername'
DOT_DOTCMS_CLUSTER_ID: 'example-prod'

Tradeoffs#

Further Notes#


  • All caches and indexes are stored separately on each node in the cluster.
  • DNS round robin can be used to distribute load across dotCMS servers in a cluster.
    • Note however that this will not provide instant failover if a node is taken out of the cluster.
  • While it can be done, session clustering at the application server level is not tested.
    • Sessions can get large and clustering them can cause unneeded network traffic.