Skip to content

[core] Revert server CreateCall creation change #55904 - #59448

Merged
dayshah merged 1 commit into
ray-project:masterfrom
dayshah:revert-create-call
Dec 16, 2025
Merged

dayshah merged 1 commit into
ray-project:masterfrom
dayshah:revert-create-call

Conversation

@dayshah

@dayshah dayshah commented Dec 15, 2025 •

Copy link
Copy Markdown
Contributor

Description

Reverting #55904

If you look at multi_client_put_calls_Plasma_Store on master vs. this revert:
master - https://buildkite.com/ray-project/release/builds/71968#019b2460-2b3d-42a8-bb3c-3eef1fa779df/567-689
this revert - https://buildkite.com/ray-project/release/builds/71926#019b23c7-63e6-4b80-b2dd-9ea26510baf0/576-698

You'll see a 2x throughput increase due to this. This microbenchmark is just doing

@ray.remote
def do_put_small():
    for _ in range(100):
        ray.put(0)

ray.get([do_put_small.remote() for _ in range(10)])

The interesting thing is that for the next test over single_client_put_gigabytes which does:

arr = np.zeros(100 * 1024 * 1024, dtype=np.int64)
ray.put(arr)

We get a reproducible ~50% improvement with the change.
13s on master, 18s with the revert

This shows that this change does have a significant perf impact, both positive and negative and is probably worth digging into more in the future. Reverting for now though until we have more time to understand why there's a big difference on just puts. (nothing else except these put benchmarks really moved at all...)

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request reverts a change, moving a block of code from HandleRequest back into HandleRequestImpl. This is a good change as it moves potentially blocking operations (like WaitUntilInitialized) off the critical gRPC completion queue polling thread and onto an io_service worker thread. This should improve server responsiveness. I've found a potential data race on the state_ member variable that is accessed by multiple threads without synchronization. Please see my detailed comment.

Comment thread src/ray/rpc/server_call.h Resolved
@dayshah dayshah added the go add ONLY when ready to merge, run all tests label Dec 16, 2025
@dayshah
dayshah marked this pull request as ready for review December 16, 2025 01:32
@dayshah
dayshah requested a review from a team as a code owner December 16, 2025 01:32
@dayshah dayshah changed the title [core] Test server call change revert [core] Revert server call creation change Dec 16, 2025
@dayshah dayshah changed the title [core] Revert server call creation change [core] Revert server CreateCall creation change #55904 Dec 16, 2025
@Yicheng-Lu-llll

Copy link
Copy Markdown
Member

Sure! Let’s revert first.

It makes sense to me that for small puts, the bottleneck is the polling speed, and having CreateCall in the polling path actually slows down the polling.

For large puts, I’m not sure why there is such a significant time difference.

@dayshah

dayshah commented Dec 16, 2025

Copy link
Copy Markdown
Contributor Author

It makes sense to me that for small puts, the bottleneck is the polling speed, and having CreateCall in the polling path actually slows down the polling.

Ya I guess the thought is that the polling thread is more the bottleneck than the io service thread, but that's pretty unlikely in realistic ray workloads, but possible in a benchmark. But I still wouldn't expect a 2x difference... it seems pretty extreme.

@dayshah
dayshah enabled auto-merge (squash) December 16, 2025 02:29
@dayshah
dayshah merged commit 8d9a15f into ray-project:master Dec 16, 2025
@dayshah
dayshah deleted the revert-create-call branch December 16, 2025 04:20
kriyanshii pushed a commit to kriyanshii/ray that referenced this pull request Dec 16, 2025
xyuzh added a commit to xyuzh/ray that referenced this pull request Jul 31, 2026
…ight-reads io_context

GetClusterId is a lock-free read of an immutable value, but its handler is
posted to the single-threaded node_manager_io_context shared with
RegisterNode/GetAllNodeInfo/CheckAlive. During mass node registration the
loop's queue delay exceeds client deadlines, and DEADLINE_EXCEEDED maps to
TimedOut which IsGrpcRetryableStatus deliberately never retries — so every
connecting process's cluster-ID fetch dies on a constant-value read
(observed as cluster bring-up collapse at 400 nodes).

Fix by isolation on an existing axis instead of new dispatch machinery: add
a dedicated lightweight_rpc_reads_io_context to GcsServerIOContextPolicy
(the GCS's existing mechanism for isolating workloads), and a
RPC_SERVICE_HANDLER_CUSTOM_AUTH_IN_IO_CONTEXT macro variant that posts one
handler to an explicit io_context (_RPC_SERVICE_HANDLER now delegates with
the service's main_service_). GetClusterId is the only opt-in; CheckAlive,
which is starved by the same storms, can follow. A slow handler on the
dedicated loop hurts only itself — unlike inline dispatch on the gRPC
polling thread, which ray-project#55904 tried wholesale and ray-project#59448 reverted for a 2x
plasma-put regression.

Tests: an rpc-layer test proving a handler bound to a dedicated io_context
replies while the service's io_context never runs, and a GCS-layer
regression test that blocks the node_manager io_context and asserts a
2s-deadline SyncGetClusterId still succeeds (fails pre-fix).

Signed-off-by: xyuzh <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants