Microservices

Microservices are a software development technique, a variant of the Service Oriented Architecture (SOA) architectural style that structures an application as a collection of loosely coupled services. Each service is self-contained and implements a single business capability. Services are fine-grained and the protocols are lightweight. The benefit of decomposing an application into different smaller services is that it improves modularity. The microservice architecture enables the continuous delivery/deployment of large, complex applications and also enables an organisation to evolve its technology stack.

Why Microservices?
Microservices focus on a single business domain that can be implemented as fully independent deployable services and implement them on different technology stacks.The architecture that prevailed before microservices i.e. the Monolithic Architecture.

Challenges of Monolithic Architecture:
InflexibleMonolithic applications cannot be built using different technologies.
UnreliableEven if one feature of the system does not work, then the entire system does not work. 
Unscalable:
 Applications cannot be scaled easily since each time the application needs to be updated, the complete system has to be rebuilt.
Blocks Continuous Development
:  Many features of the applications cannot be built and deployed at the same time.
Slow Development
: Development in monolithic applications take lot of time to be built since each and every feature has to be built one after the other.
Not Fit For Complex Applications: Features of complex applications have tightly coupled dependencies.

Microservice Architecture:

microservice-architecture
 Different clients from different devices try to use different services like search, build, configure and other management capabilities.
 All the services are separated based on their domains and functionalities and are further allotted to individual microservices.
 These microservices have their own load balancer and execution environment to execute their functionalities & at the same time captures data in their own databases.
 All the microservices communicate with each other through a stateless server which is
either REST or Message Bus.
 Microservices know their path of communication with the help of Service Discovery and perform operational capabilities such as automation, monitoring.
 Then all the functionalities performed by microservices are communicated to clients via API Gateway.
 All the internal points are connected from the API Gateway. So, anybody who connects to the API Gateway automatically gets connected to the complete system.

How Does Microservice Architecture Work?
A typical Microservice Architecture (MSA) should consist of the following components.
 Clients
 Identity Providers
 API Gateway
 Messaging Formats
 Databases
 Static Content
 Management
 Service Discovery
mirco_service_architech


Microservices Features:

Decoupling: Services within a system are largely decoupled. So the application as a whole can be easily built, altered, and scaled.
Componentization: Microservices are treated as independent components that can be easily replaced and upgraded.
Business Capabilities: Microservices are very simple and focus on a single capability.
Autonomy: Developers and teams can work independently of each other, thus increasing speed.
Continuous Delivery: Allows frequent releases of software, through systematic automation of software creation, testing, and approval.
Responsibility: Microservices do not focus on applications as projects. Instead, they treat applications as products for which they are responsible.
 Decentralised Governance: The focus is on using the right tool for the right job. That means there is no standardised pattern or any technology pattern. Developers have the freedom to choose the best useful tools to solve their problems.
Agility: Microservices support agile development. Any new feature can be quickly developed and discarded again.

Advantages of Microservices:
Independent Development: All microservices can be easily developed based on their individual functionality.
Independent Deployment: Based on their services, they can be individually deployed in any application.
Fault Isolation: Even if one service of the application does not work, the system still continues to function.
Mixed Technology Stack: Different languages and technologies can be used to build different services of the same application.
Granular Scaling: Individual components can scale as per need, there is no need to scale all components together

REST Vs Microservice:
REST, or REpresentational State Transfer was first introduced in 2000, primarily designed to work well with HTTP/1.1, It is an architectural style for providing standards between apps and systems, making it easier for systems to communicate with each other. REST-compliant systems, often called RESTful systems.

Its core principle is to define named resources that can be manipulated using a small number of methods. The resources and methods are known as nouns and verbs of APIs. With the HTTP protocol, the resource names naturally map to URLs, and methods naturally map to HTTP methods POST, GET, PUT, PATCH, and DELETE. REST is a way to implement Microservices. You can implement Microservices in
multiple ways.
Statelessness – Endpoint has no state. Ideally endpoints are idempotent – which means that for input X you will always get.
CRUD – In REST we use HTTP request types to identify individual CRUD operations
Resources – Resources are the way restful services are organised. Resources are nouns (things) that exist in service and can be operated by verbs.

Microservice Architecture
– Defines that overall solution (application, product) should be split into multiple services, that interact with each other. It is essentially a way to structure a large piece of software  by producing a suite of smaller applications that can all work together if needed.

Pros & Cons of Microservices:
pros_cons

Design a site like this with WordPress.com
Get started