Microservice – Introduction

Since 2017, many corporations have started to roll out “microservices”, which enables many programmers and developers to work on multiple projects within a dock system (AKA closed environment). This enabled the software development and various new smaller projects to be added, which helps address various increasing customers need and improving customer experience. Top companies, Netflix, Amazon, Facebook, Twitter, LinkedIn, Google, utilize microservice to build multiple features for an existing platform program.

 

What is Microservice?

Microservice architectural style is a method to create an application as a set of small services that runs its process and interact with lightweight mechanisms, usually an HTTP resource API.

Microservices, also known as the microservice architecture – is an architectural style that structures an application as a collection of services that are:

  • Highly maintainable and testable
  • Loosely coupled
  • Independently deployable
  • Organized around business capabilities.

The microservice architecture enables the continuous delivery/deployment of large, complex applications. It also enables an organization to evolve its technology stack. Microservice is developed based on business features and deployed independently by an automated deployment machinery. (Source: www.microservice.io)

 

There is less centralized management of Microservices that may be written in various programming languages and utilize diverse data storage technologies. For example, in an e-commerce site, payment service could be written in C++, while order management service could be written in Java.

 

Microservice – How to Understand Simple

Application functionality must be distributed into lightweight, discrete services, where every single service satisfies a particular business-focused interest.

The application is decomposed into microservices based on two categories:

  • Decompose by business capacity: The services are created based on the business capabilities. For example, in Retailer Ecommerce – billing, payment, order management, and promotions are different business capabilities, which could be made into separate services.
  • Decompose by Subdomain:Domain-driven design supports modeling based on the reality of business as akin to use cases. Wrong decomposition could impact at the architectural level.

 

Microservices Application – Types

Applications are broadly classified into two types:

i) Monolithic Architecture, where an application is built as a single unit.

ii) Microservice Architecture, where many applications (microservices) handle a small portion of the functionality and data.

  • A monolithic application is built as a single unit, i.e., one big application in a single language that handles all of the functionality, data, business logic, etc. A load-balancer distributes requests from the end user, across multiple machines, each running one instance of our application.
  • All logic for handling a request runs in a single process, allowing you to utilize the primary features of the language to divide up the application into classes, functions, and namespaces.

 

What is Monolithic Architecture? #Monolithic  

  • A monolithic application is built as a single unit: one big application in a single language that handles all of the functionality, data, business logic, and others. A load-balancer distributes requests from the end user, across multiple machines, each running one instance of our application.
  • All logic for handling a request runs in a single process, allowing you to utilize the primary features of the language to divide up the application into classes, functions, and namespaces.

Advantages of Monolithic Architecture

  1. Faster Initial Development – With one application, it would be relatively easy to add additional features, especially when the application is relatively small.
  2. Little User Confusion -Developers need not have to learn about different applications, but would be focused towards one application.
  3. Improved Integration -Features could integrate with each other well and easily.

Disadvantages of Monolithic Architecture

  1. Single Point of Failure – If any single application function or component fails, then the entire application goes down.
    For example, when a web application with separate functions handling tasks like payment, login, and history; or a function begins to consume more memory or CPU. In this scenario, the entire application will come to a halt. 
  2. Horizontal Scaling – Scaling application can only be accomplished by deploying the same EAR/WAR packages in more servers. Every single copy of the application in different servers will use the same number of primary resources, which is usually not an effective way to design. 
  3. Increasing Code Size with Increasing Application Usage – As application grows, the code base grows with it, which can overload IDE every time it loads the application. This definitely reduces developer productivity. 
  4. Little Iteration & Required To Rebuild Everything – a small change made to any part of the application, requires the entire monolith to be rebuilt and deployed. 
  5. Maintenance Costs – Cost will shoot up exponentially with site size and data usage. 
  6. High Setup-Cost – In order to get each application up and running, as each grows larger, the more difficult this would be.

 

What is Microservice Style? #microservice 

It’s about building applications as suites of services (Modular approach)

  • Each microservice exposes a common API accessed through the network (as opposed to inter-process communication or shared memory on the same machine).
  • API calls are stitched mostly on the server to produce a page, although few of this work is executed by the client querying individual microservices.

For example, large enterprises such as Amazon, Netflix, Uber, Yelp and eBay have adopted Microservices, which is independently deployable, and scalable. Each service offers a secure module boundary, allowing different services to be written in different programming languages.

Advantages of Microservices 

  • Improved fault isolation: Larger applications can remain largely unaffected by the failure of a single module with microservice style adoption.
  • Removes Dependency: Eliminates long-term commitment to any single technology stack.
  • Easy Understanding: With the split of functionality, it gives more room for new developers to understand the functionality of a service and make enhancements easily.
  • Easy Deployment: Microservices-based applications are deployed inside containers providing better management

 

Disadvantages of Microservices 

nodes

  • Complexity – Deploying microservices can be a little complex, requiring coordination among multiple services, which may not be as straightforward as deploying a monolith. #complexity
  • Multiple DBs – Managing multiple databases and transaction management could be painful. #largeDB #database
  • Testing – Testing could be little cumbersome, as each dependent service needs to be confirmed before one can start testing. #multipletesting
  • Coordination – Handling requests across multiple independent services requires proper workflow management. There can be a scenario where one of the services may not be responding or remote calls experiencing latency.

 

Although microservices are difficult to implement or manage, the benefits of adapting the microservices out weighs the monolithic architecture and many large enterprises utilize them, including UBER, Amazon, Ebay, Yelp, Soundcloud, and Netflix.

Keywords: #monolithicarchitecture #microservices #applications #Microservices #innovation #docker #complexity #IT #InformationTechnology #google #facebook #twitter #Uber

 

Written Date: 1/24/2019 – 7:31PM

 

Advertisements