Coined over a decade ago, Microservices is a buzzword in today’s technical arena. Microservices are known as micro web services based on SOAP and enables breaking of a large system into several independent collaborating processes that function like independent mini applications.
The Microservices architecture assists in avoiding monolith application for large systems. It also provides a loose coupling between the collaborating processes, running independently in different environments with tight cohesion.
To better understand the concept, let’s take the example of an online shop with separate Microservices for user-accounts, shopping carts, product-catalog, and order-processing. All of these components are critical for a large online shopping portal.
Here’s how the online shopping system would be with and without Microservices.
Shopping System without Microservices
This type of architecture style is known as Monolith architecture, where in all the collaborating components are combined in a single application.
Shopping System with Microservices
This type of architecture style divides the main application into a set of sub applications – Microservices. A large application is, thus, divided into multiple associated processes as below:
• It has smaller code base, which is easy to maintain
• Individual components are easy to scale
• It encourages technology diversity, thus, we can mix databases, frameworks, libraries etc.
• It allows fault isolation in the sense that failure of one process won’t bring down the whole system
• It offers better support for smaller and parallel teams
• It allows standalone deployment
• It reduces the time required for deployment
• It is difficult to achieve consistency across services as they all work independently
• The ACID transactions do not span multiple processes
• It is hard to debug and trace the issues in Distributed System
• There’s greater need for end-to-end testing
• It provides Platform as a Service like Pivotal Cloud Foundry help to deployment, scale, monitor, easily run etc.
• It supports continuous deployment, releasing upgrades of new versions of code, and running multiple versions of same service simultaneously.
Microservices Tooling Supports
Microservices tooling supports Spring Cloud and Discovery Server. Spring Cloud is the building blocks for Cloud and Microservices, providing infrastructure that enables use of services such as Service Discovery, Configuration server, and Monitoring.
Although there are several use-cases supported by Spring Cloud such as Cloud Integration, Service Discovery, Client side Load Balancing, Dynamic Reconfiguration, Security etc. we will only discuss
• Service Discovery: – which is about how services find each other.
• Client-side Load Balancing: – which is about deciding the service instance to use.
Need for Service Discovery
With the help of Microservices an application is divided into multiple processes and each of the process has different services delivering output. There are chances that these independent services might require each other’s assistance but since they are running in isolated environment it is difficult for services to find each other. Also, it is difficult to determine the impact of running multiple instances for a service.
Resolution with Service Discovery
Introducing service discovery into the picture takes care of both the concerns. Not only does it helps different services find each other but also gives the detail of impact of running multiple instances for a service.
Implementing Service Discovery
There are several ways to implement service discovery using spring cloud such as Eureka by Netflix. Spring Cloud also provides numerous annotations for easy implementation and hiding complexity.
Client-side Load Balancing
Due to the division of large application into multiple processes, the services are generally deployed as multiple instances for fault tolerance and load sharing. It is, however, difficult to decide the instance to use.
Implementing Client-Side Load Balancing
Netflix Ribbon is one of the most preferred tool across the board for it provides numerous algorithm for Client-Side Load Balancing. Spring Cloud also provides a smart RestTemplate for service discovery and load balancing via @LoadBalanced annotation with RestTemplate instance.
Microservices is a breakthrough architecture in software development. This blog post just provides an overview of the architecture. If you wish to learn more about Microservices, let us in the comments below. Also, let us know your thoughts on the piece.
That’s all from us; until next time!
- Introduction to Microservices
Traditional development methodologies encourage the ‘monolithic’ approach to application development. Building a single application that does everything required has been the modus operandi for a while. However, with the rise…
- Middleware Migration Testing
What is Migration Testing? Migration involves moving an old legacy application to a new platform. Migration testing, thus, involves complete analysis and understanding of the old application to gather requirements…
- Did Technology Dominate this Holiday Season?
It was time to shop and the US citizens did it in style. According to National Retail Federation (NRF), more than 174 million people hit the stores over the 5-day…
- PERL DANCER2
Dancer2 is a more powerful, new generation of Dancer, the lightweight web-framework for Perl. It is a complete rewrite based on Moo and is known as a "micro" web framework,…
- DiP (Storm,Spark,Flink and Apex) Co-Dev opportunity
Real time data ingestion using Data Ingestion Platform (DiP) which harness the powers of Apache Apex, Apache Flink, Apache Spark and Apache Storm to give real time data ingestion and visualization. DiP…
- Packaging Web Applications into Dockers, for AWS Containerized Deployments
Overview and Benefits Packing applications into Docker containers allows developer to quickly deploy an application with all its dependencies, which are bundled into a single container and deployed anywhere without…