By : Mohit Kumar Mittal | Senior Architect and Hemen Goswami | Vice President
Microservice is an architecture that has been gaining traction in the past few years. MSA (Microservice Architecture) defines an application as a program composed of loosely coupled services. This comes with lots of challenges that we must solve up front. Below are some such common challenges, patterns to solve, and some potential technical solutions.
Microservices is an architecture style for distributed computing. An application is composed of multiple fine grain independent services that communicate over a network. To use a service, the consumer needs to know its specific network location. This is an issue that will grow even more complex if the network location of services keeps changing.
Some examples of consumers of services are external clients like Mobile App, API Gateway and other (Micro) services.
System designers should implement a service Registry and a database of all the services network locations. They can register services themselves or by way of a third party to a common registry. Consumers can use this service registry to dynamically discover network locations of services.
Netflix Eureka service registry, Kubernetes Service
In Microservices architecture, there can be multiple services and multiple consumers. Different consumers may require different services—for example, Mobile App may need to display fine grained information, while web-based applications may need to render coarse grained information.
On top of that, services may be using different protocols like JMS or REST etc. In order to simplify services access, there needs to be a unified access mechanism.
A potential solution to this concern would be to implement an API gateway as a single-entry point for all services. All the consumers will call API gateway and API gateway should route them to their required services. Additionally, API gateway can provide services like “Aggregation of Services”, “Security”, “Metering” etc.
Spring Cloud Zuul, Amazon API Gateway, Apigee
Security is a key aspect in Microservices.
Implement a common and centralized authentication service. This service will allow all the consumers to get authenticated before seeking a services access. Individual services should be responsible for the authorization of its consumers.
In a Microservices architecture, there can be use cases that span across services. In a scenario in which each service generates its own logs, it would be nightmare for a developer to troubleshoot a bug, as he/she would have to aggregate all the services log and analyze manually
One could instead implement a common logging service, wherein each service can use this service to write logs.
Elastich Serach, LogsTash, Kibana (ELK)
Configuring services is an added complexity in Microservices. Since each service is independent, it must be configured separately. This will make it difficult to run applications in different environments without making adjustments. Configurations can be anything like DB Credentials, Environment Variables and Network Locations.
Implement a common/centralized configuration service. This service can be backed by a common configuration repository so that all services can request this service to read configurations.
Spring Cloud Config Server , kubernetes configmap
You will be the first to know when new items are added to Infogain's knowledge center.
The Infogain Team.
You are an existing user.