spring-cloud / spring-cloud/spring-cloud-gateway

Implement Retryable feature of spring cloud LoadBalancer for ReactiveLoadBalancerClientFilter

Open
#3,045 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Java
Stars
4.9k
Forks
3.5k
Avg merge
20h 57m
Merged PRs (30d)
8

Description

Currently, the ReactiveLoadBalancerClientFilter, which implements load balancer usage, does not take into account the retry features specific to the load balancer (e.g., the use of maxRetriesOnNextServiceInstance).

It appears that the ReactiveLoadBalancerClientFilter is primarily based on the functionality of the ReactorLoadBalancerExchangeFilterFunction (from spring-cloud-commons), but there is no implementation that incorporates the features of the RetryableLoadBalancerExchangeFilterFunction.

In my case, the use of Spring Cloud Gateway Retry does not necessarily target a different instance than the first one that failed (it depends on concurrency).

Sample with load balancer with 2 instances (I1 - DOWN and I2 - UP)

Successful case
Request 1 => LB choose I1 => FAILED
Retry Request 1 => LB choose I2 => OK

Failed case
Request 1 => LB choose I1 => FAILED
Request 2 (concurrency call) => LB choose I2 => OK
Retry Request 1 => LB choose I1 again => FAILED

Thank you for your help.

spring-cloud-gateway
ReactiveLoadBalancerClientFilter.java

spring-cloud-commons
ReactorLoadBalancerExchangeFilterFunction.java
RetryableLoadBalancerExchangeFilterFunction.java

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with spring-cloud-gateway-server/src/main/java/org/springframework/cloud/gateway/filter/ReactiveLoadBalancerClientFilter.java and compare it with the linked ReactorLoadBalancerExchangeFilterFunction and RetryableLoadBalancerExchangeFilterFunction in spring-cloud-commons. Trace how retryable load-balancer settings such as maxRetriesOnNextServiceInstance should affect instance selection, then verify the two-instance failure and retry scenarios described in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring, spring-boot
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.