Microservice is an architectural style in which large, complex software applications are composed in one or more smaller services.
What is Microservice Architecture?
Microservice architecture is based around the idea that several small, independently deployable software systems are easier to create and maintain than a single large software system. To begin understanding microservice architecture, it helps to consider its opposite the monolithic architectural style. Monolith application is always built as a single, autonomous unit. The problem with a monolithic architecture, though, is that all change cycles usually end up being tied to one another. In Microservices, Each of service constitutes of a single business function and execute only that business function very well.
Considerations of Microservices:
- Loosely Coupled: You must be able to deploy a single microservice independently.
- Small & Focused: Microservices need to focus on a unit of work and are small.However, there are no rules on how small a microservice must be.
- Language Neutral: Microservices do not need to be written using the same/specific programming language.
- Bounded Context: Particular microservice does not “know” anything about underlying implementation of other microservices surrounding it.
Microservices vs monolithic architectures
- A single code base for the entire application.
- Complex deployments with maintenance windows and scheduled downtimes.
- Requires you to scale the entire application even though bottlenecks are localized.
- Multiple code bases. Each microservice has its own code base.
- Simple deployment as each microservice can be deployed individually, with minimal if not zero downtime.
- Enables you to scale bottle-necked services without scaling the entire application.
Service-Oriented Architecture (SOA) vs. Microservices
Service-Oriented Architecture (SOA) is suited for:
- Large distributed system
- Overall business transformation
- Large scope spanning multiple system
Microservices are suited for:
- A single distributed system
- Accelerated realization of benefits
- Specilization of SOA
Microservice Pros and Cons
- Microservice architecture gives developers the freedom to independently develop and deploy services.
- Code for different services can be written in different languages.
- The developers can make use of the latest technologies of choice.
- Starts the web container more quickly, so the deployment is also faster.
- No long-term commitment to a technology stack.
- Due to distributed deployment, testing can become complicated , leads to duplication of effort and is slightly tedious.
- When number of services increases, integration and managing complete products can become complicated.
- Developers have to put additional effort into implementing the mechanism of communication between the services.
Are Microservices the Future?
By taking the time to do this we clearly think that the microservices architectural style is an important idea – one worth serious consideration for enterprise applications. Amazon, Netflix, The Guardian, the UK Government Digital Service, realestate.com.au, Forward, comparethemarket.com and many other large-scale websites and applications have all evolved from monolithic to microservices architecture and many more are adopting this trend.