Load Balancer example

A simple Load Balancer for RemoteViz using Node.js.

Information about Node.js and NPM can be found here: https://docs.npmjs.com/downloading-and-installing-node-js-and-npm

Load balancers are commonly deployed when a web application needs multiple servers because the volume of requests is too much for a single server to handle efficiently. This example shows you how to create a simple load balancer using Node.js to distribute incoming RemoteViz client requests to a service selected among a group of services in order to prevent overload and ensure the best user experience.

It includes three different parts:

LoadBalancerDiagram.png

The load balancer applies the following logic (can be customized according to your needs) to load balance incoming RemoteViz connections:

If a service instance goes down, the load balancer will detect this failure when a new incoming connection tries to be established and remove this instance from the SQLite database.

If the load balancer goes down, a restart will automatically reload its previous state, stored in the SQLite database.

The configuration of IP address, port number, and database path can be changed by editing the configuration file "RemoteViz/LoadBalancing/LoadBalancer/config/config.json".

Run the example:

  1. Go to "OIVHOME/examples/source/RemoteViz/LoadBalancing/LoadBalancer".

    1. Run "npm install" to install all the necessary Node.js dependencies.
    2. Run "npm run start-webserver" to start the webserver.
    3. Run "npm run start-loadbalancer" to start the loadbalancer.

  2. Go to "OIVHOME/examples/bin/OIVARCH/RemoteViz".

    1. Run the executable "LoadBalancedRenderingService".
      By default, the service will be bound on 127.0.0.1 IP address with port 8080.
      You can change the IP address and port number of the service with arguments. For instance: "LoadBalancedRenderingService 127.0.0.1 8083". (Do not use ports 80, 8081 and 8082, as they are already taken by the loadbalancer and webserver)

  3. Open your favorite web browser and navigate to "127.0.0.1".

  4. Repeat step 2. to add another instance, use the form on the top of the web page (opened in step 3.) to create a new RenderArea or duplicate an existing one.

The example displays a colored cone (all the renderAreas in one service instance use the same color) and a panel with the IP address, the port number of the connected service and the renderArea ID.

The database can be reset by deleting the ".sqlite3" file specified in the configuration file.

SCREENSHOT:

FILES:


Open Inventor Toolkit reference manual, generated on 15 Mar 2023
Copyright © Thermo Fisher Scientific All rights reserved.
http://www.openinventor.com/