Load balance runtimes
Semarchy xDI Runtime can run as multiple instances that are all available behind a load balancer. As long as at least one runtime is available, an incoming request can still invoke a delivery.
This implementation requires a load balancer that can route HTTP/REST requests, as well as runtimes that have deliveries published as web services.
General configuration
Your setup process depends on your load balancer, so you should consult its own documentation. Follow these general instructions:
-
Install and configure xDI Runtime to serve a delivery published as a web delivery.
-
Optionally, configure the runtime to use TLS.
-
Copy this runtime installation to other locations to create your cluster instances.
-
Install a load balancer on a network that can reach your runtimes.
-
Add the runtimes to the load balancer:
-
Add all your runtime installations to the load balancer.
-
Configure the load balancer to proxy HTTP or HTTPS requests, depending on your runtime configurations.
-
Make the load balancer proxy these requests to one of the runtime REST endpoints.
-
-
Optionally, configure your load balancing algorithm.
Example configuration
This example illustrates a runtime load balancing configuration using the Apache HTTP server. This HTTP server can natively manage a proxy load balancer for the HTTP/REST protocol.
The requirements to run a proxy load balancer with the Apache HTTP server may change over time. See the official documentation for updated information. |
Instructions
First, install the desired runtimes with web service deliveries. Then install the Apache HTTP server on a device that can reach the runtimes.
Open the HTTP server configuration file, httpd.conf
, and uncomment the needed modules.
LoadModule access_compat_module modules/mod_access_compat.so
LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule allowmethods_module modules/mod_allowmethods.so
LoadModule asis_module modules/mod_asis.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule authn_core_module modules/mod_authn_core.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authz_core_module modules/mod_authz_core.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule dir_module modules/mod_dir.so
LoadModule env_module modules/mod_env.so
LoadModule include_module modules/mod_include.so
LoadModule isapi_module modules/mod_isapi.so
LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule slotmem_shm_module modules/mod_slotmem_shm.so
Insert the following code at the bottom of httpd.conf
. Add other runtime entries as needed, and change their hostnames and ports.
<VirtualHost *:80>
ProxyRequests off
ServerName domain.com
<Proxy balancer://mycluster>
# RUNTIME 1: change the hostname and port for your first runtime
BalancerMember http://<hostname1>:<port1>/rest/DeliveryService/3/default/<path>
# RUNTIME 2: Change the hostname and port to match the second runtime.
BalancerMember http://<hostname2>:<port2>/rest/DeliveryService/3/default/<path>
# Add additional runtimes as needed.
# Security
# Insert security settings here.
# Load balancer settings
# This example configures a round-robin style load balancer.
ProxySet lbmethod=byrequests
</Proxy>
# balancer-manager
# This tool is built into the mod_proxy_balancer
# module, and allows you to modify the group
# using a web interface.
<Location /balancer-manager>
SetHandler balancer-manager
# We recommend locking down this setting for your network.
Require host example.org
</Location>
# Point of balance
# This setting allows you to explicitly name
# the site location you want to balance.
# This example balances '/, or everything.
ProxyPass /balancer-manager !
ProxyPass / balancer://mycluster/
</VirtualHost>
Save the configure file, and start the HTTP server. It should balance incoming requests.