The purpose of this page is to explain how to setup software load balancer and reverse proxy for 2 or more OpenSpecimen instances using Apache web server. Load balancer helps in achieving high throughput, minimising response times and better utilisation of resources. A by-product of setting up load balancer is to increase reliability and availability of OpenSpecimen by ensuring there is no single point of failure (SPOF).
OpenSpecimen is a stateless application and hence there is no intrinsic limitation in achieving desired levels of scalability and availability.
- Apache2 web server with following modules enabled/installed:
mod_proxy, for proxying/forwarding requests
mod_proxy_balancer, for implementing load balancing
mod_proxy_ajp, for reverse proxying to Tomcat/backend servers using AJP
mod_status, for server activity monitoring
- Minimum of 3 machines. One machine with Apache2 web server installed. Other 2 machines with OpenSpecimen application deployed.
The configuration explained in next section helps users (system administrators) setup topology as shown in below diagram.
This setup has one instance of Apache2, load balancing requests among 2 instances of OpenSpecimen on round-robin basis. Individual requests can be load balanced without worrying about where the user login session was initiated. This is possible because of OpenSpecimen’s stateless architecture that prohibits storing user state information in-memory.
- Configure virtual host. Place virtual host configuration at bottom of apache2 web server's configuration file
httpd.conf. This file is usually located in directory
/etc/httpd/conf.d/ on Linux systems.
- Alternatively, virtual host configuration can be placed in separate file e.g.
opespecimen-vhost.conf and including the configuration from
httpd.conf file using below directive
- On doing appropriate configuration, restart apache2 web server
sudo apachectl graceful