Before we jump into the world of Microservices, let's spend some time understanding the fundamentals. As it involves, a multitude of technologies, it's easy to lose track. If you think, you are already aware of the fundamentals, associated patterns, and frameworks, you can skip it and move to the series directly.
The new architecture pattern is been adopted by almost all sizes of organizations, be it small, medium, or large. Organizations have started realizing the value of it. In spite of such widespread adoption of this pattern, it's unfortunate, there is no consistent definition of Microservices.
Spring Cloud Config is one of the Spring Cloud Projects. This is directly mapped to one of the important patterns of Microservice Architecture — Centralized Configuration Service. This provides the means to centralize and manage the externalized configurations across different applications/services in a distributed system.
We will walk through this topic in the following steps
Configurations increase the flexibility of our applications(services). We can deploy the same application in multiple environments or we can change the providers (like a database) with minimal or no code change.
Spring Cloud Gateway provides a library to build an API Gateway. This is the preferred gateway implementation provided by Spring Cloud. It's built with Spring 5, Spring Boot 2, and Project Reactor.
To understand the offerings of Spring Cloud Gateway we must understand the API Gateway pattern in detail. Let's assume, we are implementing the microservices architecture for our e-commerce system. One of the microservices in the system is Product Catalog Service, which is responsible to manage product lifecycle through — create, update, delete, and get operations. Let’s go through some common scenarios, we might come across —
As the name suggests, the pattern derives its inspiration from the electrical switches, which are designed to protect an electrical circuit from damage, caused by excess current from an overload.
When a particular microservice or resource is not responding, this pattern helps in registering the fault, switching off the communication, and restoring it back when the service is ready to serve the requests. This helps the microservice ecosystem in multiple ways —
All the microservices pundits described API gateway as a microservices pattern which exposes the coarse grained apis. They aggregate the response across multiple fine-grained apis and returns back the response to the end user or the client api.
But none of the API gateways including APIGEE, Kong, AWS API Gateway, etc are selling this. Instead they are selling other features like Monitoring, Billing, API Management, Rate Limiting, etc. These features have nothing or very little to do with API Composition. API Gateway provided a single entry point to access the fine-grained microservices. …
Microservices expose the fine-grained APIs to the client APIs. When the user interfaces interact with the services directly, the communication usually becomes — chatty, which needs multiple calls to render a single view on the client side.
Let’s assume we have an e-commerce system based on microservices architecture. We have different microservices including Product Catalog, Product Recommendations, Product Reviews, etc. If we have to render a product view, which includes the details related to product, reviews and recommendations, we need to call Product Catalog, Product Reviews and Product Recommendation services separately.
In the real world e-commerce sites, product details view…
In the microservices world, Services interact with each other through network calls. We must accept the fact that the network or services can fail. And this can fail our service interactions. We need to handle these failures to ensure our service interactions are more reliable. One of the primitive approaches to handle it is through the Retry mechanism. But it can often lead to cascading failures which we will discuss in a while.
Circuit breaker provides a matured way to manage such failures. As the name suggests, this microservices pattern derives its inspiration from the electrical switches. When a particular…
Service Discovery is a pattern that helps in locating the right instance for the client API. Multiple instances of a single Microservice can co-exist. And they can have different IP addresses or different ports or both. As the number of instances for service can vary, we must have a way to track these instances and their addresses.
Three core modules of service discovery include —
As industries are getting used to using object storage; they are using it in varied scenarios. The usage has gone beyond tasks such as data backup, disaster recovery, and data archival. Enterprises are using it to host media streaming, data lakes, big data analytics, and many more use cases. Its high scalability and availability have opened the doors for this technology.
As usual, the technology comes with its own management concerns regarding maintainability, security, availability, performance, etc. Fortunately, most of these concerns can be easily managed with the help of configurable policies. This article will discuss the policies we must…