Skip to content

Conversation

@original-brownbear
Copy link
Contributor

  • Motivated by Stop Copying Every Http Request in Message Handler #44564
    • We are currently passing the REST request object around to a large number of places. This works fine since we simply copy the full request content before we handle the rest itself which is needlessly hard on GC and heap.
    • This PR removes a number of spots where the request is passed around needlessly. There are many more spots to optimize in follow-ups to this, but this one would already enable bypassing the request copying for some error paths in a follow up.
    • Also it simplifies away a number of redundant conditions that were checked over and over in dispatchRequest when they could've been avoided by just seeing if we even have a handler in the first place like it is done now
  • Test testCanTripCircuitBreaker was removed since the method it tests became redundant after simplifying the logic for the dispatch

* Motivated by elastic#44564
  * We are currently passing the REST request object around to a large number of places. This works fine since we simply copy the full request content before we handle the rest itself which is needlessly hard on GC and heap.
  * This PR removes a number of spots where the request is passed around needlessly. There are many more spots to optimize in follow-ups to this, but this one would already enable bypassing the request copying for some error paths in a follow up.
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-distributed

@original-brownbear
Copy link
Contributor Author

@ywelsch @tbrooks8 this would be a suggested step towards getting the copy or not copy behavior ( #44564 ) to depend on the type of rest request.

Copy link
Contributor

@ywelsch ywelsch left a comment

Choose a reason for hiding this comment

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

LGTM

@original-brownbear
Copy link
Contributor Author

thanks @ywelsch !

@original-brownbear original-brownbear merged commit 570e406 into elastic:master Aug 1, 2019
@original-brownbear original-brownbear deleted the simplify-rest-controller branch August 1, 2019 18:19
original-brownbear added a commit to original-brownbear/elasticsearch that referenced this pull request Aug 1, 2019
* Stop Passing Around REST Request in Multiple Spots

* Motivated by elastic#44564
  * We are currently passing the REST request object around to a large number of places. This works fine since we simply copy the full request content before we handle the rest itself which is needlessly hard on GC and heap.
  * This PR removes a number of spots where the request is passed around needlessly. There are many more spots to optimize in follow-ups to this, but this one would already enable bypassing the request copying for some error paths in a follow up.
original-brownbear added a commit that referenced this pull request Aug 2, 2019
* Stop Passing Around REST Request in Multiple Spots

* Motivated by #44564
  * We are currently passing the REST request object around to a large number of places. This works fine since we simply copy the full request content before we handle the rest itself which is needlessly hard on GC and heap.
  * This PR removes a number of spots where the request is passed around needlessly. There are many more spots to optimize in follow-ups to this, but this one would already enable bypassing the request copying for some error paths in a follow up.
original-brownbear added a commit to original-brownbear/elasticsearch that referenced this pull request Aug 2, 2019
* Follow up to elastic#44949
* Stop using a special code path for multi-line JSON and instead handle its detection like that of other XContent types when creating the request
* Only leave a single path that holds a reference to the full REST request
   * In the next step we can move the copying of request content to happen before the actual request handling and make it conditional on the handler in question to stop copying bulk requests as suggested in elastic#44564
original-brownbear added a commit that referenced this pull request Aug 10, 2019
* Follow up to #44949
* Stop using a special code path for multi-line JSON and instead handle its detection like that of other XContent types when creating the request
* Only leave a single path that holds a reference to the full REST request
   * In the next step we can move the copying of request content to happen before the actual request handling and make it conditional on the handler in question to stop copying bulk requests as suggested in #44564
original-brownbear added a commit to original-brownbear/elasticsearch that referenced this pull request Aug 10, 2019
* Follow up to elastic#44949
* Stop using a special code path for multi-line JSON and instead handle its detection like that of other XContent types when creating the request
* Only leave a single path that holds a reference to the full REST request
   * In the next step we can move the copying of request content to happen before the actual request handling and make it conditional on the handler in question to stop copying bulk requests as suggested in elastic#44564
original-brownbear added a commit that referenced this pull request Aug 10, 2019
)

* Follow up to #44949
* Stop using a special code path for multi-line JSON and instead handle its detection like that of other XContent types when creating the request
* Only leave a single path that holds a reference to the full REST request
   * In the next step we can move the copying of request content to happen before the actual request handling and make it conditional on the handler in question to stop copying bulk requests as suggested in #44564
@original-brownbear original-brownbear restored the simplify-rest-controller branch August 6, 2020 19:08
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.

4 participants