Microservices: an overview in MuleSoft and Spring

Posted by:
Narayana Rallabandi

Publish Date:
23 Sep, 2021

Microservices - also known as the microservice architecture - refers to many small services which are self-contained and ready to run applications. These self-sustaining applications are loosely coupled with each other, thereby, creating a larger application.

Monolith vs Microservice Architecture

If all functionalities of a project exist in a single codebase, then that application is known as a monolithic application.

Architecture

Advantages of monolithic applications:

  • Simple to develop relative to microservices where skilled developers are required to identify and develop services.
  • Easier to deploy as a single jar/war file.
  • Easier to develop in comparison to microservices architecture.
  • Network latency and security issues are less common compared to microservices architecture.

Disadvantages of monolithic applications:

  • It becomes too large with time and therefore, difficult to manage.
  • Need to redeploy the whole application, even for a small change.
  • As application size increases, its start-up and deployment time also increases.
  • Horizontal scaling is not feasible in monolithic applications, as the application is built in a cascaded manner, and any delay will be transmitted to the end-user experience.
  • Difficult to adopt any new technology which is well suited for a particular functionality as it affects the whole application, in time and cost.
Mobile-App

Advantages of microservices:

  • It is easy to manage, being smaller in size.
  • If any update in one of the microservices, then we need to redeploy only that microservice.
  • Microservices are self-contained and deployed independently. Their start-up and deployment time is reduced.
  • If a particular microservice is facing a large load because due to excessive use of functionality, then you need to scale out that microservice only. Hence, the microservices architecture supports horizontal scaling.
  • Each microservice can use different technology based on business requirements.

The microservice architecture is not a silver bullet. It has several drawbacks. Moreover, when using this architecture there are numerous issues that you must address.

Disadvantages of microservices:

  • Being a distributed system, it’s much more complex than monolithic applications. Its complexity increases with the growing number of microservices.
  • Independent deployment of microservices is complicated.
  • Microservices are costly in terms of network usage as they need to interact with each other and all remote calls result in network latency.
  • Microservices are less secure relative to monolithic applications due to the inter-services communication over the network.
  • Debugging is difficult as the control flows over many microservices, as well as pointing out why and where exactly the error occurred.

Service Mesh Architecture

A service mesh is a way to control how different parts of an application share data with one another. This platform layer enables companies or individuals to create robust enterprise applications, made up of many microservices on a chosen infrastructure. Service mesh reduces the complexity associated with a microservice architecture and provides functionalities, such as load balancing, service discovery, health checks, authentication, traffic management and routing, circuit breaking and failover policy, among others. To implement a service mesh, you can deploy a proxy alongside your services. This is also known as the sidecar pattern. The sidecars abstract the complexity away from the application and handle functionalities like service discovery, traffic management, load balancing, circuit breaking, and more.

Service-Mesh

Anypoint Service Mesh

Anypoint Service Mesh enables you to extend your microservices network by including your non-MuleSoft applications into the Anypoint Platform sphere. You can then manage and secure your application network, including your non-MuleSoft applications, seamlessly from a single control pane. Anypoint Service Mesh ensures the following application management advantages:

  • Resilient service-to-service communication using zero-trust policies to handle traffic control, fault tolerance, and load balancing.
  • Extends MuleSoft API management capabilities to any non-MuleSoft service, with policies, security and analytics applied directly from Anypoint Platform.
  • The reuse of different services is easy as service discovery of non-MuleSoft services, via Anypoint Exchange.

In the Anypoint Service Mesh architecture, instead of services directly communicating with one another, a sidecar proxy is used to perform the same job. This sidecar proxy enables users to bring their non-MuleSoft services into the Anypoint platform, which then can be easily managed by using API Designer, API manager, API Analytics, and Anypoint Exchange.

Anypoint-Service-Mesh-1

Anypoint service mesh Architecture

Istio, which is installed on a Kubernetes cluster, uses Envoy to manage services by using a sidecar proxy. The sidecar is responsible for any communication with your service and resides within the same container as that service. With Anypoint Service Mesh enabled, you can continue to use Istio’s native policies for traffic control and security.

When a service is called, Anypoint Service Mesh ensures a smooth request flow and security checks. Anypoint Service flow can be seen in the figure below:

Anypoint-Platform-1

Anypoint Service Request Flow

Anypoint Service Mesh allows customers to expand their application network to any service, MuleSoft and non-MuleSoft. Through Anypoint Platform’s single control plane, customers can:

  • Discover and make use of any service in any architecture.
  • Incentivise service reuse by adding microservices to Anypoint Exchange.
  • Measure and optimise performance across all microservices with API analytics.
  • Add additional layers of security for consumer-facing services.

Microservice Architecture in Spring Boot and Cloud

Spring Cloud is a Spring module through which we can quickly develop cloud-based services. We can also build microservice-based applications, for example, configuration management, service discovery, circuit breakers, intelligent routing, and others. Spring Cloud is built on some of the common building blocks of the Spring framework:

  • Intelligent routing and service discovery
  • Service-to-service call
  • Load balancing
  • Leadership election
  • Global locks
  • Distributed configuration
  • Distributed messaging.

When it is used with Netflix Eureka, it acts as a container orchestration tool. The framework that provides an enterprise-level framework for integrating and managing container at scale is called container orchestration tool. It gives a developer-friendly environment for developing and deploying microservices.

There are many use cases supported by Spring Cloud:

  • Cloud Integration - Spring Cloud Connectors
  • Configuration - Spring Cloud Config, Spring Cloud Zookeeper, Netflix Archaius
  • Service Discovery - Spring Cloud Cloudfoundry, Spring Cloud Consul, Zookeeper, Netflix Eureka
  • Security - Spring Cloud Security
  • Load Balancing - Netflix Ribbon
  • Deployment - Spring Cloud Pipelines, Spring Boot, Maven.

A comparison of platforms:

A-comparison-of-platforms-1
A-comparison-of-platforms-2



Conclusion: which platform ‘feels’ better?

While the end goal of both platforms is the same – to achieve microservices capabilities – one can’t help but notice the ease with which the same can be achieved through MuleSoft.

Learn more about our integration capabilities here, or get in touch with one of our experts today.

Blog Author

Narayana Rallabandi

VP and Senior Principal Architect

Related Blogs

30 Jun, 2022

Embracing accelerators to boost stability and

In a project we completed with Bahrain’s Nation Bureau for Revenue (NBR) in...

Learn more
15 Nov, 2022

UK Police Forces Adopt Technology to Combat Crime

Learn more
26 Feb, 2021

Ariba Public Sector Supplier and Contract

Executive Summary LSI an Invenio Company’s municipal government client, The...

Learn more