DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Last call! Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • MuleSoft Operational and API Management Capabilities
  • Implementing Mapping Rules With MuleSoft Dedicated Load Balancer
  • Mule 4 Custom Policy Example
  • Adding a Custom Domain and SSL to AWS EC2

Trending

  • Why High-Performance AI/ML Is Essential in Modern Cybersecurity
  • Understanding and Mitigating IP Spoofing Attacks
  • Automating Data Pipelines: Generating PySpark and SQL Jobs With LLMs in Cloudera
  • The Role of Functional Programming in Modern Software Development
  1. DZone
  2. Software Design and Architecture
  3. Integration
  4. Importance Of Anypoint Dedicated Load Balancer in MuleSoft Ecosystem

Importance Of Anypoint Dedicated Load Balancer in MuleSoft Ecosystem

Dedicated Load Balancer is an optional component in Anypoint Platform which allows the route of external HTTP/HTTPs traffic.

By 
Jitendra Bafna user avatar
Jitendra Bafna
DZone Core CORE ·
Jan. 04, 21 · Opinion
Likes (4)
Comment
Save
Tweet
Share
14.9K Views

Join the DZone community and get the full member experience.

Join For Free

Introduction

Dedicated Load Balancer is an optional component in Anypoint Platform which allows the route of external HTTP/HTTPs traffic to multiple applications deployed to Cloudhub within VPC.

Each Dedicated Load Balancer has a DNS A record lb-name.lb.anypointdns.net that resolves to the two public IP addresses of the two instances. 

To create a dedicated load balancer, you must first create the Anypoint VPC which can be mapped to the multiple environments and the same dedicated load balancer can be used for different environments. You can use multiple DNS for the same dedicated load balancer (i.e. api-dev.example.com and api-test.example.com)

Why Dedicated Load Balancer in MuleSoft Ecosystem?

  • One of the limitations of SLB is the lower rate limit. To avoid that issue, you can use a dedicated load balancer.
  • All applications can be hosted under a single domain.
  • Custom SSL certificates can be configured on DLB.
  • Handle load balancing among the different Cloudhub workers that run your application.
  • To access apis publicly or whitelisted client deployed within VPC.
  • To support Mutual Authentication (Two Way SSL).

Prerequisites

  • At least one VPC configured to create DLB.
  • SSL Certificates in .pem format.

Whitelisted CIDRs

To allow dedicated load balancers must be used by a set of IP addresses or single IP addresses, you need to add those IP addresses in the form of CIDR notations (e.g. 192.168.1.0/24).

By default, all the public traffic allowed on DLB as default CIDR allowed is 0.0.0.0/0. In case if you want to allow public traffic from few clients, you can delete default CIDR and allow only CIDR from which DLB has to accept the traffic.

HTTP Inbound Mode

  • Off: Causes the load balancer to silently drop the request.
  • On: Accepts the inbound request on the default SSL endpoint using the HTTP protocol.
  • Redirect: Redirects the request to the same URL using the HTTPS protocol.

Other Configurations

  • Disable Static IPs specifies to use dynamic IPs, which do not persist when the DLB restarts.
  • Keep URL encoding specifies the DLB passes only the %20 and %23 characters as is.
    If you deselect this option, the DLB decodes the encoded part of the request URI before passing it to the CloudHub worker.
    Support TLS 1.0 specifies to support TLS 1.0 between the client and the DLB.
  • Upstream TLS 1.2 specifies to force TLS 1.2 between the DLB and the upstream Cloudhub worker.

Dedicated Load Balancer Certificates

Configure SSL certificate to enable HTTPS (Public Key and Private Key). For two way authentication, you can configure Client Certificate and that is optional. The dedicated load balancer must be associated with at least a pair of one certificate.

Generally, we configure the certificates on Dedicated Load Balancer from CA authority. For testing purposes, you can use self-signed certificates. 

Note: - Always use CA signed certificates instead of self signed certificates. It is not recommended to use self signed certificates as it is not secure and even not recognized by browsers and few or more clients.

Generating Self Signed Certificates

Plain Text
 




x


 
1
openssl req -newkey rsa:2048 -nodes -keyout test-private.pem -x509 -days 3000 -out test-public-crt.pem


The above command will generate Private Key and Public Key that can be configured on a dedicated load balancer. 

Generating Self Signed Certificates Using .cfg File

You can generate certificates by adding below content in .cfg file and pass to OpenSSL command. 

Plain Text
 




xxxxxxxxxx
1
32


 
1
[ req ]
2
default_bits       = 2048
3
distinguished_name = req_distinguished_name
4
req_extensions     = req_ext
5
prompt = no
6
[ req_distinguished_name ]
7
countryName                 = US
8
stateOrProvinceName         = Arizona
9
localityName               = Phoenix
10
organizationName           = Test
11
commonName                 = example.com
12
[ req_ext ]
13
subjectAltName = @alt_names
14
[alt_names]
15
DNS.1   = api-dev.example.com
16
DNS.2   = api-qa.example.com


Plain Text
 




xxxxxxxxxx
1


 
1
openssl req -newkey rsa:2048 -nodes -keyout test-private.pem -x509 -days 3000 -out test-public-crt.pem -config test-com.cfg



Generating Self Signed Wildcards Certificates

Plain Text
 




xxxxxxxxxx
1
19


 
1
[ req ]
2
default_bits       = 2048
3
distinguished_name = req_distinguished_name
4
prompt = no
5
[ req_distinguished_name ]
6
countryName                 = US
7
stateOrProvinceName         = Arizona
8
localityName               = Phoenix
9
organizationName           = Test
10
commonName                 = *.example.com



Dedicated Load Balancer Mapping Rules

Mapping rules are used on dedicated load balancers to translate input URI to call applications deployed on Cloudhub. A pattern is a string that defines a template for matching an input text. Whatever value is placed within curly brackets ({ }) is treated as a variable. Variable names can contain only lowercase letters (a-z) and no other characters, including slashes. 

Input Path

Target App

Output Path

Protocol

/{app}/

{app}

/

http

/{app}/

org-{app}-{subdomain}

/

http

One Dedicated Load Balancer Mapped With One Environment

anypoint dlb

One Dedicated Load Balancer Mapped With Multiple Environment

Let's consider that we have 2 DNS (i.e. api-dev.example.com and api-test.example.com) setup on a dedicated load balancer.

api-dev.example.com is for the Dev environment whereas api-test.example.com is for the Test environment.

Use Case 1

We are receiving requests on the DLB https://api-dev.example.com/ecommerce/v1.0/invoices and need to redirect them to http://org-ecommerce-api.cloudhub.io/v1.0/invoices (the Cloudhub application name will be org-ecommerce-api)

We can use this mapping rule to achieve this.

Input Path

Target App

Output Path

Protocol

/{app}

org-{app}-api

/v1.0

http

This above rule will be applied when requests come on DLB and route to the Cloudhub application in the VPC.

  • https://api-dev.example.com/ecommerce/v1.0/invoices  ==> http://org-ecommerce-api.us-e1.cloudhub.io:8091/v1.0/invoices

dedicated load balancerBut here we have some problems that on our DLB, we have set up 2 DNSs, one for Dev and another for Test. Now, how will the DLB know this is a request that needs to route to either the Dev or Test application because the same rule will be applied for both?

To avoid this, we will be using a subdomain in the next use case.

Use Case 2

In this case, we will be using a subdomain for routing the request to the correct environment from DLB.

Our application name format must be org-app-subdomain (e.g. org-ecommerce-api-dev for dev environment and org-ecommerce-api-test for test environment) when deploying to CloudHub workers in VPC .

So, our mapping rule will look like this.

Input Path

Target App

Output Path

Protocol

/{app}

org-{app}-{subdomain}

/v1.0

http

subdomain is variable to map any subdomain.

  • https://api-dev.example.com/ecommerce/v1.0/invoices (DLB)  ==> http://org-ecommerce-api-dev.us-e1.cloudhub.io:8091/v1.0/invoices (CloudHub Dev Environment)
  • https://api-test.example.com/ecommerce/v1.0/invoices (DLB) ==> http://org-ecommerce-api-test.us-e1.cloudhub.io:8091/v1.0/invoices (CloudHub Test Environment)

In this use case, we solve the issue of routing the request from DLB to the correct environment.

mapping rule

Let's consider another scenario where you want to route the request to CloudHub on the basis of the application version. We will see this in the next use case.

Use Case 3

In this case, when we will deploy an application to CloudHub, and it will be in format org-app-subdomain-version (e.g. org-ecommerce-api-dev-v1-0 for Dev environment and org-ecommerce-api-test-v1-0 for Test environment).

Whenever we will get request on DLB, then the version in the URL will be v1.0 and v2.0 but when you deploy application on CloudHub it doesn't allow to use "." in the application name. That is the reason we are using "-" in the version of the application deploying to CloudHub.

So, our mapping rule will look like this.

Input Path

Target App

Output Path

Protocol

/{app}/v{versiona}.{versionb}

org-{app}-{subdomain}-v{versiona}-{versionb}

/v1.0

http

  • https://api-dev.example.com/ecommerce/v1.0/invoices (DLB)  ==> http://org-ecommerce-api-dev-v1-0.us-e1.cloudhub.io:8091/v1.0/invoices (CloudHub Dev Environment)
  • https://api-test.example.com/ecommerce/v1.0/invoices (DLB)  ==> http://org-ecommerce-api-test-v1-0.us-e1.cloudhub.io:8091/v1.0/invoices (CloudHub Test Environment)

DLB

DLB Mapping Rules Priority

DLB will apply the first matching rule regardless of more exact matching rules available. A rule defined first, at index 0 has higher priority against other rules defined after it. The higher the index assigned, the less priority the mapping rule has.

Introduction To Anypoint VPC DLB and VPN

Dedicated Load Balancer Architecture and Concepts

Dedicated Load Balancer - Demonstration

Dedicated Load Balancer With Anypoint CLI

Accessing Dedicated Load Balancer Publicly and Internally

dedicated load balancer

References

https://docs.mulesoft.com/runtime-manager/dedicated-load-balancer-tutorial

https://dzone.com/articles/deep-dive-into-mulesoft-anypoint-vpc-vpn-and-dedic

https://dzone.com/articles/implementing-mapping-rules-with-mulesoft-dedicated

https://www.youtube.com/playlist?list=PL5GwZHHgKcuDQ6vWarTLgVbrPEQipzbOM

Load balancing (computing) application Requests MuleSoft Plain text Use case

Opinions expressed by DZone contributors are their own.

Related

  • MuleSoft Operational and API Management Capabilities
  • Implementing Mapping Rules With MuleSoft Dedicated Load Balancer
  • Mule 4 Custom Policy Example
  • Adding a Custom Domain and SSL to AWS EC2

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!