Skip to content

[Perf improvement]ReduceGatewayModePerRequestCPUOverhead#48430

Closed
xinlian12 wants to merge 2 commits intoAzure:mainfrom
xinlian12:gateway-uri-optimization
Closed

[Perf improvement]ReduceGatewayModePerRequestCPUOverhead#48430
xinlian12 wants to merge 2 commits intoAzure:mainfrom
xinlian12:gateway-uri-optimization

Conversation

@xinlian12
Copy link
Member

No description provided.

@xinlian12 xinlian12 force-pushed the gateway-uri-optimization branch from 69ecd40 to 83f06ec Compare March 16, 2026 19:01
@xinlian12 xinlian12 force-pushed the gateway-uri-optimization branch 3 times, most recently from a277bf4 to 9476987 Compare March 16, 2026 19:21
@xinlian12 xinlian12 force-pushed the gateway-uri-optimization branch from 9476987 to 6b181bc Compare March 16, 2026 20:27
v4 approach: getUri() returns String directly. The downstream flow
passes the string through without constructing java.net.URI again.
HttpRequest stores the URI string natively; uri() lazily parses only
when needed (error paths).

getUri() uses the standard URI constructor for correct percent-encoding
of unicode resource names, then calls toASCIIString() once. The URI
object is not retained — only the string flows downstream.

ReactorNettyClient uses request.uriString() instead of
uri().toASCIIString(), avoiding a redundant conversion.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@xinlian12 xinlian12 force-pushed the gateway-uri-optimization branch from 6b181bc to 939a8d9 Compare March 17, 2026 02:24
Replace the URI-based wrapInHttpRequest(request, URI) signature in
HttpTransportSerializer with wrapInHttpRequest(request, String, int)
so all serializers use strings directly and avoid URI parsing overhead.

Both RxGatewayStoreModel and ThinClientStoreModel now implement the
string-based method, eliminating the if/else branching in
performRequestInternalCore and the fallback new URI(requestUri)
allocation for thin client requests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@xinlian12
Copy link
Member Author

the major improvements comes from eliminating URI construction (just use StringBuilder), consistent 4-10% improvement on throughput, but using StringBuilder miss some edge cases, so for now, will not adopt the eliminating URI changes.

@xinlian12 xinlian12 closed this Mar 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant