Skip to content

Add txset construction mode to apply load - #5448

Merged
SirTyson merged 1 commit into
stellar:masterfrom
SirTyson:txset-builder-apply-load
Sep 17, 2026
Merged

SirTyson merged 1 commit into
stellar:masterfrom
SirTyson:txset-builder-apply-load

Conversation

@SirTyson

@SirTyson SirTyson commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Description

Adds a new mode to apply load, "txset-construction-and-apply". This mode times all leader work in a ledger, without any network work: tx set construction, validation, then application. It's the leader end-to-end variant of txset-validation-and-apply, which simulates a non-leader node with only tx set validation and application. In testing, it seems like the number of TXs in the queue has a significant impact on TX set building times, so unlike other apply load modes, this test will generate more TXs than will actually fit in the final block in order to overfill the queue.

Checklist

  • Reviewed the contributing document
  • Rebased on top of master (no merge commits)
  • Ran clang-format v8.0.0 (via make format or the Visual Studio extension)
  • Compiles
  • Ran all tests
  • If change impacts performance, include supporting evidence per the performance document

@SirTyson
SirTyson requested review from dmkozh and a balanced review from Copilot September 8, 2026 18:44

Copilot AI 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.

Pull request overview

Adds a leader-side txset-construction-and-apply benchmarking mode to measure transaction-set construction, validation, and application.

Changes:

  • Adds queue-overfilling construction mode and timing metrics.
  • Extends configuration, tests, and benchmark examples.
  • Documents the new mode and metrics.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.

Show a summary per file
File Review
src/simulation/test/LoadGeneratorTests.cpp Adds SAC coverage; missing construction-mode coverage for CUSTOM_TOKEN and SOROSWAP (nit).
src/simulation/ApplyLoad.h Declares construction timing helpers and state.
src/simulation/ApplyLoad.cpp Implements construction timing, but duplicates and omits production nomination behavior and inflates global queue metrics (moderate).
src/main/Config.h Adds the timing-mode enum value.
src/main/Config.cpp Parses the new configuration value.
src/herder/HerderImpl.h Declares the transaction-set build timer.
src/herder/HerderImpl.cpp Instruments construction, but measures a mismatched span (moderate) and lacks performance evidence (nit).
docs/software/commands.md Documents the mode as production nomination despite its synthetic implementation (moderate).
docs/metrics.md Documents the build metric.
docs/apply-load-ledger-limits.cfg Documents queue multiplier configuration.
docs/apply-load-for-meta.cfg Documents queue multiplier configuration.
docs/apply-load-benchmark-token.cfg Documents token benchmark configuration.
docs/apply-load-benchmark-sac.cfg Documents SAC benchmark configuration.
Suppressed comments (1)

src/herder/HerderImpl.cpp:1669

  • The new production-path timer adds unconditional clock reads and metric updates to every leader nomination, but the PR provides no performance evidence (the checklist item is unchecked). CONTRIBUTING.md:56-60 requires evidence of improvement and no regression for performance-impacting changes; please include measurements that quantify this instrumentation and the new benchmark mode before merging.
    auto const txSetBuildStart = std::chrono::steady_clock::now();

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread docs/software/commands.md Resolved
Comment thread src/herder/HerderImpl.cpp Resolved
Comment thread src/simulation/ApplyLoad.cpp Resolved
Comment thread src/simulation/ApplyLoad.cpp Resolved
@SirTyson
SirTyson force-pushed the txset-builder-apply-load branch from 5adc49c to d26b1a3 Compare September 10, 2026 21:44
Copilot AI review requested due to automatic review settings September 10, 2026 21:44

Copilot AI 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.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.

Suppressed comments (1)

src/herder/HerderImpl.cpp:1762

  • The newly documented production herder.txset.build metric has no test asserting that triggerNextLedger records a sample. The apply-load tests only assert the separate validation timer, so a misplaced start/end point or a missing update would go undetected. Add a Herder test that triggers nomination and verifies this timer's count increments exactly once.
    mSCPMetrics.mTxSetBuild.Update(
        std::chrono::duration_cast<std::chrono::nanoseconds>(
            std::chrono::steady_clock::now() - txSetBuildStart));

Comment thread docs/software/commands.md Resolved
Comment thread src/simulation/ApplyLoad.cpp Resolved
Comment thread src/herder/HerderImpl.cpp Resolved

@dmkozh dmkozh 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.

I've left some comments re measurements consistency between the apply modes, but I wonder if it's worth keeping two modes around in general. How much longer is a run of, say, 200/6000 SAC TPL ledgers with the txset stuff vs the old mode? If the difference is insignificant, then I don't see much point in maintaining different code paths instead of just the most comprehensive one.

Comment thread src/simulation/ApplyLoad.cpp Resolved
Comment thread src/simulation/ApplyLoad.cpp Resolved
Comment thread src/simulation/ApplyLoad.cpp Resolved
Comment thread src/simulation/ApplyLoad.cpp Resolved
@SirTyson

Copy link
Copy Markdown
Contributor Author

I wonder if it's worth keeping two modes around in general

I agree for "benchmark" and "ledger-limits" modes, but not for `"max-sac-tps". For the modes where we just dump metrics on a set amount of load, I agree that they can be unified. If we still care about doing noisy binary search via "max-sac-tps", I don't think it makes much sense to only have the one mode. Or at least, we shouldn't count the aggregate time of construction, validation, and application towards our search of "max txs we can apply in the given window."

We could just simply by having one mode, where all modes dump the stats of all phases, but for "max-sac-tps" we only count the apply phase timings towards our search, what do you think? Imo with features like parallel tx set download it doesn't make sense to time serial tx set build + validate steps towards any sort of max tps style of test.

@dmkozh

dmkozh commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

We could just simply by having one mode, where all modes dump the stats of all phases, but for "max-sac-tps" we only count the apply phase timings towards our search, what do you think?

To be clear I meant just collapsing the measurements for the benchmark modes. I agree for max-sac-tps this doesn't make much sense, but arguably max-sac-tps doesn't make much sense anymore either (as we're using TPS target with time requirements as opposed to trying to maximize TPS within limited time, which makes much more sense for optimization anyways).
I'm also not sure if these measurements are necessary for the limits-based benchmarks (which we do need for SLP evals), but I don't believe they would hurt either.

Copilot AI review requested due to automatic review settings September 14, 2026 18:29
@SirTyson
SirTyson force-pushed the txset-builder-apply-load branch from d26b1a3 to 773beae Compare September 14, 2026 18:29

Copilot AI 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.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.

Suppressed comments (2)

src/herder/HerderImpl.cpp:1762

  • This change adds steady-clock instrumentation to every production nomination and substantially increases apply-load candidate generation, but the PR provides no before/after performance evidence. CONTRIBUTING.md:58–60 requires evidence of improvement and no regression for performance-impacting changes. Please include representative benchmark results, including the nomination overhead of herder.txset.build and the new end-to-end apply-load measurements.
    // Stop before addTxSet below: its side effects can include SCP callbacks
    // and even externalizing a ledger, which are not tx set building.
    mSCPMetrics.mTxSetBuild.Update(
        std::chrono::duration_cast<std::chrono::nanoseconds>(
            std::chrono::steady_clock::now() - txSetBuildStart));

src/herder/HerderImpl.cpp:1669

  • This start point causes herder.txset.build to include close-time selection, drift-window map updates, and close-time validation (lines 1681–1734), even though the metric is documented as tx-set construction. That unrelated work makes this production metric inconsistent with the apply-load construction timer, which wraps only makeTxSetFromTransactions. Compute/validate the close time first, then time queue extraction, set building, validity caching, and banning.
    auto const txSetBuildStart = std::chrono::steady_clock::now();

Comment thread docs/software/commands.md Resolved
Comment thread src/simulation/ApplyLoad.cpp Resolved

@dmkozh dmkozh 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.

Thanks for the cleanup, it looks good to me (though I'll need to try this myself eventually to see the new metrics).
There are some stray test changes though.

@SirTyson
SirTyson enabled auto-merge September 17, 2026 18:33
@SirTyson
SirTyson added this pull request to the merge queue Sep 17, 2026
Merged via the queue into stellar:master with commit 4238712 Sep 17, 2026
63 of 65 checks passed
@SirTyson
SirTyson deleted the txset-builder-apply-load branch September 17, 2026 19:40
SirTyson added a commit to SirTyson/stellar-core that referenced this pull request Nov 9, 2026
Brings overlay-v2-shared up to date with master. The previous master
merge (b90d48e, stellar#5428) was recorded with master's tip 100cc38 missing
from its parents, so this merge used 100cc38 as its base (temporary
graft of b90d48e, removed afterwards).

Notable master changes brought in:
- Protocol 30: CURRENT_LEDGER_PROTOCOL_VERSION follows
  MAX_SUPPORTED_PROTOCOL_VERSION; CAP-0084 and CAP-0087 ungated, p29 and
  p30 Soroban hosts (stellar#5472, stellar#5478, stellar#5484, stellar#5483).
- Millisecond-resolution close times at protocol 30 (stellar#5423):
  ConsensusTime/ApplyTime types, STELLAR_VALUE_SIGNED_MS and
  STELLAR_VALUE_EMPTY_TX_SET_MS.
- Tx set validity hardening (stellar#5481), lower max message size in protocol
  29 (stellar#733), sub-second ledger edge-case fixes.
- Simplified ledger view hierarchy (stellar#5461); the overlay-only-mode
  sequence number skip now lives in TransactionFrame::checkValid.
- Banned accounts deprecated (CAP-0077 is active).
- Apply-path performance work (stellar#5402, stellar#5411, stellar#5414, stellar#5415, stellar#5418, stellar#5421,
  stellar#5436, stellar#5286), apply-load tx set construction mode (stellar#5448), --check-lcm
  (stellar#5435), v29.0.0 release merge.

Conflict resolution:
- Files overlay-v2-shared deleted and master modified (the C++ overlay,
  TransactionQueue, TransactionQueueTests, UpgradesTests, private/Horizon/RPC
  workflows): kept deleted. Master's changes to them are C++ overlay
  peer/flow-control logic, tx queue admission and tests for those.
- Herder: kept the Rust-overlay submission path (recvTransaction returns
  TxSubmitStatus) and dropped the deprecated `force` parameter as master did.
  triggerNextLedger keeps the prepared/built tx set path from the Rust
  mempool, now with ConsensusTime close times and master's apply-time
  close-time offset. The early tx set preparation path (prepareTxSet,
  buildTxSet, setupTriggerNextLedger) takes ConsensusTime. Kept master's
  mNominatedTxSetOverride test hook (applied before the tx set is cached in
  the Rust overlay) and the herder.txset.build timer (now timing
  buildTxSet). Dropped the banned-accounts setup and tx queue maintenance.
- AppConnector: dropped both ov2's maybeUpdateImmutableLedgerView and
  master's C++-overlay getOverlayThreadSnapshot.
- LoadGenerator: master's CachedTestAccountPtr with ov2's TxSubmitStatus.
- Tests: kept ov2's removal of tests that need the C++ overlay, standalone
  mode or the tx queue (standalone, manualclose, flooding, tx queue limits,
  far-future slot cleanup, herderExternalizesValuesWithProtocol, MAX_SAC_TPS,
  custom token, soroswap and noisy binary search apply-load tests). Added
  master's ms close time HerderTests and the non-canonical empty tx set test
  on ov2's Rust-overlay topologies. The tx set size test checks against
  overlay-v2's own tx set allowance. The sub-second
  getUpperBoundCloseTimeOffset test checks the offset directly, since there
  is no C++ tx queue admission. Tests that used CheckValidLedgerViewWrapper
  now use getLCLView().
- Cargo.lock: master's lockfile plus the overlay crate's packages,
  regenerated by cargo; semver-compatible duplicates take the newer
  version.
- Build: Makefile.am keeps the Rust overlay rules and adds tracy
  import-chrome; ci-build.sh keeps ASAN off and takes master's -g1.
- Needed to compile: PendingEnvelopes.cpp includes LedgerManager.h
  (master got it through the C++ OverlayManager.h); ov2's early-nomination
  and checkpoint-slot tests use ConsensusTime/ApplyTimeOffset; OverlayIPC
  tests take ledger views from the LedgerManager.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants