Skip to main content

Scaling and Load-Balancing

In some cases the Xillio Link Redirector will be applied in a larger network with much higher bandwidth and/or a need for high availability. To mitigate this problem, the Xillio Link Redirector can be scaled up by running multiple instances. A load-balancer should be used to balance all incoming traffic and route it to separate instances.

Xillio Link Redirector behind a load-balancer

Most Cloud platforms have built-in solutions for load-balancing your network, for example Azure Load-Balancer, AWS Elastic Load-Balancing, or GCP Load-Balancing. They will help avoiding single points of failures from your setup. You can also install a load-balancer on-premise and configure it yourself.

There are currently multiple solutions on the market with two well-known Open-Source options: NGINX and Traefik. The following sections explain how to configure the Xillio Link Redirector in combination with either options. Both sections will use our containerized setup, as it goes very well with the load-balancing option.

Licenses for multiple instances

You can re-use your license for all the replicated instances of the Xillio Link Redirector. However, if your license does not support multiple instances, the replicas will not boot.

NGINX

This is the suggested folder structure throughout this guide.

xlr/
├── certs/
│ ├── demo.crt
│ └── demo.key
├── config.yml
├── docker-compose.yml
└── nginx.conf
nginx.conf
upstream link_redirector_servers {
server xlr_xlr_1;
server xlr_xlr_2;
server xlr_xlr_3;
server xlr_xlr_4;
}
server {
listen 80;
listen 443;
server_name example.com;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_pass http://link_redirector_servers;
}
}
docker-compose.yml
version: '3.7'

services:
db:
image: postgres:14.2
restart: always
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: example
POSTGRES_DB: xlr
volumes:
- ./.docker/db/data:/var/lib/postgresql/data

loadbalancer:
image: nginx:latest
restart: always
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
ports:
- 80:80
- 443:443

xlr:
image: xillio/xlr:latest
restart: always
volumes:
- ./certs:/app/certs
- ./config.yml:/app/config.yml
deploy:
mode: replicated
replicas: 4
config.yml
# Update your Configuration to point to the correct db instance
database:
type: postgres
url: postgresql://postgres:example@db:5432/xlr

With all these files in place you can execute the following command:

docker-compose up -d

This will start a database, nginx instance, and four replicas of the Xillio Link Redirector.

Traefik