Modern micro-service architecture how does they work?
Microservices is an evolution of SOA(Services Oriented Architecture) architectural style. Application which is composed with many discrete connected components are termed as microservices.
For many years applications are packaged into monolithic style that is developed by team of developers as one large application that did everything.After the Application is built, it is deployed multiple times across multiple servers.In order to make this process easy microservices would be the best way.
The below architecture diagram shows the overview of microservices.
- Clients— The architecture starts with different types of clients from various devices to perform various capabilities such as search, build , configure etc.
- API Gateway — Clients don’t call services directly , API Gateway acts as an entry point for the clients to forward requests to appropriate services.
Core Benefits of using API Gateway:
- All the services can be updated without knowing client.
- It can perform cross-cutting functions such as providing security, load balancing etc.
3. Identity Providers — The identity providers are who authenticate the requests and communicate the requests to API Gateway.
4. Service Discovery — This is place where the respective microservices use this as a guide to find the route to communication.
Microservices uses two types of messages to communicate:
Synchronous Messages and Asynchronous messages
- Synchronous Messages — In this message type the client waits for the response from service which is generally used REST(Representational State Transfer) which is stateless and HTTP protocol.
- Asynchronous messages — In this message type the client won’t wait for the response which is generally used protocols such as AMQP, STOMP.
5. Database — Each microservice owns there own database(DB) and perform different functionalities.
6. Monitoring — Each microservice can be monitored on gathering and analyzing the data that is collected from applications and operating systems and network platforms on which they run to identify failures. One of my favorite is Zipkin.
- Zipkin: It is an open source tracing system designed specifically to trace calls between microservices. It is especially useful for latency problems and includes both instrumentation libraries and collector proccesses that gather and store tracing data.
Advantages of using Microservice Architecture
- Different technologies can be used.
- Each service focuses on single business capability.
- Supports individual deployable units.
- Allows frequent software releases.
- Ensures security of each service.
- Multiple services are parallely developed and deployed.
Disadvantages of using Microservices Architecture
- Increases troubleshooting challenges.
- Increases delay due to remote calls.
- Increased efforts of configurations and other operations.
- Difficult to maintain transaction safety.
- Tough to track data across various service boundaries
- Difficult to move code between services.
Closing:
It has been exciting time for me to walk through the modern microservices architecture.Thank you for all the attention, I hope you got something from this article.