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

Group and Threadpool names across libraries #867

Closed
esrishi opened this issue Aug 24, 2015 · 2 comments
Closed

Group and Threadpool names across libraries #867

esrishi opened this issue Aug 24, 2015 · 2 comments
Labels

Comments

@esrishi
Copy link

esrishi commented Aug 24, 2015

Hi,
I plan to use hystrix in a couple of internal libraries we have to provide node level fault isolation (#862). I understand the hierarchy of group-threadpool-command. I wanted to understand the behaviour in case of naming collision.

Ex: I have the following implementation in Library1
class Lib1HystrixCommand extends HystrixCommand <Object1> {
public Lib1HystrixCommand(String host, String port) {
super(Setter.withGroupKey(HystrixCommandGroupKey.Factory.asKey("HTTP_CALL"))
.andCommandKey(HystrixCommandKey.Factory.asKey(method.getURI().getHost() + "_" + method.getURI().getPort()))
.andThreadPoolKey(HystrixThreadPoolKey.Factory.asKey(method.getURI().getHost())));
}

And this in Library2
class Lib2HystrixCommand extends HystrixCommand <Object2> {
public Lib2HystrixCommand(String host, String port) {
super(Setter.withGroupKey(HystrixCommandGroupKey.Factory.asKey("HTTP_CALL"))
.andCommandKey(HystrixCommandKey.Factory.asKey(method.getURI().getHost() + "_" + method.getURI().getPort()))
.andThreadPoolKey(HystrixThreadPoolKey.Factory.asKey(method.getURI().getHost())));
}
}

When my service uses these 2 separate libraries to make calls, will they be different groups with separate threadpool or do they get merged because they have the same group/threadpool name.

Thanks,
Rishi.

@mattrjacobs
Copy link
Contributor

@esrishi For a group, the first time a new name is encountered, a HystrixCommandGroupKey object is created. All subsequent references to this name resolve to this object. The same is also true with thread pools and within commands.

From your code example above, you will set up a single group ("HTTP CALL"), with many threadpools (named ). Each threadpool will contain many commands (named <host_port>).

@esrishi
Copy link
Author

esrishi commented Aug 26, 2015

Thanks @mattrjacobs for clarifying the naming collision.

@esrishi esrishi closed this as completed Aug 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants