Skip to content

Conversation

@dmkozh
Copy link
Contributor

@dmkozh dmkozh commented Nov 22, 2025

Description

Add apply-load mode for searching ledger limits.

The new mode finds the ledger limits that allow applying the maximum possible TPL that still allows closing ledgers within the configured time limit, e.g. find how many Soroswap-like transactions can be applied within N ms, and what are the respective ledger limits (with some rounding to get nicer numbers).

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

Copilot AI review requested due to automatic review settings November 22, 2025 00:44
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a new "limits-for-model-tx" mode to the apply-load benchmark tool that automatically finds optimal ledger limits for a given "model" transaction type. The mode performs a binary search to determine the maximum number of model transactions that can be applied within a target close time, then calculates corresponding ledger limits.

Key Changes

  • Introduces ApplyLoadMode::FIND_LIMITS_FOR_MODEL_TX enum value with corresponding findMaxLimitsForModelTransaction() implementation that uses binary search with rounding to find optimal limits
  • Refactors existing apply-load functionality by extracting common code into execute(), benchmarkLimits(), and benchmarkLimitsIteration() methods
  • Consolidates APPLY_LOAD_MAX_SAC_TPS_TARGET_CLOSE_TIME_MS and APPLY_LOAD_TARGET_CLOSE_TIME_MS config parameters for use across multiple modes

Reviewed changes

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

Show a summary per file
File Description
src/simulation/ApplyLoad.h Adds new mode enum, refactors public API with execute() method, and adds private methods for each mode (benchmarkLimits(), findMaxLimitsForModelTransaction(), findMaxSacTps())
src/simulation/ApplyLoad.cpp Implements binary search logic for finding optimal limits, refactors benchmark code into mode-specific methods, adds validation for model transaction parameters, and updates hot archive entry calculation
src/simulation/TxGenerator.h Adds SOROBAN_LOAD_V2_EVENT_SIZE_BYTES constant for event size calculations
src/simulation/TxGenerator.cpp Refactors resource assignment to use target instructions directly, improving consistency with model transaction configuration
src/simulation/test/LoadGeneratorTests.cpp Updates existing test to use execute() method and adds new test for FIND_LIMITS_FOR_MODEL_TX mode
src/main/Config.h Renames and consolidates target close time configuration, adds documentation for ledger count parameter usage
src/main/Config.cpp Updates config parsing for renamed parameter
src/main/CommandLine.cpp Adds parsing for "limits-for-model-tx" mode, consolidates benchmark execution into execute() call, moves output logging into ApplyLoad class
docs/software/commands.md Documents the three apply-load modes including the new limits-for-model-tx mode
docs/apply-load-limits-for-model-tx.cfg Provides example configuration file with detailed comments for the new mode

@dmkozh dmkozh force-pushed the apply_load_tps_limits branch from 91a229c to 32881d8 Compare December 10, 2025 00:52
@dmkozh dmkozh force-pushed the apply_load_tps_limits branch from 32881d8 to d0553f8 Compare December 18, 2025 17:04
The new mode finds the ledger limits that allow applying the maximum possible TPL that still allows closing ledgers within the configured time limit, e.g. find how many Soroswap-like transactions can be applied within N ms, and what are the respective ledger limits (with some rounding to get nicer numbers).

Rebase updates
@dmkozh dmkozh force-pushed the apply_load_tps_limits branch from d0553f8 to 6c0bcc7 Compare January 3, 2026 01:10
@dmkozh dmkozh added this pull request to the merge queue Jan 5, 2026
Merged via the queue into stellar:master with commit 8200fa5 Jan 5, 2026
48 checks passed
@dmkozh dmkozh deleted the apply_load_tps_limits branch January 5, 2026 19:50
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.

2 participants