Author: Editorial Team
-
Bulkhead pattern
Introduction The Bulkhead pattern is a type of application design that is tolerant of failure. In a bulkhead architecture, also known as cell-based architecture, elements of an application are isolated into pools so that if one fails, the others will continue to function. It’s named after the sectioned partitions (bulkheads) of a ship’s hull. If…
-
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…
-
Detecting Cycles in a Directed Graph
Introduction Cycle detection in directed graphs is an essential problem in computer science, with applications in various domains, such as financial trading, multithreading, and operating systems. Understanding how to detect cycles allows us to optimize systems, prevent deadlocks, and even identify arbitrage opportunities in financial markets. Applications of Cycle Detection Detecting Cycles in a Directed…
-
CAP Theorem
Introduction The CAP Theorem, formulated by Eric Brewer in 2000, is a fundamental principle in distributed systems. It states that in a distributed data store, it is impossible to simultaneously achieve all three of the following properties: The CAP theorem is crucial for designing databases, cloud-based applications, and large-scale distributed architectures. It helps developers understand…
-
Token Bucket Algorithm
Introduction The Token Bucket Algorithm is a popular mechanism used in rate limiting to control data transmission, API requests, and network traffic efficiently. It allows bursty traffic while ensuring a steady overall rate of transmission. This algorithm is widely adopted in network traffic management, API rate limiting, cloud computing, and telecommunications to prevent excessive load…
-
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…
-
Chain of Responsibility design pattern in Java
Introduction The Chain of Responsibility (CoR) pattern is a behavioral design pattern that allows multiple objects to handle a request in a chain-like manner, where each handler processes the request or forwards it to the next handler in the chain. This pattern is commonly used in scenarios like event handling, middleware processing, logging frameworks, authentication,…
