Learnitweb

Category: Microservices with Spring

  • Observability and Monitoring: Log Aggregation in Microservices

    Introduction Observability and monitoring rely on three fundamental pillars: logging, metrics, and traces. To implement these effectively in a microservices architecture, we must generate and manage relevant data, enabling us to understand the internal state of our applications and monitor them efficiently. Understanding Logs Logs are records of events occurring within a software application over…

  • Observability and Monitoring in Microservices

    Introduction In this tutorial, we will discuss observability and monitoring in microservices. Understanding these concepts is crucial for ensuring the reliability and performance of distributed systems. What is Observability? Observability is the ability to understand the internal state of a system by analyzing its output. In microservices, observability is achieved by collecting and analyzing data…

  • The Resilience4j Aspects order 

    The Resilience4j Aspects order is the following:Retry ( CircuitBreaker ( RateLimiter ( TimeLimiter ( Bulkhead ( Function ) ) ) ) )so Retry is applied at the end (if needed).If you need a different order, you must use the functional chaining style instead of the Spring annotations style or explicitly set aspect order using the following properties:…

  • Implementing Redis Rate Limiter in Spring Boot Gateway Server

    Introduction Rate limiting is a crucial aspect of API security and performance. It prevents abuse, ensures fair usage, and protects backend services from being overwhelmed by excessive requests. In this tutorial, we will implement a Redis-based rate limiter in a Spring Boot Gateway server. Dependency Add the following dependency to the pom.xml: Configuring redis rate…

  • Implementation retry pattern in Gateway and individual microservice

    Introduction Following sample code is an example of implementing retry pattern in Gateway: Following piece of code configures a retry mechanism with a backoff strategy for HTTP requests: Explanation Implement in individual microservice Following is an example of implementing the retry in individual microservice: To enable retry, define a retry configuration in application.yml:

  • Introduction to Retry Pattern

    Introduction In distributed systems, failures are inevitable due to network issues, resource unavailability, or temporary service outages. To improve system resilience, strategies like retry mechanisms are implemented. These techniques help maintain system reliability by handling transient failures effectively. Retry Pattern The Retry Pattern involves automatically reattempting a failed operation a predefined number of times before…

  • Http timeout configuration

    Introduction In this tutorial, we’ll discuss configuring Http timeout in application. Http timeouts (response and connect) can be configured for all routes and overridden for each specific route. In the context of HTTP timeouts: Global timeouts To configure Global http timeouts: global http timeouts example Per-route timeouts To configure per-route timeouts:connect-timeout must be specified in milliseconds.response-timeout must…

  • Implementing Circuit Breaker Pattern with Feign Client

    Introduction In this tutorial, we’ll implement Circuit Breaker Pattern with Feign Client. Sometimes, we don’t want to show the error page and gracefully handle the response. We may choose to return a default or custom response in case one of the microservice is down. We can do this by implementing Circuit Breaker Pattern with Feign…

  • Implementing Circuit Breaker Pattern in Gateway

    Introduction In this tutorial, we’ll implement circuit breaker pattern in gateway using resilience4j. Dependency Add the following dependency to the pom.xml: spring-cloud-starter-circuitbreaker-reactor-resilience4j is a Spring Boot starter that integrates Resilience4j with Spring Cloud Circuit Breaker in reactive applications using Project Reactor (WebFlux). Adding Circuit Breaker In the earlier tutorials we added filters to rewrite path.…

  • Introduction to the resiliency inside microservices

    Introduction In today’s fast-paced digital landscape, microservices have become the backbone of modern applications. They offer scalability, flexibility, and faster deployment cycles, allowing businesses to respond quickly to changing market demands. However, with these advantages come new challenges, particularly in ensuring resiliency—the ability of microservices to withstand failures and recover without disrupting the entire system.…