Rajendran Balakrishnan, Senior Manager-QA, Ness Digital Engineering, provide insights into the key principles to remember while designing a microservices-based enterprise application.
In the Enterprise application technology front, we have multiple trends that are forcing application architectures to be modernized on a newer platform with a long-term futuristic vision. The new modern platform offers versatility in terms of an application’s scalability and high availability and remains Agile in terms of adaptability. Application users expect a rich, interactive and dynamic user experience on a wide variety of services, including mobile devices.
With the everchanging business models and service offerings, organizations often seek to roll out updates at regular frequency, sometimes even multiple times a day. This requirement for fast roll out of updates is not easy to be fulfilled with a monolithic design which has tightly coupled architecture and infrastructure. Today, microservices architecture has emerged as a solution to have the desired changes rolled out to applications in terms of availability, scalability, and agility.
‘Microservices’ describes a way of designing software applications as suites of independently deployable services. It has evolved from traditional service-oriented architecture (SOA) with loose coupling of components to decoupled service components and infrastructure. Microservices are built around business capabilities and are independently deployable by fully automated deployment machinery. The centralized management of these services is minimal, which may be written in different programming languages and might use different data storage technologies.
Microservice is distinct from a SOA. The latter aims at integrating various (business) applications; whereas several microservices belong to one application. In short, the microservice architectural style is an approach to develop a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API.
Key design principles of microservices along with its advantages make it as a desired solution to have a scalable, easy to maintain enterprise application.
Following are key principles to remember while designing a microservices-based enterprise application.
- Domain Driven Design
- Hide Implementation Details
- Failure Isolation
- Continuous Delivery through DevOps Culture
Domain Driven Design
Microservices provide the ability to separate system capability into different domains using Domain Driven Design principles. The primary objective of the domain driven design is to focus on the core domain and the associated logic. This minimizes possibilities of the application getting out of hand. It also nurtures creative collaboration between the DevOps and development teams as both should understand the domain for scaling up.
Hide Implementation Details
Microservices are small services with independent lifecycles that work together as a part of the whole application. However, each service can be independent when it has to be a part of the big structure. To enhance the ability of one service to scale independently of the others, it is important to hide each service implementation details. We could use REST protocol over HTTP and ensure services communicate with each other using a light-weight communication. Through this segregation of internal and external implementation, details can be achieved.
Monolithic implementations usually have a single logical database for persistent data across a range of applications. It becomes complex to changes over a period of time. With microservices, each service can manage its own database, either different instances of the same database technology, or entirely different database systems.
A microservice based structure is more resistant compared to the monolithic structure. For example, a malfunctioning microservice, such as with a memory leak or unclosed database connections, will only affect that service while other services continue to handle requests. In case of a monolithic application, one malfunctioning component can bring down the entire system.
Continuous Delivery through DevOps Culture
In classical monolith-based environments, there aren’t multiple separate release artifacts, so it’s relatively easy to maintain the Jenkins build jobs manually. In a microservice architecture, the number of deployment units increase and an automated solution is needed. This can be achieved through automating the build and deploy process through tools like Jenkins or CHEF by having a DevOps team. Microservices help to reduce the number of Jenkins jobs to one job for each release artifact, which is able to build, release and deploy the application/desired microservice.
Advantage of Microservices Architecture
- Relatively small components/services
- Easier for a developer to understand
- Application starts faster
- Speeds up deployments
- Each service can be deployed independently of other services
- Easier to scale development
- Enables the ability to organize the development effort around multiple teams
- Each team can develop, deploy and scale their services independently of other teams
- Any fault in one service will only impact that one — other services will continue to handle requests
- A microservice can scale independently using X-axis cloning and Z-axis partitioning based upon their need
- No long-term commitment to any stack
- Technology agnostic services
- It enables rewriting the service using better languages and technologies
Today, microservices architecture has been successfully embraced by leading players in different domains and has been deployed for scaling their business and operations seamlessly. Many big names have evolved from a monolithic architecture to a microservices architecture.