Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow multiple values per request-arg in a HystrixObservableCollapser #881

Closed

Conversation

mattrjacobs
Copy link
Contributor

Addresses #865

I'm not ready to merge this yet, but wanted a few eyes on the general approach.
/cc @benjchristensen

Prior to this fix, there was a single-valued ResponseHolder object that prevented multiple values from being emitted per-request argument. Now the stream of values is directly represented as a Subject, which may be subscribed to.

Within CollapsedRequestObservableFunction, the semantics of setResponse may not change, as this is used in user-defined HystrixCollapsers already. Therefore, I was forced to add emitResponse and setComplete methods to allow multiple values to flow through. These names will be public, so any thoughts on naming would be helpful.

Before I merge, I'll beef up test coverage on this class to include tests for :

  • Error in ObservableCommand
  • Error in mapping response to request-args
  • Empty overall response
  • Empty response for specific request-args

@cloudbees-pull-request-builder

NetflixOSS » Hystrix » Hystrix-pull-requests #163 SUCCESS
This pull request looks good

@mattrjacobs
Copy link
Contributor Author

The above unit tests have now been added, which found some unhandled cases in HystrixObservableCollapser. As soon as I get feedback on the overall approach and names for the methods I'm adding, I'll merge and cut release from the 1.4.x branch

@cloudbees-pull-request-builder

NetflixOSS » Hystrix » Hystrix-pull-requests #164 SUCCESS
This pull request looks good

*/
@Override
public void call(Subscriber<? super T> observer) {
responseSubject.onBackpressureBuffer().subscribe(observer);
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think onBackpressureBuffer is needed here since you're using an unbounded ReplaySubject already.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think you can also use unsafeSubscribe to avoid an allocation, as I don't think you need the unsubscribe behavior on termination, nor do you need error handling, as long as you control the Subscriber used here and don't do anything wrong in it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

+1

@benjchristensen
Copy link
Contributor

The changes seem good to me. Good unit test coverage.

Perhaps this should be canaried before release though to ensure both functionality and performance has not impacted existing high-throughput use cases since this changes the guts of a hot code path?

@mattrjacobs
Copy link
Contributor Author

Will make the changes above, then vet them with a canary in the Netflix environment. There are also no existing perf tests on collapsing. I'll create an issue to get some jmh coverage added

@cloudbees-pull-request-builder

NetflixOSS » Hystrix » Hystrix-pull-requests #165 SUCCESS
This pull request looks good

@mattrjacobs
Copy link
Contributor Author

I see a small performance degradation, so I'll spend some time on getting jmh in place to confirm that before I merge.

@mattrjacobs
Copy link
Contributor Author

Closed in favor of #890

@mattrjacobs mattrjacobs closed this Sep 9, 2015
@mattrjacobs mattrjacobs deleted the handle-streams-per-collapser-arg branch September 9, 2015 22: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.

3 participants