Skip to content

Conversation

@abrarsheikh
Copy link
Contributor

@abrarsheikh abrarsheikh commented Nov 24, 2025

The correct route value is already part of RequestMetadata after #58180, no need to recompute it again.

no observed perf diff in microbenchmark
After

Type	Name	# Requests	# Fails	Median (ms)	95%ile (ms)	99%ile (ms)	Average (ms)	Min (ms)	Max (ms)	Average size (bytes)	Current RPS	Current Failures/s
GET	/echo?message=hello	28068	0	200	410	470	228.27	80	592	26	430.3	0
Aggregated	28068	0	200	410	470	228.27	80	592	26	430.3	0

Before

Type	Name	# Requests	# Fails	Median (ms)	95%ile (ms)	99%ile (ms)	Average (ms)	Min (ms)	Max (ms)	Average size (bytes)	Current RPS	Current Failures/s
GET	/echo?message=hello	27427	0	210	410	470	232.12	76	604	26	429.7	0
Aggregated	27427	0	210	410	470	232.12	76	604	26	429.7	0

Additionally, old implementation wrongly assumed that there will only be one method (GET,PUT) corresponding to a route. This PR fixes that assumption and tests for it.

Signed-off-by: abrar <abrar@anyscale.com>
@abrarsheikh abrarsheikh added the go add ONLY when ready to merge, run all tests label Nov 24, 2025
Signed-off-by: abrar <abrar@anyscale.com>
@abrarsheikh abrarsheikh marked this pull request as ready for review November 24, 2025 19:40
@abrarsheikh abrarsheikh requested a review from a team as a code owner November 24, 2025 19:40
@abrarsheikh abrarsheikh changed the title [Serve] remove route matching logic from replica [Serve] remove route matching logic from replica and bug fix with route matching Nov 24, 2025
routes = [
Route(path, dummy_endpoint, methods=methods)
for methods, path in patterns
]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Passing methods=None to Route constructor incorrectly

When route patterns have methods=None (indicating no HTTP method restrictions), the code passes methods=None explicitly to the Starlette Route constructor. However, to create a route accepting all HTTP methods in Starlette, the methods parameter should be omitted entirely rather than passing None. This could cause the route to not match requests properly. The code should conditionally include the methods parameter only when it's not None, e.g., using **{"methods": methods} if methods else {} or a conditional expression.

Fix in Cursor Fix in Web

Signed-off-by: abrar <abrar@anyscale.com>
@abrarsheikh abrarsheikh merged commit 284b552 into master Nov 25, 2025
6 checks passed
@abrarsheikh abrarsheikh deleted the 58180-abrar-pass branch November 25, 2025 00:43
ykdojo pushed a commit to ykdojo/ray that referenced this pull request Nov 27, 2025
…te matching (ray-project#58927)

The correct route value is already part of RequestMetadata after
ray-project#58180, no need to recompute it
again.

no observed perf diff in microbenchmark
After
```
Type	Name	# Requests	# Fails	Median (ms)	95%ile (ms)	99%ile (ms)	Average (ms)	Min (ms)	Max (ms)	Average size (bytes)	Current RPS	Current Failures/s
GET	/echo?message=hello	28068	0	200	410	470	228.27	80	592	26	430.3	0
Aggregated	28068	0	200	410	470	228.27	80	592	26	430.3	0
```

Before
```
Type	Name	# Requests	# Fails	Median (ms)	95%ile (ms)	99%ile (ms)	Average (ms)	Min (ms)	Max (ms)	Average size (bytes)	Current RPS	Current Failures/s
GET	/echo?message=hello	27427	0	210	410	470	232.12	76	604	26	429.7	0
Aggregated	27427	0	210	410	470	232.12	76	604	26	429.7	0
```

Additionally, old implementation wrongly assumed that there will only be
one method (GET,PUT) corresponding to a route. This PR fixes that
assumption and tests for it.

---------

Signed-off-by: abrar <abrar@anyscale.com>
Signed-off-by: YK <1811651+ykdojo@users.noreply.github.com>
SheldonTsen pushed a commit to SheldonTsen/ray that referenced this pull request Dec 1, 2025
…te matching (ray-project#58927)

The correct route value is already part of RequestMetadata after
ray-project#58180, no need to recompute it
again.

no observed perf diff in microbenchmark
After
```
Type	Name	# Requests	# Fails	Median (ms)	95%ile (ms)	99%ile (ms)	Average (ms)	Min (ms)	Max (ms)	Average size (bytes)	Current RPS	Current Failures/s
GET	/echo?message=hello	28068	0	200	410	470	228.27	80	592	26	430.3	0
Aggregated	28068	0	200	410	470	228.27	80	592	26	430.3	0
```

Before
```
Type	Name	# Requests	# Fails	Median (ms)	95%ile (ms)	99%ile (ms)	Average (ms)	Min (ms)	Max (ms)	Average size (bytes)	Current RPS	Current Failures/s
GET	/echo?message=hello	27427	0	210	410	470	232.12	76	604	26	429.7	0
Aggregated	27427	0	210	410	470	232.12	76	604	26	429.7	0
```

Additionally, old implementation wrongly assumed that there will only be
one method (GET,PUT) corresponding to a route. This PR fixes that
assumption and tests for it.

---------

Signed-off-by: abrar <abrar@anyscale.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants