-
Notifications
You must be signed in to change notification settings - Fork 5.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
[Core][Enable gcs scheduler 7/n] Prefer actor owner's node #30789
[Core][Enable gcs scheduler 7/n] Prefer actor owner's node #30789
Conversation
Signed-off-by: Chong-Li <lc300133@antgroup.com>
The RLLib release test results with raylet-based scheduler: https://buildkite.com/ray-project/release-tests-pr/builds/22539#_ With gcs-based-scheduler: https://buildkite.com/ray-project/release-tests-pr/builds/22674#_ I did not find notable performance regression. But the variations may need @rkooo567 to double check. cc. @scv119 @iycheng @wumuzi520 |
python/ray/_private/ray_constants.py
Outdated
@@ -359,7 +359,7 @@ def env_bool(key, default): | |||
|
|||
|
|||
def gcs_actor_scheduling_enabled(): | |||
return os.environ.get("RAY_gcs_actor_scheduling_enabled") == "true" | |||
return os.environ.get("RAY_gcs_actor_scheduling_enabled") != "false" |
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.
Does this mean that gcs actor scheduling is enabled by default?
src/ray/common/ray_config_def.h
Outdated
@@ -602,7 +602,7 @@ RAY_CONFIG(uint64_t, subscriber_timeout_ms, 300 * 1000) | |||
RAY_CONFIG(uint64_t, gcs_actor_table_min_duration_ms, /* 5 min */ 60 * 1000 * 5) | |||
|
|||
/// Whether to enable GCS-based actor scheduling. | |||
RAY_CONFIG(bool, gcs_actor_scheduling_enabled, false); | |||
RAY_CONFIG(bool, gcs_actor_scheduling_enabled, true); |
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.
Does this mean that gcs actor scheduling is enabled by default?
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.
It is only turned on to go through CI pipeline. Will turn it off after code review.
@@ -49,7 +49,8 @@ GcsActorScheduler::GcsActorScheduler( | |||
void GcsActorScheduler::Schedule(std::shared_ptr<GcsActor> actor) { | |||
RAY_CHECK(actor->GetNodeID().IsNil() && actor->GetWorkerID().IsNil()); | |||
|
|||
if (RayConfig::instance().gcs_actor_scheduling_enabled()) { | |||
if (RayConfig::instance().gcs_actor_scheduling_enabled() && | |||
!actor->GetCreationTaskSpecification().GetRequiredResources().IsEmpty()) { |
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.
This condition is a little weird here.
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.
This is just a quick way to make the empty-resource actors go through the legacy logic (randomly select a forward raylet).
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.
It looks good overall.
BTW, don't forget to change the switch RAY_gcs_actor_scheduling_enabled
back.
Is there any more suggestions to this PR? @iycheng @rkooo567 |
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.
Request change until we revert the gcs actor scheduling enabled by default
I have mainly two questions.
- Is there any way to merge "prioritize_local_node "and "preferred_node_id"? I feel like they are the same thing.
- Some questions regarding the nightly tests (follow up from comments)
Also I am waiting for the review from @scv119
|
||
|
||
def test_max_actors_launch(cpus_per_actor, total_actors, num_masters): | ||
# By default, there are 50 groups, each group has 1 master and 99 slaves. |
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.
have you run this test? (do you need help from us running this? )
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.
Please see this slack post (https://ray-distributed.slack.com/archives/C0334JQHG86/p1669131998615139) for the results. Generally, gcs scheduler shows ~2.5X better latency compared to raylet scheduler.
actor_ready_end = perf_counter() | ||
actor_ready_time = actor_ready_end - actor_ready_start | ||
|
||
print(f"Actor launch time: {actor_launch_time} ({args.total_actors} actors)") |
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 tell me a bit more about the success / failure criteria of this test?
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.
This test is similar to the existing one: https://github.com/ray-project/ray/blob/master/release/nightly_tests/many_nodes_tests/actor_test.py. They both focus on the scheduling latency of a large number of actors.
The only difference from the actor_test.py
is that this test simulates a multi-master(driver) scenario. This means (distributed) master actors are creating slave actors concurrently. Please see this discussion (https://ray-distributed.slack.com/archives/C0334JQHG86/p1667468940596309) for details.
release/release_tests.yaml
Outdated
timeout: 7200 | ||
script: python many_nodes_tests/multi_master_test.py | ||
wait_for_nodes: | ||
num_nodes: 251 |
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 we test this in smaller # of nodes?
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.
This config is actually the same as the one of actor_test.py
. They should have the same scale to make an apple-to-apple comparison.
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.
this is pretty expensive. Can you comment it out for now? We can re-enable it once we enable GCS actor scheduler by default. (Let's just use it for benchmarking purpose for now.)
src/ray/common/ray_config_def.h
Outdated
@@ -602,7 +602,7 @@ RAY_CONFIG(uint64_t, subscriber_timeout_ms, 300 * 1000) | |||
RAY_CONFIG(uint64_t, gcs_actor_table_min_duration_ms, /* 5 min */ 60 * 1000 * 5) | |||
|
|||
/// Whether to enable GCS-based actor scheduling. | |||
RAY_CONFIG(bool, gcs_actor_scheduling_enabled, false); | |||
RAY_CONFIG(bool, gcs_actor_scheduling_enabled, true); |
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.
I will request for changes until this change is reverted
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.
Sure. I was meaning to revert it after code review. But could do it right now.
41b3307
to
3e4ed6c
Compare
Signed-off-by: Chong-Li <lc300133@antgroup.com>
3e4ed6c
to
c2308af
Compare
These two questions have been resolved. Are there any more comments? @rkooo567 @scv119 |
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.
Looks pretty good! Last couple comments.!
release/release_tests.yaml
Outdated
timeout: 7200 | ||
script: python many_nodes_tests/multi_master_test.py | ||
wait_for_nodes: | ||
num_nodes: 251 |
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.
this is pretty expensive. Can you comment it out for now? We can re-enable it once we enable GCS actor scheduler by default. (Let's just use it for benchmarking purpose for now.)
@@ -191,7 +192,8 @@ void ClusterTaskManager::TryScheduleInfeasibleTask() { | |||
bool is_infeasible; | |||
cluster_resource_scheduler_->GetBestSchedulableNode( | |||
task.GetTaskSpecification(), | |||
work->PrioritizeLocalNode(), | |||
/*preferred_node_id*/ work->PrioritizeLocalNode() ? self_node_id_.Binary() | |||
: task.GetPreferredNodeID(), |
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.
How does it work if there's no preferred node id?
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.
Empty preferred node_id is handled specially (if empty, fallback to local node) inside HybridSchedulingPolicy
.
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.
Is it possible to just pass nullopt instead? It makes sense, but I think it is pretty confusing from code to understand
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.
Right now, preferred_node_id
is just a std::string
in ClusterResourceScheduler
, RayTask
, SchedulingOptions
and HybridSchedulingPolicy
(empty string by default). Do you mean changing it to std::optional<std::string>
globally?
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.
As suggested, more comments about the empty string have been added. @rkooo567
Signed-off-by: Chong-Li <lc300133@antgroup.com>
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.
There are test failures
I started a mac build. Please wait a little! |
All tests passed. @rkooo567 |
cc @iycheng |
Signed-off-by: Chong-Li lc300133@antgroup.com
Why are these changes needed?
This PR tries to finalize gcs actor scheduler, with the following changes:
The feature flag is temporarily turned on when going through the CI pipline. We still need another dedicated PR to turn it on by default.
Related issue number
Checks
git commit -s
) in this PR.scripts/format.sh
to lint the changes in this PR.