Skip to content

perf: streamline pipeline decoding and heartbeat replicas - #32918

Merged
XuPeng-SH merged 3 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/c09-c25
Nov 19, 2026
Merged

XuPeng-SH merged 3 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/c09-c25

Conversation

@XuPeng-SH

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

Related to #32278 (C09 and C25; the umbrella issue remains open).

What this PR does / why we need it:

Pipeline batch decoding currently walks the stable envelope to find the grouping boundary and repeats the same framing walk while decoding provenance. Reuse the validated boundary while retaining the checked stable decoder, the existing provenance/grouping validation, and the wire format. Vector decoding already clears grouping on receiver reuse, so remove the redundant second reset.

Build LogService heartbeat replica slices with one exact reservation after the first ready shard. A bounded scan counts the remaining ready shards; empty and all-pending snapshots retain the existing empty slice without allocating a backing array. Pending filtering, order, epoch checks, maps, and protobuf output are unchanged. This adds one scan of the remaining shard snapshot when at least one shard is ready.

On the same local Go toolchain and Apple M4, seven-sample pipeline benchmarks retained the same allocation counts and showed small CPU reductions; five-sample new-receiver and grouped-provenance controls showed no allocation increase. A five-sample real-store heartbeat benchmark with eight additional ready shards went from 19 to 16 allocations and 3,737 to 2,729 B/op. These are local microbenchmarks, not production latency measurements.

Validation:

  • Batch normal and race package tests, plus pipeline sender/grouping and remote admission consumer tests.
  • LogService normal and race package tests, heartbeat producer/RPC and HAKeeper state-machine tests; deterministic empty, pending, mixed-order, map, epoch, and protobuf cases.
  • Changed-package gofmt, go vet, and golangci-lint.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@mergify

mergify Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

This pull request is merged.

@XuPeng-SH

XuPeng-SH commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor Author

mo-bot review · mo-bot-local · superseded

Commit: ec81d78e65165ca9c18a86637073ef63cd162833

"interrupted"

@XuPeng-SH

XuPeng-SH commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor Author

mo-bot review · mo-bot-local · done

Commit: 501f1b3af05e335ad94101a898688112dfc7c2af

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mo-bot review · mo-bot-local · review

Commit: 501f1b3af05e335ad94101a898688112dfc7c2af

Assessment: approve

Pipeline decoding reuses the validated batch boundary and delegates vector reset to the existing decoder. LogService reserves space for exactly the ready replicas in its existing snapshot, preserving heartbeat contents and order.

Model: gpt-6.2-sol / xhigh

Session: 01a1f0a0-5126-78f3-9ab8-ef4e87f2f119 · slot 0 · generation 3

Validation:

  • Eight focused compile tests passed on the assigned head, covering sender framing, receiver admission, and provenance cleanup after a grouping error.

  • The full batch, LogService, and HAKeeper suites passed on the earlier PR head. Dependency comparison confirmed that the rebase changed none of the inputs to those runs.

  • Five serial samples per revision showed unchanged pipeline allocation counts. Median decode time fell about 4–5% in the plain cases and was nearly unchanged with grouped v2 provenance.

  • With nine ready replicas, the real-store heartbeat benchmark fell from 7,453 to 4,267 bytes and from 21 to 17 allocations per operation. The one-replica control stayed at 536 bytes and 13 allocations.

  • The source remained clean. All current and reused receipts are indexed in validation-reconciliation.json.

Limitations:

  • The initial batch benchmarks overlapped with compilation. The timing comparison uses the serial rerun.

  • The benchmarks measure local components. Distributed BVT was still in progress in the frozen CI snapshot.

@XuPeng-SH
XuPeng-SH merged commit 573f480 into matrixorigin:main Nov 19, 2026

This branch was previously deployed

1 inactive deployment
ci — 501f1b3a Deployed Nov 19, 2026 by XuPeng-SH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/enhancement size/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants