How to set up a load balancer for on-premise Mule servers

  • Written By WHISHWORKS
  • 27/09/2017

Load balancing is one of the best solutions to distribute network or application traffic across a number of servers in order to increase throughput, capacity, availability and reliability. For those that want to make the most out of their on-premise Mule servers, the following steps show how to set up a load balancer with Mule Standalone servers:

  • Take two servers and install one instance of Mule Runtime to each one, making sure that the same version of Mule is installed on both servers. 
  • Add these Mule servers to the Anypoint Platform
  • Create a cluster with these servers in Anypoint Platform
  • Deploy a Mule application in this cluster
  • Download a load balancer in one of the servers or any other server. For example, let’s download nginx load balancer. Configure nginx.conf file as shown below.

location / {
           root   html;
          index  index.html index.htm;
           proxy_pass http://<some name>;
       }
upstream <some name> {
  server <IP of one server>:<port of mule app>;
  server <IP of another server>:<port of mule app> weight=<some number>;
}
example:
location / {
           root   html;
           index  index.html index.htm;
           proxy_pass http://backend;
       }
upstream backend {
  server 10.0.1.108:8081;
  server 10.0.3.112:8081 weight=5;
}

  • Start the load balancer
  • From Postman you can call the Mule application

Now you can see that the Mule application is being served from both servers. If one server goes down, the other server will be able to serve the request.

If you would like to find out more about how you can get the most out of your MuleSoft infrastructure, do give us a call at +44 (0)203 475 7980 or email us at marketing@whishworks.com

Other useful links:

How to Integrate Mule ESB with Microsoft Office-365 SharePoint

31 API Recipes with MuleSoft Anypoint Platform

MuleSoft solutions

Latest Insights

Salesforce FSC - Modelling Relationships -1
Blogs

Salesforce FSC – modelling relationships, part 1

The value and the complexity of a relationship are the main factors in using Modelling Relationships in Salesforce Financial Services Cloud.

Data Mesh
Blogs

Data Mesh – a paradigm shift

To address the increasingly unmanageable expanse of data, data mesh is fast becoming the go to approach for organisations.

Litify-Whishworks
Blogs

Litify partners with WHISHWORKS

Top legal SaaS firm Litify, selects WHISHWORKS as one of its expert Delivery Partners, to ensure accelerated time-to-value for its clients.