For the list of all supported Decision Insight downloads and releases, see the Downloads page.

Proxy and loadbalancer example with NGINX


We use NGINX as a reverse proxy and loadbalancer as described in Topology for HTML5 based UI.

The URI that can be redirected to the replica nodes are the queries that only retrieve data from the server (no absorption).

In this example, the following URI are redirected to the replica nodes:

  • pagelet execution queries: /rest/ui/dashboards/dashboard-.*/pagelets/pagelet-.*

  • parameters queries: /rest/ui/dashboards/dashboard-.*/pagelets/parameters-.*

Configuration file

events {
    worker_connections  1024;
http {
    # Define your custom logs format
    log_format  main  '$time_local ; $upstream_addr ; $request ; $status';
    # Define a group of servers for the UI query requests
    upstream uiservers {
        # Replica A
        server max_fails=1 fail_timeout=1h;
        # Replica B
        server max_fails=1 fail_timeout=1h;
        # Replica C
        server max_fails=1 fail_timeout=1h;
        # Primary fallback
        server backup;
    server {
        # Proxy URL info so that browser URL to access the app will be: http://server_name:listen
        listen       1443;
        # Access log file path: format 'main' will be logged into this file
        access_log   logs/host.access.log  main;
        # Redirect all generic queries to the Primary
        location / {
            # Primary path
            proxy_http_version 1.1;        
        # Redirect all parameters and pagelet queries to the Replica servers
        location ~ \/rest\/ui\/dashboards\/dashboard-.*\/(parameters|pagelet-) {
            proxy_pass   http://uiservers;
            proxy_http_version 1.1;

Understanding max_fails and fail_timeout parameters

max_fails is the number of failed attempts (i.e. when the request sent on the RN is not successful) during the fail_timeout period before the RN is considered as unavailable. Then, fail_timeout is used as the time during which the RN is considered unavailable and not used.

A failed attempt is defined by the parameter proxy_next_upstream whose default conf is proxy_next_upstream error timeout. This default setting means that we wait for the query to fail or to not return before a given timeout (2 minutes). 

The best way to not impact performance is to mark the server as down (using server replica_ip:replica_port down) when possible so that the PN does not attempt to reach this RN.

Related Links