Benefits and Challenges of Adopting Microservices Architecture
Despite challenges like monitoring and debugging, adopting microservices makes for faster, more scalable builds and deployments.
Join the DZone community and get the full member experience.Join For Free
For several years, monolithic architecture has been the widely-used architecture for building web and mobile applications. These applications were mostly characterized by individual programs handling multiple functionalities. Though monolithic applications were known to be easier to operate, as the systems grew bigger, they introduced complexity for both the coding and deployment stages of software development life cycle. Single point of failure, technology lock-in, and limited scalability are a few other drawbacks of monolithic applications.
In the recent past, microservice architecture has evolved as a paradigm shift in decomposing large monolithic applications into smaller manageable pieces with their own code base and deployment infrastructure. Considering practical business applications, multiple microservices are required to fulfill one single use case; still, we can describe microservices as simple and stateless.
In a microservices world, business requirements are divided into independent features and each of them is built as an individual service, loosely coupled when deployed in separate containers. So, microservices are quicker to build and deploy, especially when they are packaged in containers. Microservices can be implemented as small feature as possible, making it easier to release changes without disturbing other parts of the application.
Since services interact over technology agnostic protocols like HTTP, applications could use a mix of technologies that are most suitable for a service. Microservices introduce multiple benefits to applications, like high availability, better flexibility, and responsiveness; however, service level independent scalability has been considered as the most value adding advantage for choosing microservices architecture for applications.
Microservices adoption was costly at the IT operational level; this was mainly due to the cost incurred for deployment, load balancing, process monitoring, and scalability to be established for each of the services. But today, platforms like Docker (containers as a service) and Kubernetes (a container orchestrator) are providing these features as part of their platform. These platforms helped make microservices easily scalable, making it the hot architecture choice for applications.
Just because microservices is the new buzzword in the industry, doesn’t mean that it has no challenges. Here are few of the challenges for adopting microservices architecture.
Microservices use HTTP as the protocol for synchronous communication and multiple service endpoints give hackers more opportunities for system penetration. Hence, it is a challenge to secure microservices-based applications with proper authentication and authorization methods. A solution like Amazon’s AWS API Gateway (single entry point for all requests) is probably the most optimized method for securing microservices.
Another challenge is monitoring and debugging microservices running in a multi-node environment. Distributed tracing solutions from Twittter (ZipKin) and Google (Dapper) have inspired several monitoring solutions for microservices. Opentracing, developed by Uber, Apple, Yelp, and various other big players, is rapidly becoming the de facto standard for microservices tracing. Such tracing tools are capable of tracing microservices across multiple systems to view service maps and identify bottlenecks. The recently announced AWS X-ray by Amazon seems to be a good choice for monitoring applications running on the Amazon cloud infrastructure.
Contrary to monolithic applications, deploying microservices application is a challenge, as there will be multiple services written in a variety of languages and frameworks. The best way to deploy microservices-based applications is inside containers. Serverless technologies like AWS Lambda reduce the deployment complexities by running enough instances of the services to handle requests on demand. In this case, deployment is as simple as uploading the package as a zip file along with metadata; Lambda will take care of the rest.
In summary, applications built using microservices have the benefits of a strong module boundary, independent scalability, and technology diversity. Though this architecture imposes challenges, microservice adoption can be a highly beneficial experience for organizations, provided the right tools and solutions are used to address the operational and security complexities.
Published at DZone with permission of Jaleel Kavungal. See the original article here.
Opinions expressed by DZone contributors are their own.