-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Support StressWorkerBench using consistent hash policy #18246
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a few comments, thanks for the work!
dora/core/client/fs/src/main/java/alluxio/client/file/dora/WorkerLocationPolicy.java
Outdated
Show resolved
Hide resolved
@Parameter(names = {"--mode"}, | ||
description = "Decide which policy to use for file reads." | ||
// + "Possible values are: [local-only, remote-only, hash]." | ||
+ "Possible values are: [local-only, hash]." | ||
+ "By default, the mode is 'hash'") | ||
public String mMode = "hash"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can use a enum here and the values can then be LOCAL_ONLY, HASH
alluxio/dora/stress/common/src/main/java/alluxio/stress/client/ClientIOParameters.java
Line 35 in 1a4b2a9
description = "the operation to perform. Options are [ReadArray, ReadByteBuffer, ReadFully," |
Let's only support LOCAL_ONLY
and HASH
. We can add a REMOTE_ONLY
when we implement that policy.
Here the description can be
description = "Specifies which worker the test process reads from."
+ "Possible values are: [" + Arrays.toString(YourEnumClass.values()) + "]"
+ "HASH - alluxio.client.file.dora.ConsistentHashPolicy"
+ "LOCAL_ONLY - alluxio.client.file.dora.LocalWorkerPolicy"
+ "The default is HASH."
You may replace the strings with enum/class names by code, as you see fit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Description should be a constant string, or it will report: Attribute value must be constant. Here I will use a string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool
dora/stress/shell/src/main/java/alluxio/stress/cli/worker/StressWorkerBench.java
Outdated
Show resolved
Hide resolved
dora/stress/shell/src/main/java/alluxio/stress/cli/worker/StressWorkerBench.java
Outdated
Show resolved
Hide resolved
dora/core/client/fs/src/main/java/alluxio/client/file/dora/WorkerLocationPolicy.java
Outdated
Show resolved
Hide resolved
+ "HASH - alluxio.client.file.dora.ConsistentHashPolicy" | ||
+ "LOCAL_ONLY - alluxio.client.file.dora.LocalWorkerPolicy" | ||
+ "The default is HASH.") | ||
public String mMode = "HASH"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you use enum here instead of a string? Refer to my previous comment on how.
@@ -191,16 +191,18 @@ public void prepare() throws Exception { | |||
"true"); | |||
|
|||
// default mode value: hash, using consistent hash | |||
if (Objects.equals(mParameters.mMode, "local-only")) { | |||
// TODO(jiacheng): we may need a policy to only IO to remote worker | |||
if (Objects.equals(mParameters.mMode, "LOCAL_ONLY")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here mParameters.mMode
should be an enum so you just
switch (mParameters.mMode) {
case LOCAL_ONLY: ...; break;
case HASH: ...;break;
default: throw new IllegalArgumentException("Unrecognized mode" + mParameters.mMode);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for the work!
alluxio-bot, merge this please |
### What changes are proposed in this pull request? This PR adds a `--mode` option for StressWorkerBench. This option allows user to choose from a range of file read policies. Possible option values are `hash`(default) and `local-only`. If use `hash`, the config `alluxio.client.file.dora.ConsistentHashPolicy` is set to `alluxio.client.file.dora.ConsistentHashPolicy`. If use `local-only`, that config is set to `alluxio.client.file.dora.LocalWorkerPolicy`. The benchmark will parse this option, and choose the right policy. Also, it will print a log about the policy the user is using in both the benchmark and the policy factory. ### Why are the changes needed? In previous versions, the default policy is `local-only`. However, in Alluxio, the default policy is `hash`, using `alluxio.client.file.dora.ConsistentHashPolicy`. If user wants to use the `local-only` policy, add `--mode local-only` to the end of the benchmark command. pr-link: Alluxio#18246 change-id: cid-29676a12710b9c815f3e55f84eb5e4226fea9ad7
What changes are proposed in this pull request?
This PR adds a
--mode
option for StressWorkerBench. This option allows user to choose from a range of file read policies. Possible option values arehash
(default) andlocal-only
.If use
hash
, the configalluxio.client.file.dora.ConsistentHashPolicy
is set toalluxio.client.file.dora.ConsistentHashPolicy
.If use
local-only
, that config is set toalluxio.client.file.dora.LocalWorkerPolicy
.The benchmark will parse this option, and choose the right policy. Also, it will print a log about the policy the user is using in both the benchmark and the policy factory.
Why are the changes needed?
In previous versions, the default policy is
local-only
.However, in Alluxio, the default policy is
hash
, usingalluxio.client.file.dora.ConsistentHashPolicy
.If user wants to use the
local-only
policy, add--mode local-only
to the end of the benchmark command.