Sunday, September 3, 2017

What is Microservices Architecture?

Since everything changes in the digital world, software applications developing techniques are also changing day by day. Microservices Architecture is a software development method which is a variant of the service-oriented architecture (SOA) architectural style.



Microservices Architecture contains collection of
  • loosely coupled 
  • independently deployable
  • small
  • modular services

      Each service runs a unique process and communicates through a well-defined mechanism to achieve a specific goal. Those communication methods are changing according to the application’s requirement. But most of the time communication method will be HTTP/REST with JSON or Protobuf (Protobuf is a Google’s extensible mechanism which used to serialize structured data).

Difference between Monolithic Architecture and Service Oriented Architecture


Microservices Architecture is a variant of Service Oriented Architecture and it is really easy to understand what is Microservices Architecture when it is compared with Monolithic Architecture.

Monolithic Architecture


A monolithic architecture is the traditional unified model for the design of a software program. Under that architecture, software is built as a single, autonomous unit. When we used monolithic architecture to implement the client-server model, the server-side application is a monolith which handles the client’s HTTP requests, executes logic, and do CRUD operations with the underlying database. 

The problem regards with this architecture is when it is needed to modify a small section of an application, it might require build and deploy an entirely new version of the existing system. Because components are heavily coupled.

Drawbacks of Monolithic Architecture

  • Continuous deployment is difficult
  • Requires a long-term commitment to a technology stack
  • Scaling the application can be difficult  
To resolve those problems Service Oriented Architecture comes to software applications developing techniques. 

Service Oriented Architecture


In service oriented architecture, the whole system can be considered as a collection of services. A service is a discrete unit of functionality that can be accessed remotely and acted upon and updated independently. Each service communicates with each other through a communication protocol over a network.

Advantages of Service Oriented Architecture

  •          Data confidentiality and integrity
  •         Ability to adapt quickly to different external environments
  •         Ability to optimize performance, functionality, and cost
  •        Ability to scale operations to meet different demand levels 

Service Oriented Architecture(SOA) Vs Microservices Architecture(MA)


Microservices Architecture bears a number of similarities of Service Oriented Architecture. But there is a distinct difference between them.

The SOA model Microservices Architecture Model
Use more dependent enterprise service buses
Uses faster-messaging mechanisms
Focuses on imperative programming paradigm Use responsive-actor programming paradigm
Use relational database Use NoSQL or micro-SQL databases



Let's consider the implementation of an e-commerce application using Microservices Architecture. Imagine that e-commerce application consists of several components.


Those are
  • The user interface which is used by users to interact with the system
  • Backend services for checking credit, delivering orders and other logical services
  • Several databases which consist of data related to e-commerce application

The application consists of a set of services and the architecture of e-commerce application can be illustrated as follows.



Benefits of Microservices Architecture

  • Each service is relatively small
  • The developer can easily understand the structure of the system
  • Can eliminate any long-term commitment to a technology stack. So the development of a new service can do using a new technology stack
  • Each service can be developed and deployed independently. So it is easier to deploy new versions of services frequently
  • Easy to scale development
  • Fault isolation

Drawbacks of Microservices Architecture

  • Increase memory consumption
  • Complexity of deployment 

Summary

Implementation of complex applications is really difficult. A monolithic architecture can be used to implement simple, lightweight applications. But it is not a good practice to use monolithic architecture to implement complex applications. The microservices architecture pattern is the better choice for complex, evolving applications despite the drawbacks and implementation challenges.

If you like this post, spread by sharing it on social media. Thank you! 

No comments:

Post a Comment

How to send Slack notification using a Python script?

 In this article,  I am focussing on sending Slack notifications periodically based on the records in the database. Suppose we have to monit...