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

RouteDefinitions assertion has performance issues

Open
#1,683 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement status: pending-design-work
Dominant language
Java
Stars
4.9k
Forks
3.5k
Avg merge
20h 57m
Merged PRs (30d)
8

Description

Describe the bug
The routing assertion is a List collection that is traversed by each request, and performance is slow in cases where there are many (more than 10,000) routing addresses.
My test environment had 2,000 routedefinitions, and each request traversed the route List collection in 50ms.
It is recommended to provide ConcorrentHashMap to store the RouteDefinition, and use ConcorrentHashMap to match the RouteDefinition.

Sample
RouteDefinitionRouteLoactor.getRoutes(){......}

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 at RouteDefinitionRouteLoactor.getRoutes() and inspect how the route list is traversed for each request. Reproduce the report with roughly 2,000 route definitions and measure the routing time; done means route matching no longer incurs the reported traversal cost while preserving existing routing behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring, spring-boot
Domain
api, backend, performance
Issue type
Bug
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.