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

Health Cloud & Financial Services Cloud Accreditation
Blogs

2 more clouds in our pocket!

WHISHWORKS is an accredited partner for two more Salesforce clouds, Health Cloud and Financial Services Cloud.

Kafka setup social image
Blogs

How to Set-up Kafka on AWS Cloud

In this blog, we outline the various steps involved in the installation and configuration of Apache Kafka on AWS cloud.

Blogs

Introduction to: Event Streaming

In this blog we introduce the key components of event streaming, including outlining the differences between traditional batch data processing and real-time event streaming.