Learnitweb

Category: Microservices with Spring

  • Data Masking and Tokenization in Microservices

    1. Overview With the increasing shift to microservices-based architectures, applications often become responsible for handling sensitive data such as credit card numbers, Social Security Numbers (SSNs), phone numbers, and health records. It becomes imperative to secure this sensitive information to meet compliance requirements such as GDPR, HIPAA, and PCI-DSS. This tutorial explains two common data…

  • Saga Design Patterns: Choreography and Orchestration

    Saga is a design pattern used to manage distributed transactions and ensure data consistency across microservices architectures. It decomposes long-running transactions into a series of smaller, manageable sub-transactions, each handled by a different service. There are two primary ways to implement the Saga pattern: Choreography (decentralized) and Orchestration (centralized). 1. What Is a Saga? 2. Saga Choreography 2.1 Overview…

  • 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…