Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 20 additions & 8 deletions src/simulation/ApplyLoad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,12 @@ getUpgradeConfigForMaxTPS(Config const& cfg, uint64_t instructionsPerCluster,

return upgradeConfig;
}

uint32_t
convertTPStoTPL(uint32_t tps, uint32_t closeTimeMs)
{
return static_cast<uint32_t>(std::ceil(tps * closeTimeMs / 1000.0));
Comment thread
dmkozh marked this conversation as resolved.
}
} // namespace

/*
Expand Down Expand Up @@ -700,9 +706,9 @@ ApplyLoad::ApplyLoad(Application& app)
2;
break;
case ApplyLoadMode::MAX_SAC_TPS:
mNumAccounts = config.APPLY_LOAD_MAX_SAC_TPS_MAX_TPS *
config.SOROBAN_TRANSACTION_QUEUE_SIZE_MULTIPLIER *
config.APPLY_LOAD_TARGET_CLOSE_TIME_MS / 1000.0 +
mNumAccounts = convertTPStoTPL(config.APPLY_LOAD_MAX_SAC_TPS_MAX_TPS,
config.APPLY_LOAD_TARGET_CLOSE_TIME_MS) *
config.SOROBAN_TRANSACTION_QUEUE_SIZE_MULTIPLIER +
config.APPLY_LOAD_CLASSIC_TXS_PER_LEDGER;
break;
case ApplyLoadMode::BENCHMARK_MODEL_TX:
Expand Down Expand Up @@ -1125,7 +1131,9 @@ ApplyLoad::setupBatchTransferContracts()
// We need to transfer enough XLM to cover all batch transfers
// Each batch will transfer APPLY_LOAD_BATCH_SAC_COUNT * 1 stroop
int64_t maxTxsPerCluster =
mApp.getConfig().APPLY_LOAD_MAX_SAC_TPS_MAX_TPS / numClusters;
convertTPStoTPL(mApp.getConfig().APPLY_LOAD_MAX_SAC_TPS_MAX_TPS,
mApp.getConfig().APPLY_LOAD_TARGET_CLOSE_TIME_MS) /
numClusters;
int64_t amountToTransfer =
mApp.getConfig().APPLY_LOAD_BATCH_SAC_COUNT * // Sent per tx
Comment thread
dmkozh marked this conversation as resolved.
maxTxsPerCluster * // Max txs per ledger per cluster
Expand Down Expand Up @@ -1626,10 +1634,14 @@ ApplyLoad::findMaxSacTps()
txsPerStep;
}
uint32_t minSteps = std::max(
1u, mApp.getConfig().APPLY_LOAD_MAX_SAC_TPS_MIN_TPS / txsPerStep);
uint32_t maxSteps = std::ceil(
static_cast<double>(mApp.getConfig().APPLY_LOAD_MAX_SAC_TPS_MAX_TPS) /
txsPerStep);
1u, convertTPStoTPL(mApp.getConfig().APPLY_LOAD_MAX_SAC_TPS_MIN_TPS,
mApp.getConfig().APPLY_LOAD_TARGET_CLOSE_TIME_MS) /
txsPerStep);
Comment thread
dmkozh marked this conversation as resolved.
uint32_t maxSteps =
std::ceil(static_cast<double>(convertTPStoTPL(
mApp.getConfig().APPLY_LOAD_MAX_SAC_TPS_MAX_TPS,
mApp.getConfig().APPLY_LOAD_TARGET_CLOSE_TIME_MS)) /
txsPerStep);

double targetCloseTimeMs = mApp.getConfig().APPLY_LOAD_TARGET_CLOSE_TIME_MS;

Expand Down
6 changes: 3 additions & 3 deletions src/simulation/test/LoadGeneratorTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1071,10 +1071,10 @@ TEST_CASE("apply load find max SAC TPS",
cfg.GENESIS_TEST_ACCOUNT_COUNT = 10000;

// Configure test parameters for MAX_SAC_TPS mode
cfg.APPLY_LOAD_TARGET_CLOSE_TIME_MS = 1500;
cfg.APPLY_LOAD_TARGET_CLOSE_TIME_MS = 300;
cfg.APPLY_LOAD_LEDGER_MAX_DEPENDENT_TX_CLUSTERS = 2;
cfg.APPLY_LOAD_MAX_SAC_TPS_MIN_TPS = 1;
cfg.APPLY_LOAD_MAX_SAC_TPS_MAX_TPS = 1500;
cfg.APPLY_LOAD_MAX_SAC_TPS_MIN_TPS = 1000;
cfg.APPLY_LOAD_MAX_SAC_TPS_MAX_TPS = 2000;
cfg.APPLY_LOAD_NUM_LEDGERS = 30;
cfg.APPLY_LOAD_BATCH_SAC_COUNT = 2;
cfg.APPLY_LOAD_CLASSIC_TXS_PER_LEDGER = 100;
Expand Down
Loading