Skip to content

[DO NOT MERGE] Feature/master/fix query perf - #7370

Open
alextwoods wants to merge 8 commits into
masterfrom
feature/master/fix-query-perf
Open

[DO NOT MERGE] Feature/master/fix query perf#7370
alextwoods wants to merge 8 commits into
masterfrom
feature/master/fix-query-perf

Conversation

@alextwoods

Copy link
Copy Markdown
Contributor

Build testing only.

Motivation and Context

Modifications

Testing

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the CONTRIBUTING document
  • Local run of mvn install succeeds
  • My code follows the code style of this project
  • My change requires a change to the Javadoc documentation
  • I have updated the Javadoc documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed
  • I have added a changelog entry. Adding a new entry must be accomplished by running the scripts/new-change script and following the instructions. Commit the new file created by the script in .changes/next-release with your changes.
  • My change is to implement 1.11 parity feature and I have updated LaunchChangelog

License

  • I confirm that this pull request can be released under the Apache 2 license

The previous commit removed HTTP_REQUEST_URI_BEFORE_MODIFY outright, which
broke customers who had started reading it despite it being internal API.

Restore it as a deprecated derived view over a new HTTP_REQUEST_BEFORE_MODIFY
attribute, which holds the marshalled request itself. Derived attributes apply
their read mapping on each read, so the URI is only built if something actually
asks for it, and the value is identical to before including the query string.

EndpointResolutionStage reads the endpoint components straight off the
snapshotted request, so the request path no longer builds a URI at all. This
keeps the query/ec2 protocol regression fixed: those protocols still carry the
entire payload in the raw query parameters at this point in the execution, so
building a URI cost two passes over the whole payload per API call.
There is no write usage of this attribute, so setting it now throws
UnsupportedOperationException rather than projecting the URI back onto the
snapshotted request. This matches UnmodifiableExecutionAttributes, and is safe
because ExecutionAttributes copies, merges and putAbsentAttributes all duplicate
the backing map directly and never invoke a derived attribute's write mapping.
Holding the marshalled request kept its raw query parameters reachable until the
end of the API call, because the signing stage swaps the interceptor context
over to the signed request and LowCopyListMap#clear installs a fresh map rather
than mutating the original. For query and ec2 that map is the request payload:
measured at ~114KB retained for a 33KB payload, against ~69KB for the URI that
2.47.0 retained.

Snapshot only the endpoint components instead, which retains ~130 bytes. The
deprecated HTTP_REQUEST_URI_BEFORE_MODIFY becomes a view over those components,
so it now carries no query string and always renders the port. The only known
consumer parses the path for a "/invocations" suffix, which is unaffected;
EndpointUrl#toUri also memoizes, so repeated reads no longer rebuild the URI.

Guarded end to end in SyncClientHandlerTest: an interceptor reads the snapshot
during modifyHttpRequest and asserts the URI has no query string, which fails if
the snapshot is ever built from getUri() again.
The javadoc reference that used it was removed, and Checkstyle's UnusedImports
does not process javadoc, so the import became a build error.
A customer unit test sets this attribute, so throwing on write is too strict.
Writing now replaces the backing endpoint snapshot via EndpointUrl#fromUri,
which also pre-populates the cached URI, so a written value reads back exactly
as written including its query string.
@alextwoods
alextwoods requested a review from a team as a code owner September 11, 2026 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant