What is a microservice?

Microservice is a architectural change in software application development where application is separated into services. Each service is small independenent application responsible for specific functionality.These services communicated with each other through API’s.

Micro servie advantages

Indendent Service: Whole applicpation is split into independent services, helps

Can be written in any Language

Characteristics

✅ Single responsibility

Each service is designed to handle a specific business functionality. It follows Single responsiblity principle from SOLID Design principle. The service can not be design based on code modularity or complexity, but it designed as per business domain service.

For example, In ecommerice application, You can not design users details as a User Service, Instead, can be split into authentication service(login/register/logout) and user detail service

✅ Loosely Coupled

✅ Technology independent

Each Service can be written with different programming languages, frameworks. Team can not dependents on single technology stack or technologie

In Ecommerce application, You can write service in Python, Java, GO lang etc.

NodeJS for real time API’s applications added with Redis for faster reads Python for big data analytics and processing Java for transaction heavy processing Go language for notifications with lightweight and throughtput messaging

This helps development teams can works on different parts of the application at the same time, and improves developer productivity

Microservices Architecture: Core Components

  • API Gateway

Communication protocals

Each services communicate to other services using below protocols

  • Synchronous: The client sends a request to an services, waits for a response, In this case, the client expects the response to be immediately available.
  • Asynchronous: The clients sends a request and will not wait for a response. In this case, the client does not expect the response to be immediately available.

Advantages

✅ Faster Development – .

Microservices testing

There are various testing strategies used to test indivial services and components

  • Unit testings: Test indivial classes, methods, components etc. Tools used are JUnit, Mockito
  • Integration Testing: Testing integration between different services
  • Contract Testing: Test API Contract aggrement between producer and consumer.
  • End-to-End Testing: Testing full application from beginning to end

When to use Microservices?

These are used for the larger complex application such as ecommerce, OTT platforms.

It can not be used with small applicaitons or startups with less team size and resources, These apps starts with monolithic architecture, later it can be converted to microservice architecture.

Latest Articles

Microservice - Outbox

Learn MicroServices tutorials design patterns

Posted January 1, 0001 by  ‐ 1 min read

Microservice - Tutorials

Learn MicroServices tutorials design patterns

Posted January 1, 0001 by  ‐ 1 min read