spring-cloud / spring-cloud/spring-cloud-gateway
RouteDefinitions assertion has performance issues
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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