In the early 2000's, we witnessed the rise of Service Oriented Architecture (SOA), a popular design paradigm for building software.
You might be thinking, why should I care?
In simple words, SOA is a software architecture pattern that allows us to construct large-scale enterprise applications that generally require us to integrate multiple services, each of which is made over different platforms and languages through a common communication mechanism.
Now let's take a look at a case study: an eCommerce store. We know that multiple devices can access most eCommerce sites, so they have various user interfaces for laptop and mobile views.
We also know that multiple operations or services are running with each other to ensure the regular functioning of your eCommerce applications. Some of these services are account creation, displaying product catalog, building and validating your shopping cart, generating bill, order confirmation, payment mechanism and so on.
In a monolithic application, all these services run under a single application layer, so the eCommerce software architecture would look like this:
Drawbacks
- It is evident that the application is going to grow in size with the increase in the number of services offered. This might become overwhelming for developers to build and maintain the application codebase
- Not only is it difficult to update your current stack, but it is a nightmare to change something in that stack
- Every change requires developers to rebuild the entirety of the application, which wastes resources.
- With the increase in the customer base, we will have more requests to process, which will require more resources. Therefore, it is essential to build products that can scale. With monolithic applications, we can scale only in one direction, i.e., vertically but not horizontally. This means we can scale the application over a single machine by adding more hardware resources such as memory and computational power, but it is still going to be a challenge to ensure horizontal scaling, which is spread across multiple machines
"Microservices" to the rescue!
Microservice architecture can be considered to be a specialization of SOA and an alternative pattern that overcomes the drawbacks of a monolithic architecture.
In this architecture, we focus on modularising the application by dividing it into smaller standalone services that can be built, deployed, scaled and even maintained independently of other existing services or the application itself as a whole. These independent services are called microservices, hence the name Microservice Architecture.
Microservice introduces the philosophy of Separation of Concerns and ensures Agile Development of software applications in both simple and complex domains
The standalone ability or independent nature of microservices open doors for following benefits:
- Reduces complexity by allowing developers to break into small teams, each of which builds/maintains one or more services
- Reduces risk by allowing deployment in chunks rather than rebuilding the whole application for every change
- Easy maintenance by allowing flexibility to incrementally update/upgrade the technology stack for one or more services, rather than the entire application in a single point in time
- In addition to giving you the flexibility to build services in any language, thereby making it language independent, it also allows you to maintain separate data models of each of the given services
- You can build a fully automated deployment mechanism for ensuring individual service deployments, service management and autoscaling of the application
Now that we understand the reasons for all the hype around microservices, in the next article, we will take you on a deeper dive to how we leverage these technologies at Noodle Factory and build modern, scalable chatbot with it.