| Nov 05, 2020

5 MIN READ

Written by Deepti Dilip J
Microservices from scratch

Back to basics: Microservices – What, Why and How

What is Microservices?

Microservices – also known as the microservice architecture – is a technique that gives today’s developers a way to design highly scalable, flexible applications by disintegrating the application into isolated services that implement specific business functions. A microservice architecture enables swift, recurrent and dependable delivery of large, complex applications. Furthermore, it helps an enterprise to evolve its technology stack.
Many organizations, such as Amazon, eBay, and Netflix, have adopted the Microservices Architecture pattern. Instead of building a single monstrous, monolithic application, the application is split into set of smaller, interconnected services.

This architectural style structures an application as a collection of services that are:

  • Loosely coupled
  • Highly maintainable and testable
  • Independently deployable
  • Organized around business capabilities – making it efficient
  • Owned by small teams

The upside being – these services can then be built, deployed, and scaled independently. With each service having a limited functionality, it tends to be much smaller in size and complexity.
Each of these services is assigned to discrete tasks and is capable of communicating with other services, through simple APIs (application programming interface) – aiding to solve larger complex business issues. This surpasses the systems that were built as monolithic structures, where services were inseparably interconnected and could only be scaled together or not at all.

The term Microservice stands for the discrete functionality design it provides and not its physical size.

Why Microservices?

The Microservices architecture is gaining momentum because of its modular qualities which lead to flexibility, scalability, and reduced development efforts. Thanks to its deployment flexibility, and the rise of cloud-native server-less and function-as-a-service deployment options, microservices is the perfect choice in today’s IT landscape. A cloud platform enables microservices and functions to scale from inactivity to high volume and low again – ensuring organisations or customers pay only for the compute capacity they use up.
With so many enterprises constantly looking to be more cost efficient, agile, improve application delivery times with reduced bottlenecks, the microservices architecture continues to climb the popularity charts.
Top benefits of Microservices:

  • Vastly scalable applications can be built
  • Individual continuous development and deployment streams can be sustained
  • Isolation and loose-coupling enables compartmentalized upgrades and enhancements
  • Use of cloud-native function-as-a-service deployment options is possible
  • Lower operational costs

Additionally, how it helps:
Teams: Since the component services are small, they can be built by one or more small teams right from the start separated by service boundaries, making it easier to scale up the development effort, as needed.
Post development: these services can also be deployed independently of each other and hence it’s easy to identify hot services and scale them independently within the entire application.
Fault isolation: In case of an error in any of the services, the whole application doesn’t need to stop functioning. Once the error is fixed, it can be deployed just for the respective service instead of redeploying the entire application. Making it so much more efficient for the teams involved.
Choice of technology stack: Microservices architecture helps in particularized choosing of the technology stack (programming languages, databases, etc.) that is best suited for the required functionality. Helping enterprise teams to not get compelled into taking one-size-fits-all approach.
Creating more secure functionality: It also brings distinct security advantages to IoT and edge computing initiatives. Microservices can be designed to minimize their attack surface by running only specific functions and running them only when needed, so fewer unused functions remain ‘live’ and therefore attackable.

What are the Microservices Architecture use cases?

  • 1. Adopt cloud-native deployment options: leverage serverless and function-as-a-service for more efficient and scalable operations
  • 2. Migrate functionality from legacy applications: decompose services from large monolithic applications so they can be independently maintained and scaled
  • 3. Leverage modern application architecture: embrace event-driven, loosely-coupled microservice application patterns, with the ability to leverage different programming languages depending on use case needs. For example, go for computationally heavy functions, Node.js for quick web apps, etc.
  • 4. Enabling Edge computing: With the upsurge of IoT and 5G in the coming times, there will be a massive amount of data generated. Sending all data to one central server make lesser sense. Localized decisions need localized processing and hence a greater need for microservices in the edge computing environment. Many of the DevOps practices would also be applicable to Edge-Microservices architecture.

Microservices are more viable now due to the advancements in containerization technologies. With Containers, enterprise teams can run multiple parts of an app independently, on the same hardware, with much greater control over their individual pieces and life cycles. Along with APIs and DevOps teams, containerized microservices are the foundation for cloud-native applications.

How to get started?

Identify the business capabilities needed, post which, the required services can be built consequent to each of these business capabilities.
Each service is best owned by a different team – outlining an expert in particular domains and in technologies best suited for those particular services. Thus, it leads to more stable API boundaries and stable teams.
Microservices are frequently combined with some form of containerization, and most of the management tools for services are centred on managing and scaling containers. Common management tools like Kubernetes and Docker Swarm are designed with microservices in mind.

Deploying microservices is often one of the most challenging aspects of switching over from a monolithic architecture, because it requires taking into account API versions and integration testing across multiple domains. As such, automated monitoring is critical to microservices deployment to ensure that each component is working smoothly. Partial failures in microservices applications are much more common than in monoliths, and the system needs to be designed with fault management in mind.
There are well-known platforms such as NGINX Plus which are designed to provide the speed, configurability, and reliability that’s essential to modern microservices architectures. Microservices benefit greatly from an API gateway like NGINX or NGINX Plus, which provides a lightweight entry point for service communication. Also, it is the most widely deployed Ingress controller bringing its lightweight delivery model to the infrastructure required by microservices and allowing organizations to properly support and secure their modern applications at scale.

Why global enterprises use NGINX Plus for Microservices


Use the guidance in this e-book about building microservices to learn what a microservice is, and why you might need a microservices architecture to make your applications faster, more flexible, and more stable.

Well-known examples of Microservices

Netflix, which is a very popular video streaming service that’s responsible for up to 30% of Internet traffic, has a large scale, service-oriented architecture. It receives more than one billion calls every day, from more than 800 different types of devices, to its streaming-video API.  Each API call then prompts around five additional calls to the backend service.
Amazon originally had a two-tier architecture. In order to scale they migrated to a service-oriented architecture consisting of hundreds of backend services. They get countless calls from a variety of applications—including applications that manage the web service API as well as the website itself—which would have been simply impossible for their old, two-tiered architecture to handle.
The auction site is another example that has gone through a similar transition. Their core application comprises several autonomous applications, with each one executing the business logic for different function areas.
Uber, Groupon, Sound Cloud, Gilt, Comcast Cable are some more companies that adopted the microservices architecture.
The critical question is why you’d want to use a microservice-based infrastructure. Simply put, the goal is to deliver quality software, faster. Today, a microservice architecture is the ‘new normal’.