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

Session-Based Sticky Load Balancing for Spring Cloud Gateway

Open
#4,232 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Summary for the Spring Cloud Gateway proposal

The gap worth raising upstream: Spring Cloud Gateway's default load-balancer filter doesn't pass enough per-request context (or provide a per-route hook) for a custom ReactorServiceInstanceLoadBalancer to implement session-based sticky routing, forcing consumers to fully replace the default filter just to get access to the ServerWebExchange/session on a per-route basis. The built-in RequestBasedStickySessionServiceInstanceListSupplier solves a similar problem but only for cookie-based affinity applied uniformly to a service, not for gateway-session-based affinity that can be toggled per route.

A useful ask for the issue: expose a supported extension point (or request context type) in the default gateway load-balancer filter that lets a custom ReactorServiceInstanceLoadBalancer access the ServerWebExchange/session per-route, without requiring downstream consumers to disable and reimplement the entire filter. Prior related discussion: spring-cloud/spring-cloud-commons#764 and spring-cloud/spring-cloud-gateway#1176.

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 by tracing the default load-balancer filter and how it invokes ReactorServiceInstanceLoadBalancer, then compare that flow with RequestBasedStickySessionServiceInstanceListSupplier. Review spring-cloud/spring-cloud-commons#764 and spring-cloud/spring-cloud-gateway#1176; done means a supported per-route extension point or request context exposes ServerWebExchange/session without requiring consumers to replace the entire filter.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring, spring-boot
Domain
api, backend, distributed-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.