WebViewer Server comes with a load balancer known as HAProxy
located at our pdftron/wv-loadbalancer repository on DockerHub. This can be used in conjunction with WebViewer Server to load balance.
This guide details how to manage load balancing using the HAProxy image, in a way that is extensible to any environment.
HAProxy contains network entries called webAwebBwebC
... and so on. These entries indicate the location of a server that HAProxy can send requests to. The methods here will modify these entries to point at the correct server.
By default WebViewer Server does all load balancing using the leastconn method. This sends incoming requests to servers with the smallest number of active connections.
You can set the initial locations of these webX
entries by setting the environment variables INITIAL_NODE_AINITIAL_NODE_B
... up to INITIAL_NODE_F
on the wv-loadbalancer
image. HAProxy will initially send requests to any healthy and responding servers set in these variables.
To set servers dynamically with HAProxy you can take advantage of something known as TCP Management - this can be used to change these webX
entries to the current location of a server.
There are several ways to send requests to the server with this method, but all commands to HAProxy will be sent with the same structure.
set server nodes/[webX] addr [WVS ip address] [WVS port]
ENABLE_TCP_MANAGEMENT
to true on the Docker image and sending requests to the TCP Management port 4893
wherever the balancer is located. The following code does this using Node.js.The above code sets webA
to be the Webviewer Server at 192.168.1.1:8090
. HAProxy will now send webA
requests to this server.
Whenever a change occurs, you can dynamically rewrite remotely using the above code. The changes will instantly occur. More commands can be found at the HAProxy Management documentation
Did you find this helpful?
Trial setup questions?
Ask experts on DiscordNeed other help?
Contact SupportPricing or product questions?
Contact Sales