Skip to content

Commit

Permalink
[core] Make number of connections and thread number of object manager…
Browse files Browse the repository at this point in the history
… client tunable. (ray-project#41421)

The number of connections will impact the transfer performance. Make it tunable for now so that the user can just increase it on demands.
  • Loading branch information
fishbone committed Dec 1, 2023
1 parent 11cd1d9 commit 091531c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
11 changes: 11 additions & 0 deletions src/ray/common/ray_config_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -886,3 +886,14 @@ RAY_CONFIG(bool, enable_autoscaler_v2, false)
// Python GCS client number of reconnection retry and timeout.
RAY_CONFIG(int64_t, nums_py_gcs_reconnect_retry, 5)
RAY_CONFIG(int64_t, py_gcs_connect_timeout_s, 30)

// The number of sockets between object manager.
// The higher the number the higher throughput of the data
// trasfer it'll be, but it'll also user more sockets and
// more CPU resources.
RAY_CONFIG(int, object_manager_client_connection_num, 4)

// The number of object manager thread. By default, it's
// std::min(std::max(2, num_cpus / 4), 8)
// Update this to overwrite it.
RAY_CONFIG(int, object_manager_rpc_threads_num, 0)
4 changes: 4 additions & 0 deletions src/ray/raylet/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,10 @@ int main(int argc, char *argv[]) {

object_manager_config.rpc_service_threads_number =
std::min(std::max(2, num_cpus / 4), 8);
if (RayConfig::instance().object_manager_rpc_threads_num() != 0) {
object_manager_config.rpc_service_threads_number =
RayConfig::instance().object_manager_rpc_threads_num();
}
object_manager_config.object_chunk_size =
RayConfig::instance().object_manager_default_chunk_size();

Expand Down
3 changes: 2 additions & 1 deletion src/ray/rpc/object_manager/object_manager_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ class ObjectManagerClient {
ObjectManagerClient(const std::string &address,
const int port,
ClientCallManager &client_call_manager,
int num_connections = 4)
int num_connections =
::RayConfig::instance().object_manager_client_connection_num())
: num_connections_(num_connections) {
push_rr_index_ = rand() % num_connections_;
pull_rr_index_ = rand() % num_connections_;
Expand Down

0 comments on commit 091531c

Please sign in to comment.