Repository navigation
fix(pd): keep overloaded masters from dropping healthy peers - #1778
Merged
sufubao merged 7 commits intoDec 3, 2026
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
A single PD master HTTP worker serves chat requests, P/D registration sockets, and health probes on the same event loop. Synchronous chat template rendering and token counts can delay heartbeat reads under CPU pressure. On a fixed topology, removing a healthy registration after a late local deadline makes
/healthreturn 503. The incident logs establish the sequence from missed heartbeats to the failed probe. The initial production stall has no matching stack sample or CPU scheduling trace.Changes
/livenessruns on the event loop.Verification at
6007dc88c9e0c01e43(three PD abort fixtures and two DSV4 page-size cases). The cancelled-encoding and equal-metadata re-registration regressions both fail on the previous headaab67f60dand pass here./tokensrequest pairs returned 200 with counts of 200000 and 8. The Anthropic token-count route returned 200 for both short and long messages. The pip/uv stock-to-patch upgrade was tested onaab67f60d./tokenswith 64 KiB chunked uploads received complete 429 responses. On a single HTTP/2 connection, an ordinary request received 429,/livenessreturned 200, and the already open SSE delivered[DONE].CPU-limited replay
Each run sent 564 synthetic streaming requests to a real single-worker PD master under a kernel-verified quota of 7500 µs per 100000 µs. The 2P2D peers ran on separate CPUs and simulated GPU output. All runs used the same patched Hypercorn build. Client probes had a three-second deadline. SSE completion required HTTP 200, the final event and no stream error.
9e0c01e43aab67f60d6007dc88c6007dc88cOn the PR base, 13 chats received HTTP 500 and 71 hit the client deadline. The previous and current heads were replayed side by side after all 18 P/D registrations were active. All three client connection errors on the previous head and all six on the current head occurred on reused HTTP/1.1 connections. A second current-head run with a fresh chat connection per request completed 76 streams and returned 488 HTTP 429s. The first exploratory current-head run, started as soon as the topology became ready, had 58 complete streams, 496 rate limits, and 10 client connection errors.
The current head kept all 18 P/D registrations in the paired runs. A downstream health request can still fail under this quota, and the server can log 503 after the probing client has timed out. These measurements cover the HTTP worker, its probes and the registration protocol. Production CPU quota, GPU inference and Kubernetes restarts were outside the replay.
Earlier load matrix and peer recovery checks at d213de6
The original overload replay used commit
d213de6e5, where 428 focused pytest cases passed in the serving image. The replay used a real single-worker PD master, mock P/D peers on separate CPUs, streamed responses and client-side HTTP probes. Each load group used the same synthetic request sizes and timing. CPU quotas were checked in the kernel.At 0.075 CPU the two candidate runs rejected more requests up front and completed fewer chats than the parent. Every candidate chat received a complete stream or an explicit 429. The parent had 52 chat timeouts at that quota. All client-side probe timeouts in this replay used a three-second deadline.
Loss of one deliberately disconnected mock Decode was observed in 0.70–2.03 seconds across five candidate runs. Readiness and health returned 503 with the peer absent, liveness returned 200, and a new chat completed after re-registration without restarting the master. A connected but silent peer received WebSocket 1011 after 30.00 seconds on a healthy loop.
The replay covers the application and its probes. Kubernetes restart behavior and GPU inference are outside this experiment. Under extreme CPU limits, 429 responses, client deadlines and individual probe timeouts still represent real capacity limits.