-
Notifications
You must be signed in to change notification settings - Fork 1k
Add apply-load mode for searching ledger limits. #5031
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this 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_TXenum value with correspondingfindMaxLimitsForModelTransaction()implementation that uses binary search with rounding to find optimal limits - Refactors existing apply-load functionality by extracting common code into
execute(),benchmarkLimits(), andbenchmarkLimitsIteration()methods - Consolidates
APPLY_LOAD_MAX_SAC_TPS_TARGET_CLOSE_TIME_MSandAPPLY_LOAD_TARGET_CLOSE_TIME_MSconfig 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 |
91a229c to
32881d8
Compare
32881d8 to
d0553f8
Compare
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
d0553f8 to
6c0bcc7
Compare
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
clang-formatv8.0.0 (viamake formator the Visual Studio extension)