Service proxy load balancing configuration

Feedback


To improve the load balancing ability of proxy service to improve the concurrent access, you can deploy multiple independent proxy packages. Below shows the specific configuration flow:

  1. Deploy the needed independent proxy packages as service proxy nodes, see: Configure service proxy installation package. The example in this section deploys two service proxy nodes: 192.168.120.40:8091 and 192.168.120.40:8092.
  2. Configure Nginx to implement load balancing. This example uses the default polling. The config of nginx.conf is like following:

    upstream proxyserver.com {

        server 192.168.120.40:8091;

        server 192.168.120.40:8092;

        }

    server {

        listen       8195;

        server_name  proxyserver.com;

        location / {

        proxy_pass   http://proxyserver.com;

        proxy_set_header Host $host:$server_port;

        }

  1. Configure iPortal installation package, see: Configure iPortal installation package.
  2. In iPortal installation package, find <serviceProxy> node in iportal.xml, add <proxyServerRootUrl> sub-node under it like following:

<serviceProxy>

     <enable>true</enable>

     <enableBuiltinProxy>false</enableBuiltinProxy>

     <port>8195</port>

     <rootUrlPostfix>portalproxy</rootUrlPostfix>

     <proxyServerRootUrl>http://proxyserver.com:8195</proxyServerRootUrl>

     <httpConnPoolInfo>

       <maxTotal>100</maxTotal>

       <defaultMaxPerRoute>10</defaultMaxPerRoute>

     </httpConnPoolInfo>

</serviceProxy>

In the above configuration:

  1. Start iPortal installation package and independent service proxy nodes. Specific steps: run the startup.bat/startup.sh in bin directory on Windows/Linux.
  2. Access iPortal service with the domain name after setting Nginx. In this example, it is: http://proxyserver.com:8090/
  3. At this point, if you register a service, for example: http://rdc.ispeco.com:8080/iserver/services/map-china400/rest , the proxied address will be http://proxyserver.com:8195/portalproxy/iserver/services/map-china400/rest.
  4. To check which service proxy node processes the current request, you can add the following bold config items in nginx.conf on Nginx:

    server {

        listen       8195;

        server_name  proxyserver.com;

        location / {

        proxy_pass   http://proxyserver.com;

        proxy_set_header Host $host:$server_port;

        add_header backendIP $upstream_addr;

        add_header backendCode $upstream_status;

        }

then restart Nginx. Access this proxied service address in the debug mode in your browser (enter F12 to enter debug mode). In the list under "Network" tab, click to select the current request, on the right side under "Headers", you can view the backendIp information in "Response Headers" section.

At this point, the load balancing configuration for service proxy is completed.