Reduce ulitebox broker startup latency - #1494
Closed
Weidong Cui (wdcui) wants to merge 4 commits into
Closed
Weidong Cui (wdcui) wants to merge 4 commits into
Weidong Cui (wdcui) wants to merge 4 commits into
Conversation
- Resolve overlay lookups without redundant lower-layer probes. - Map the initial-files tar archive instead of reading it into memory. - Copy shared-memory ring and buffer data directly via peer_memory. - Let a runner caller take the response-reader role instead of a dedicated responses thread; notify full-ring waiters only on the full-to-not-full transition. - Run broker requests with a blocking-handoff worker pool that starts workers lazily, only when a request is about to block. - Lease the lowest free shared-buffer slots so pages stay warm. - End notification receipt cleanly when the local side closes its association, removing spurious exit-time errors. - Wait for the in-process runner's control connection instead of sleeping between accept attempts. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: b5ed1835-8e32-4a35-aae1-8d8a8a276d09
- Add a defaulted `PageManagementProvider::advise_fill` hint, which the Linux shim gives before copying file contents into a new mapping. The Linux userland platform backs such ranges with transparent huge pages, so the copy takes one fault and clear per 2 MiB instead of per page, while pages past the end of the file stay lazily allocated. - Read tar file contents through `TarStorage::read_exact_at`, which the userland broker's mapped archive serves with positional reads, so the broker no longer maps every page it serves and tears them down at exit. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: b5ed1835-8e32-4a35-aae1-8d8a8a276d09
Read each mutable upper directory in a single listing so a lookup's entry, whiteout, and opaque marker come from one snapshot, list each layer once when enumerating a directory, and end notification receipt cleanly when an acknowledgement fails because the local call channel was closed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: b5ed1835-8e32-4a35-aae1-8d8a8a276d09
The in-process runner is for development and testing only, so its startup does not need optimizing. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: b5ed1835-8e32-4a35-aae1-8d8a8a276d09
|
🤖 SemverChecks 🤖 Click for details |
Member
Author
|
Split into #1495 (overlay lookups), #1496 (tar archive mapping, stacked on #1495), #1497 (transport fast path), #1498 (lazy broker workers), and #1499 (huge-page hint); together they are tree-identical to this branch. Note that this PR's base numbers were measured against a binary that already included the overlay and tar changes; against |
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.
This PR reduces the startup latency of Linux-on-Linux ulitebox runs with the out-of-process broker (median wall time, base → this PR: static hello 9.1 → 6.6 ms, dynamic hello 21.6 → 13.5 ms,
bash -c true27.4 → 17.0 ms,python3 -c pass71.0 → 45.7 ms,node -e 0186 → 84 ms). The broker's overlay now resolves paths with per-name lookups (a newBackend::lookup_at, overridden by the in-memory and tar backends) instead of listing and merging whole directories, while still reading each mutable upper directory as one snapshot; the tar backend memory-maps the archive to build its index and reads file contents with positional reads; broker requests are served by a lazily started blocking-handoff worker pool; the shared-memory transports copy directly to and from mapped ring and buffer memory and wake the peer only when it is waiting; runner callers take turns reading responses through a reader role instead of a dispatcher thread; shared-buffer slots are leased lowest-first; a locally closed call channel ends notification receipt cleanly instead of reporting an error; and the Linux shim gives the platform a huge-page hint (PageManagementProvider::advise_fill,MADV_HUGEPAGEon Linux userland) before eagerly copying file contents into a new mapping.