Skip to content

[core] Force message refresh if no message is received in ray syncer mode. - #29905

Merged
fishbone merged 16 commits into
ray-project:masterfrom
fishbone:refresh-msg
Nov 7, 2022
Merged

fishbone merged 16 commits into
ray-project:masterfrom
fishbone:refresh-msg

Conversation

@fishbone

@fishbone fishbone commented Nov 1, 2022 •

Copy link
Copy Markdown
Contributor

Why are these changes needed?

In the current protocol of scheduling, it depends on resource refresh to fix some deadlocks. Ray syncer will only send the message if it's updated, so it breaks the previous assumption.

The idea case is to fix the protocol, but it's way more complicated. So instead we fix it by making it the same as before.

Here is more details about how it breaks the current protocol and lead a deadlock.

The fix is done in node manager instead of ray syncer or scheduler. It's not idea because even the local status not changing, it's still going to cost some cpu to update the cluster resource manager. But due to the bad code in resource manager/cluster resource scheduler/cluster task manager/..., it's hard to make it optimal and easy to understand. Given that it's still much better than before and we only update every 3s by default, it should be ok. We'll revisit it once we roll it out by default.

Related issue number

Checks

Signed-off-by: Yi Cheng <[email protected]>
Signed-off-by: Yi Cheng <[email protected]>
Signed-off-by: Yi Cheng <[email protected]>
Signed-off-by: Yi Cheng <[email protected]>
Signed-off-by: Yi Cheng <[email protected]>
Signed-off-by: Yi Cheng <[email protected]>
Signed-off-by: Yi Cheng <[email protected]>
Signed-off-by: Yi Cheng <[email protected]>
Signed-off-by: Yi Cheng <[email protected]>
@fishbone fishbone changed the title Refresh msg [core] Force message refresh if no message is received in ray syncer mode. Nov 1, 2022
@fishbone
fishbone marked this pull request as ready for review November 2, 2022 07:39
@fishbone

fishbone commented Nov 3, 2022

Copy link
Copy Markdown
Contributor Author

synced with @jjyao offline. One concern is about the some corner cases where allocate happens but new message hasn't received, but refresh happened.

It's actually also happening in the current code.

I'll try to fix this with syncer too.

Signed-off-by: Yi Cheng <[email protected]>

@jjyao jjyao left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lg

Comment thread src/ray/common/ray_config_def.h Outdated
RAY_CONFIG(bool, use_ray_syncer, false)
/// Due to the protocol draw back, raylet needs to refresh the message if
/// no message is received for a while.
RAY_CONFIG(int64_t, message_refresh_interval_ms, 3000)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

maybe name it ray_syncer_message_refresh_interval_ms for now until ray syner is rolled out.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Also add a link to the protocol draw back for future reference.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think we need this until the protocol is updated.

We'll roll out ray syncer with this config.

I'll add comment and rename it.

Comment thread src/ray/raylet/node_manager.cc Resolved
Signed-off-by: Yi Cheng <[email protected]>
Comment thread src/ray/common/ray_config_def.h Outdated

/// Feature flag to use the ray syncer for resource synchronization
RAY_CONFIG(bool, use_ray_syncer, false)
/// Due to the protocol draw back, raylet needs to refresh the message if

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

drawback

Signed-off-by: Yi Cheng <[email protected]>
@fishbone
fishbone merged commit c6d6cd9 into ray-project:master Nov 7, 2022
WeichenXu123 pushed a commit to WeichenXu123/ray that referenced this pull request Dec 19, 2022
…mode. (ray-project#29905)

In the current protocol of scheduling, it depends on resource refresh to fix some deadlocks. Ray syncer will only send the message if it's updated, so it breaks the previous assumption.

The idea case is to fix the protocol, but it's way more complicated. So instead we fix it by making it the same as before.

[Here](ray-project@da74e7e#diff-09f46509f86d054afbfa3f7d08dff86e821c15001a79705ce7f4d67fc3fa1ad4R359) is more details about how it breaks the current protocol and lead a deadlock.

The fix is done in node manager instead of ray syncer or scheduler. It's not idea because even the local status not changing, it's still going to cost some cpu to update the cluster resource manager. But due to the bad code in resource manager/cluster resource scheduler/cluster task manager/..., it's hard to make it optimal and easy to understand. Given that it's still much better than before and we only update every 3s by default, it should be ok. We'll revisit it once we roll it out by default.

Signed-off-by: Weichen Xu <[email protected]>
fishbone added a commit that referenced this pull request Apr 26, 2023
… on. (#34687)

## Why are these changes needed?
The new communication protocol will only deliver the message when necessary. But some part of ray assumes that even no new message generated, it'll still get the delivery and thus it ends up incorrect resource number.

For example, in GCS's view
- GCS's view has Node: {CPU: 1} 
- Then GCS tries to schedule a task => Node: {CPU: 0}
- Then GCS got a snapshot from that node, and that node has PG scheduled,
- Then it becomes {CPU:0, PG:1}, and the previous pg scheduling failed. So, GCS'll add it back and in the end it's {CPU:1, PG:1} which is incorrect.
- Later GCS will try to schedule task to this node and this node will reject since it doesn't have any CPU left.



This issue happens in both raylet and GCS. In raylet, distributed task scheduling can suffer from this issue. In GCS, placement group can suffer from this issue.

In test_placement_group_3.py, it's because the scheduling of a placement group bundle failed and in the same time, it get the snapshot. So in the end it has one cpu in the GCS's view. PG's scheduling algorithm is deterministic, so it'll try to reschedule the bundles infinitely.

The raylet issue was fixed in [29905](#29905). This PR move the logic from node manager to cluster resource manager.

The logic is not added into ray syncer is because it's more related to application's logical about how to handle the update.
Besides, only one module needs to update. The future receiver needs to not assume the eventually delivery of the repeat messages.
ProjectsByJackHe pushed a commit to ProjectsByJackHe/ray that referenced this pull request May 4, 2023
… on. (ray-project#34687)

## Why are these changes needed?
The new communication protocol will only deliver the message when necessary. But some part of ray assumes that even no new message generated, it'll still get the delivery and thus it ends up incorrect resource number.

For example, in GCS's view
- GCS's view has Node: {CPU: 1}
- Then GCS tries to schedule a task => Node: {CPU: 0}
- Then GCS got a snapshot from that node, and that node has PG scheduled,
- Then it becomes {CPU:0, PG:1}, and the previous pg scheduling failed. So, GCS'll add it back and in the end it's {CPU:1, PG:1} which is incorrect.
- Later GCS will try to schedule task to this node and this node will reject since it doesn't have any CPU left.

This issue happens in both raylet and GCS. In raylet, distributed task scheduling can suffer from this issue. In GCS, placement group can suffer from this issue.

In test_placement_group_3.py, it's because the scheduling of a placement group bundle failed and in the same time, it get the snapshot. So in the end it has one cpu in the GCS's view. PG's scheduling algorithm is deterministic, so it'll try to reschedule the bundles infinitely.

The raylet issue was fixed in [29905](ray-project#29905). This PR move the logic from node manager to cluster resource manager.

The logic is not added into ray syncer is because it's more related to application's logical about how to handle the update.
Besides, only one module needs to update. The future receiver needs to not assume the eventually delivery of the repeat messages.

Signed-off-by: Jack He <[email protected]>
architkulkarni pushed a commit to architkulkarni/ray that referenced this pull request May 16, 2023
… on. (ray-project#34687)

## Why are these changes needed?
The new communication protocol will only deliver the message when necessary. But some part of ray assumes that even no new message generated, it'll still get the delivery and thus it ends up incorrect resource number.

For example, in GCS's view
- GCS's view has Node: {CPU: 1} 
- Then GCS tries to schedule a task => Node: {CPU: 0}
- Then GCS got a snapshot from that node, and that node has PG scheduled,
- Then it becomes {CPU:0, PG:1}, and the previous pg scheduling failed. So, GCS'll add it back and in the end it's {CPU:1, PG:1} which is incorrect.
- Later GCS will try to schedule task to this node and this node will reject since it doesn't have any CPU left.



This issue happens in both raylet and GCS. In raylet, distributed task scheduling can suffer from this issue. In GCS, placement group can suffer from this issue.

In test_placement_group_3.py, it's because the scheduling of a placement group bundle failed and in the same time, it get the snapshot. So in the end it has one cpu in the GCS's view. PG's scheduling algorithm is deterministic, so it'll try to reschedule the bundles infinitely.

The raylet issue was fixed in [29905](ray-project#29905). This PR move the logic from node manager to cluster resource manager.

The logic is not added into ray syncer is because it's more related to application's logical about how to handle the update.
Besides, only one module needs to update. The future receiver needs to not assume the eventually delivery of the repeat messages.
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