Repository navigation
[Core] Improve Large-Scale Resource View Synchronization Through Sync Message Batching #57641
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
Changes from all commits
1688171
65e8bc0
506fe11
af43f6f
3eacfe3
3faab25
34756c1
dfd4af2
0c30b7f
03e4853
d48b181
4f04808
0b3fd18
11cae15
4937c18
e244a3f
3c3b14f
62bfac5
b85ea02
0aa3eb1
beae7e5
82e15f2
3bdf5d7
6d0691f
e146c09
f4256cd
a29d9ef
93fb656
0adf20a
70e209a
7045296
a7909cb
853320a
5d52e4a
c6e5d98
d42cf04
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -607,9 +607,23 @@ GcsServer::StorageType GcsServer::GetStorageType() const { | |
| } | ||
|
|
||
| void GcsServer::InitRaySyncer(const GcsInitData &gcs_init_data) { | ||
| if (RayConfig::instance().gcs_resource_broadcast_max_batch_delay_ms() > 0 && | ||
| RayConfig::instance().gcs_resource_broadcast_max_batch_size() == 1) { | ||
| RAY_LOG(WARNING) << "Configuration inconsistency detected: " | ||
| "gcs_resource_broadcast_max_batch_delay_ms > 0 " | ||
| << "but gcs_resource_broadcast_max_batch_size = 1. The delay " | ||
| "setting will have no effect " | ||
| << "since only one message can be batched at a time. Consider " | ||
| "increasing batch_size or " | ||
| << "setting delay_ms to 0."; | ||
| } | ||
|
|
||
| ray_syncer_ = std::make_unique<syncer::RaySyncer>( | ||
| io_context_provider_.GetIOContext<syncer::RaySyncer>(), | ||
| kGCSNodeID.Binary(), | ||
| /* batch_size */ RayConfig::instance().gcs_resource_broadcast_max_batch_size(), | ||
| /* batch_delay_ms */ | ||
| RayConfig::instance().gcs_resource_broadcast_max_batch_delay_ms(), | ||
|
Comment on lines
+624
to
+626
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can be done separately in a follow up. If the user sets |
||
| [this](const NodeID &node_id) { | ||
| gcs_healthcheck_manager_->MarkNodeHealthy(node_id); | ||
| }); | ||
|
|
@@ -976,6 +990,7 @@ void GcsServer::TryGlobalGC() { | |
| std::string serialized_msg; | ||
| RAY_CHECK(commands_sync_message.SerializeToString(&serialized_msg)); | ||
| msg->set_sync_message(std::move(serialized_msg)); | ||
|
|
||
| ray_syncer_->BroadcastMessage(std::move(msg)); | ||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,6 +28,7 @@ namespace ray::syncer { | |
| using ray::rpc::syncer::CommandsSyncMessage; | ||
| using ray::rpc::syncer::MessageType; | ||
| using ray::rpc::syncer::RaySyncMessage; | ||
| using ray::rpc::syncer::RaySyncMessageBatch; | ||
| using ray::rpc::syncer::ResourceViewSyncMessage; | ||
|
|
||
| /// This is the base class for the bidi-streaming call and defined the method | ||
|
|
@@ -106,13 +107,23 @@ class RaySyncerBidiReactor { | |
| /// Return true if it's disconnected. | ||
| std::shared_ptr<bool> IsDisconnected() const { return disconnected_; } | ||
|
|
||
| // Set self-owned shared_ptr used to guard lifetime for async callbacks via weak_ptr | ||
| // lock. | ||
| void SetSelfRef(std::shared_ptr<RaySyncerBidiReactor> self) { | ||
| self_ref_ = std::move(self); | ||
| } | ||
|
Comment on lines
+110
to
+114
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can use |
||
|
|
||
| // Node id which is communicating with the current reactor. | ||
| std::string remote_node_id_; | ||
|
|
||
| protected: | ||
| /// Sync message observer, which is a callback on received message response. | ||
| RpcCompletionCallback on_rpc_completion_; | ||
|
|
||
| /// Self-owned shared_ptr for lifetime guarding in async callbacks (timer/dispatch). Set | ||
| /// by caller/factory, released in OnDone. | ||
| std::shared_ptr<RaySyncerBidiReactor> self_ref_; | ||
|
|
||
| private: | ||
| virtual void DoDisconnect() = 0; | ||
| std::shared_ptr<bool> disconnected_ = std::make_shared<bool>(false); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.