It is a very familiar scenario. You want to stay competitive and agile, you want your company to be able to quickly react to the changes that happen around you but your systems and applications which were once “cutting-edge” slowly turn into monolithic legacy applications. You have spent years and decades testing and building those systems and applications and they serve you well. You cannot get rid of them and start from scratch. Your attempts at agile development and delivery flounder. Your application becomes too large for a developer to fully understand. Fixing bugs and implementation of new features becomes difficult, risky and time consuming. So what do you do? How do you adopt the latest lean development practices without the risk and cost of re-platforming? You go for Microservices which are based on serverless architecture.
You break your system piece by piece and replace it with Microservices overtime. The architecture is split into multiple components. When failures occur, Microservices rapidly compose user-experience from discrete atomic units. Microservices are emerging as an architectural design pattern that provide agility and scalability to applications with the help of cloud technology and cloud platform. Today’s customer needs flexibility, agility, speed and reliability, Microservices serve him well.
All kinds of applications can be designed or re-designed as Microservices. Currently browser based applications as Microservices are gaining popularity. The assumption that containers and Microservices are suitable only for designing new applications is not correct. As we have seen earlier – legacy applications, the monoliths can also be re-factored as Microservices.
So What Exactly Are Microservices?
According to Renowned author, software consultant and speaker Martin Fowler, “The Microservice architectural style is an approach to developing 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.”
In simple words, Microservices are a set of small, independent, composable services-each one of which can be accessed with RESTful APIs. This architectural style de-constructs business processes to their most basic level by creating small, separate processes that then replace large, single applications. Breaking a system into smaller parts allows each Microservice to focus on a single business capability. Microservices however cannot live alone. They are a part of the larger system. They work alongside other microservices to accomplish the tasks normally handled by one large standalone monolith application. They communicate with each other via remote procedure calls (RPCs) which are designed to look and behave like local procedure calls. Microservices make applications easier to develop and maintain. You can put smaller teams on individual tasks. How else Microservices help? Let’s find out.
#1 Enables Independent Release
There are different components running the whole system and different development teams work on different parts of the system. In a monolithic system you cannot deploy a component separately. With container technology and Microservices approach to architecture you can have independent releases and deployment of components. Each service of the component can evolve as fast as the market requires and can be tested and deployed quickly too. Each service can be developed by a team that is focused on that service. Developers have a choice to use the technology that suits them best.
In monolithic applications for every change in application you have to test the entire application which takes a lot of time and effort. With Microservices, you can test smaller bits of codes and have shorter release cycles as there is no cascading schedules problem. The Microservices Architecture makes continuous deployment possible.
#2 Decreases Development Cost
You remove the business logic and data logic from your application and replace it with a set of modules of code that are built and deployed as independent entities and are re-usable. You complement this Microservices architecture with user-interface which is converted into modular purpose built components. This service based approach to application architecture ensures there is one copy of application logic for a capability regardless of the number of applications leveraging that logic. Overtime this approach decreases development cost and you are agile – you reach your customers faster. If you need to repair, rebuild or upgrade a Microservice, you do not need to rebuild the entire application. You can simply work on the part that needs it and fit it right back into the application.
#3 Outages Don’t Bring Down The Whole System
Microservices are built and deployed independently and are resilient. Outages are contained. Outage in one area doesn’t shut down all your processes. In fact, you can continue providing services to your clients through an outage. The application automatically reacts to control the damage. Your clients will not suspect the loss in functionality.
In monolithic applications all modules run within the same process. If any module gets affected by a bug, as all instances of the application are identical, the affected module brings down the whole process.
#4 Easy To Scale
Different components in an application have different needs. Some functionalities need more memory some require more computational resources. Some may need database access, third party services or increased network bandwidth. With Microservices architecture you can put components in appropriate environment which allows them to scale properly when needed. In case of surges you don’t need to scale up the entire application. You can simply scale up the processes experiencing the surge. Ready availability of infrastructure, due to clouds enables you to do that effortlessly.
Thus, with Microservices Architecture each service can be scaled independently. You are free to choose the hardware that best matches a service’s resource requirement. You can deploy an in-memory database service on EC2 Memory optimized instances or a CPU intensive image processing service on EC2 compute optimized instances.
#5 Offers Language And Platform Freedom
Microservices give you the freedom to use the best OS, languages, runtimes and libraries for the job. You can easily implement your chat Microservice in Node.js; you can write the web API in Django and Python; your image manipulation service can be in Java, and you could implement your web front end with Ruby on Rails. Each service should expose a well-defined interface which is consistent with other services and that is enough. The interface can be implemented using the most optimal technology stack. The most common methods for communication between Microservices are HTTP and messaging.
Unlike in monolithic application where a single database schema is shared with other services, in Microservices Architecture pattern each service has its own database schema. This enables loose coupling. Each service can use a database that is best suited to its needs.
Many organizations like Amazon, Twitter, Uber, eBay and Netflix have adopted Microservices Architecture pattern. Microservices architecture pattern is best for complex evolving applications. It helps in scaling up the application both horizontally and vertically. Industry pundits see Microservices as a fundamental technology shift- an evolutionary step. In many ways it is. Adopting Microservices architecture, however whether from ground up or by splitting a monolithic application is not easy for developers. It comes with its own challenges. If you are migrating from a legacy software, don’t chuck the old one out. It is best to have multiple versions – keep the old one running while you slowly but efficiently work on the Microservices version. You have to understand, a successful migration from a big monolith to Microservices can take years. Ultimately it depends on you and your application. You now have the option of deriving utility and value from this innovative way of structuring your application.
And that is all from my desk for now. Until next time, Adios.