Why Micro Service Architecture?

Why Micro Service Architecture?

Micro-service architectures make applications easier to scale and faster to develop, and accelerating time-to-market for new feature

Introduction

Hi, Folks I'm so excited to share my thoughts on the need for microservice architecture in 2023. I hope you'll find something that resonates with you. So sit back, grab a cup of coffee, and dive in!

Pre-requisites

Before getting into the actual topic today, we need to be clear on some traditional software architecture then only we can understand the micro-service architecture in a better way.

What is monolithic architecture?

A monolithic architecture is a traditional model of a software program, which is built as a unified unit that is self-contained and independent from other applications. The word “monolith” is often attributed to something large and glacial, which isn’t far from the truth of a monolith architecture for software design.

In this traditional architecture when a business grows the code base will become harder to maintain & Scale. But, it really suits small & medium size projects.

Advantages of a monolithic architecture

The primary advantage is fast development speed due to the simplicity of having an application based on one code base.

  • Easy deployment

  • Simplified testing

  • Easy debugging

Disadvantages of a monolithic architecture

Making a small change in a single function requires compiling and testing the entire platform & scalability is a primary disadvantage of a monolithic architecture.

  • Slower development speed

  • Scalability

  • Reliability

  • Lack of flexibility

In layman terms

Think of it like a large, monolithic building that houses different functions and activities. For example, a mall might have different stores, restaurants, and entertainment venues, but they are all located within the same building. In the same way, a monolithic software application has different components that all work together, but they are all part of the same codebase.

I hope now you have a clear idea about traditional monolith architecture.

What are Microservices?

Microservices are an architectural and organizational approach to software development where software is composed of small independent services that communicate over well-defined APIs. These services are owned by small, self-contained teams.

With monolithic architectures, all processes are tightly coupled and run as a single service. This means that if one process of the application experiences a spike in demand, the entire architecture must be scaled.

But with a microservices architecture, an application is built as independent components that run each application process as a service. These services communicate via a well-defined interface using lightweight APIs.

Micro-service In layman's terms

Think of it like a group of individual buildings that make up a city. Each building serves a specific purpose, such as a store, a restaurant, or a park. In the same way, each microservice performs a specific function or task within the larger application.

For example, one microservice might handle user authentication, while another might handle payment processing. These microservices communicate with each other through well-defined interfaces, allowing them to work together seamlessly to provide a complete application.

Advantages of microservices

This architecture solves a number of problems for growing software and companies. Since a microservices architecture consists of units that run independently, each service can be developed, updated, deployed, and scaled without affecting the other services.

  • Agility

  • Flexible scaling

  • Highly maintainable and testable

  • High reliability

  • Technology flexibility

Disadvantages of microservices

When we moved from a small number of monolithic codebases to many more distributed systems and services powering our products, unintended complexity arose. So, these advantages come with some cost & complexity.

It can be challenging to determine how different components relate to each other, who owns a particular software component, or how to avoid interfering with dependent components.

  • Debugging challenges

  • Lack of standardization

  • Exponential infrastructure costs

When to use Micro-service architecture?

Each architectural constraint has its own associated challenges/benefits, so it’s important to understand and balance both. Before adopting any style of architecture, you have to ask yourself if the benefits outweigh the challenges for the application you are considering.

In the table below, we take a look at the benefits versus challenges of microservice-style applications.

Benefits

Challenges

Enables the continuous delivery and deployment of large, complex applications.

There is additional complexity in creating a distributed system.

Improved maintainability: Each service is relatively small so it’s easier to understand and change.

Implementing requests that span multiple services is more difficult. Maintaining data consistency between service(s) is a challenge.

Better Testability: services are smaller and faster to test.

Testing the interactions between services is more difficult.

Better deployability: services can be deployed independently.

Increased operational and deployment complexity of deploying and managing a system comprised of many different services.

Each team can develop, test, deploy, and scale its services independently of all of the other teams.

Implementing requests that span multiple services requires careful coordination between the teams.

Improved fault isolation.

Inter-service communication and dealing with partial failure implementation is challenging.

Eliminates long-term commitment to a technology stack.

The overhead of multiple JVM runtimes (or equivalent) and the increase in memory consumption need to be taken care of

Conclusion

In conclusion, microservices architecture can offer a range of benefits for modern software applications, from improved scalability and flexibility to increased resilience and faster development cycles. While it may require more planning and coordination than a monolithic architecture, the rewards can be well worth the effort. If you're interested in learning more about microservices, be sure to check out some of the resources we've linked to in this post. And remember, when it comes to designing software applications, choosing the right architecture is key to success

Did you find this article valuable?

Support Saravana Sai by becoming a sponsor. Any amount is appreciated!