Microservices Simplified

A Beginner’s Guide to Microservices Architecture

Hadi Soufan
Tech Blog
5 min readOct 14, 2023

--

Photo by Alex Kotliarskyi on Unsplash

Microservices architecture is a key concept for developing real-time enterprise-based applications. It’s a way of structuring software systems that has recently gained immense popularity. In this article, we’ll break down the fundamentals of microservices and how they differ from traditional monolithic architecture.

What are Microservices?

Microservices are all about breaking down complex applications into smaller, independent service units. These units are like building blocks, each designed for a specific function. The idea is to create well-defined interfaces for these units, allowing them to be independently deployed and operated by small teams.

Before the era of microservices, there was the monolithic architecture. Think of this as a big container where all the components of an application are bundled into one package.

The Magic of Microservices

Microservices allow you to separate functionalities. Instead of dealing with a massive application, you work on smaller, more manageable modules. “Micro” in microservices refers to the manageable size of these service units, typically handled by a single development team. This architectural approach streamlines app development, especially for cloud-native models. It also enables a modularized pace of development where small teams can iterate and maintain the software easily.

The result? Faster development, efficient handling of changes, and smoother troubleshooting after deployment.

Advantages

Microservices offer several advantages:

  1. Faster Development: You develop smaller, independent modules instead of building one large application.
  2. High Scalability: Small modules can be independently deployed and operated, making robustness and scalability easier.
  3. Resilience and Reusability: Each module is self-sufficient, fostering reusability.
  4. Easy Deployment: If you need to modify or change one module out of many, you don’t have to deploy the whole application — just the specific module.
  5. Accessibility for Development: Small modules accelerate development, and small teams can manage modular programming.

Microservices’ Principles

Image Reference: https://uploads-ssl.webflow.com

To make the most of microservices, you need to follow certain principles. These principles are essential to the success of a microservices architecture:

  1. Domain-Based Model: Microservices let you separate system capabilities into different domains, each focusing on its logic. This promotes independent module migration and scaling as needed.
  2. Automation Culture: Given the increased number of deployment units compared to monolithic architecture, automation is key. Design your system for continuous integration and continuous delivery.
  3. High Implementation Details: Microservices should hide internal details, reducing coupling and allowing changes and improvements without affecting the overall architecture.
  4. Decentralization: Each microservice manages its own database, promoting decentralization.
  5. Independent Deployment: For the architecture to work optimally, microservices should be independently deployable. Any coupling should be addressed.
  6. Failure in Isolation: Microservices architecture is less impacted by failures compared to monolithic systems, as a failure typically affects only one service.
  7. High Observability: Microservices should collect information for analysis, such as logs, events, and statistics, to facilitate monitoring.

Architecture

  1. Management: Maintains the nodes for the service
  2. Identity Provider: Manages the identity information and provides authentication service within a distributed network.
  3. Service Discovery: keeps track of the services and service addresses and endpoints.
  4. API Gateway: Service a client’s entry point. Single point of contact from the client which is turn return responses from underlying microservices.
  5. CDN: content delivery network to serve static resources (e.g., CSS, JavaScript, Images…).
  6. Static Content: The static resources which are visible over the client iteration which are the html pages or ant web content you want to display and iterate across it.
Image Reference: https://www.futurefundamentals.com

In the microservices architecture, a client’s request follows a structured path. First, it goes through the identity provider for authentication and authorization checks. Then, it proceeds through the API gateway, which grants access to third-party APIs and provides them to the services.

Within the microservices framework, the core building blocks are small individual modules known as services, designed for reusability. Any incoming request at the API gateway serves as a specific service and is forwarded to the corresponding remote service. Subsequently, when a response is generated, any static content or Content Delivery Network (CDN) links intended for your web pages, such as jQuery Bootstrap, images, fonts, and icons, are included in the client’s response via this API Gateway.

This approach defines how the microservices architecture functions in a service-oriented style. It emphasizes individuality rather than grouping, which significantly streamlines application development, deployment, and maintenance. While some still opt for monolithic architecture, the trend is shifting towards microservices. The benefits of microservices, including enhanced agility, improved workflow, and accelerated production cycles, make it a more appealing choice. Even though each independent component increases system complexity, it simultaneously allows for enhanced monitoring capabilities, setting microservices apart as the preferred architecture over monolithic alternatives.

E-Commerce Case Study: Monolithic VS. Microservices

Image Reference: https://www.guru99.com

Considering an example of e-commerce application developed with microservice architecture, in the microservice architecture, each microservice is focused on a single business capability, like a search, payment, review, and settings. What happens is, the moment we develop a monolithic architecture, all the components coalesce into a single module, but in microservices architecture, they are spread into individual modules which communicate each other as iterated in the next diagram.

Image Reference: https://www.guru99.com

Here you can see that in the case of microservices, the communication between the microservices is stateless communication where each pair of requests and response is independent. What happens is the moment we convert this into the microservices architecture, this iteration will be converted into these modules, and each module will be independent of the other. What will happen is each search, payment, review, and rating will be an individual unit rather than a single unit. Any component can communicate with each other, and UI microservice can access a particular component, making the integration lightweight because all the modules or components will not be loaded in one go. This is how monolithic architecture differs from microservice architecture in real-time.

Summary

To sum up, microservices mark a dramatic change in the way we create and administer applications. They encourage efficiency, flexibility, and agility in the software development process. Adopting the tenets and benefits of microservices may be essential to staying competitive as the digital world develops further.

--

--

Hadi Soufan
Tech Blog

Full Stack Web Developer | Computing and Programming