Skip to content
Open
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
7 changes: 6 additions & 1 deletion docs/apply-load-benchmark-sac.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
APPLY_LOAD_MODE="benchmark"
APPLY_LOAD_MODEL_TX="sac"

# Which timing path to use: "apply" preserves the historical apply-only

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.

nit: I don't think it's correct to call the apply-only mode 'historical', both have a valid use case

# benchmark, while "txset-validation-and-apply" simulates a non-leader receiving
# and validating a tx set before applying it. Tx-set creation is not measured.
APPLY_LOAD_TIMING_PHASES = "apply"

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.

We need to add this to all the benchmark configs


# Whether to time the write part of the apply stage. This can be
# disabled to get less noisy results for non-write related changes,
# but should be enabled to get more comprehensive e2e numbers.
Expand Down Expand Up @@ -62,4 +67,4 @@ NODE_SEED="SDQVDISRYN2JXBS7ICL7QJAEKB3HWBJFP2QECXG7GZICAHBK4UNJCWK2 self"

[QUORUM_SET]
THRESHOLD_PERCENT=100
VALIDATORS=["$self"]
VALIDATORS=["$self"]
1 change: 1 addition & 0 deletions docs/metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ crypto.verify.miss | meter | number of signature cach
crypto.verify.total | meter | sum of both hits and misses
crypto.verify.tx-valid-hit | meter | signature cache hits that occurred while validating transactions (outside of background signature validation)
crypto.verify.tx-valid-total | meter | sum of both hits and misses during transaction validation (outside of background signature validation)
herder.txset.validate | timer | time spent turning a received tx set into an applicable tx set and validating it on a validity-cache miss; Tracy labels the enclosing call as a cache hit or miss
herder.pending[-soroban]-txs.age0 | counter | number of gen0 pending transactions
herder.pending[-soroban]-txs.age1 | counter | number of gen1 pending transactions
herder.pending[-soroban]-txs.age2 | counter | number of gen2 pending transactions
Expand Down
22 changes: 19 additions & 3 deletions docs/software/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ Common options can be placed at any place in the command line.
Command options can only by placed after command.

* **apply-load**: Benchmarks Soroban transaction application time using
synthetic transactions. The benchmark is isolated to mostly just executing
the transactions and thus it omits a lot of the supporting mechanisms
(such as overlay, SCP, mempool etc). This command will generate enough
synthetic transactions. The benchmark omits the overlay and mempool, but
each iteration reconstructs the tx set from serialized bytes and runs real
consensus with the node as its own single-validator quorum. It does not
simulate network transport, peer fetching, or multi-node timing.
Comment on lines +23 to +26

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 think we can just say that it may measure txset stuff

This command will generate enough
transactions to fill up a synthetic transaction queue (it's just a list of
transactions with the same limits as the real queue), and then create a
transaction set off of that to apply. This can also be used to record the
Expand All @@ -36,6 +38,20 @@ Command options can only by placed after command.
consisting only of fast SAC transfer.
- `APPLY_LOAD_MODE="benchmark"`: benchmarks a fixed-size ledger of model
transactions. Use `APPLY_LOAD_MODEL_TX` to select the model transaction.
* `APPLY_LOAD_TIMING_PHASES` selects one of two timing paths:
- `"apply"`: the default historical apply-only benchmark. Its close helper
still calls `checkValid`, but that happens before the recorded ledger-close
timer and leaves the caches warm, as consensus validation would on a live
node. Output remains in the historical format.
- `"txset-validation-and-apply"`: simulates a non-leader receiving the tx
set over the wire, validating it through local consensus, and then applying
it. It reports validation, ledger close, and end-to-end time. Leader-side
tx-set creation and signing happen before the measured span. The signature
verification cache is cleared before validation, then retained so apply
sees the warm cache produced by validation.
`"txset-validation-and-apply"` is not supported with
`APPLY_LOAD_MODE="max-sac-tps"`; that search retains its historical
apply-only timing objective.
* Load generation is configured in the Core config file. The relevant settings
all begin with `APPLY_LOAD_`. See full example configurations with
per-setting documentation in the `docs` directory
Expand Down
10 changes: 10 additions & 0 deletions src/herder/HerderSCPDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ HerderSCPDriver::SCPMetrics::SCPMetrics(Application& app)
{"scp", "timing", "self-to-others-externalize-lag"}))
, mBallotBlockedOnTxSet(app.getMetrics().NewTimer(
{"scp", "timing", "ballot-blocked-on-txset"}))
, mTxSetValidation(
app.getMetrics().NewTimer({"herder", "txset", "validate"}))
, mEmptyTxSetExternalized(
app.getMetrics().NewCounter({"scp", "empty-tx-set", "externalized"}))
, mEmptyTxSetValueReplaced(app.getMetrics().NewCounter(
Expand Down Expand Up @@ -1859,12 +1861,18 @@ HerderSCPDriver::checkAndCacheTxSetValid(TxSetXDRFrame const& txSet,
LedgerHeaderHistoryEntry const& lcl,
uint64_t closeTimeOffset) const
{
ZoneScoped;

auto key = TxSetValidityKey{lcl.hash, txSet.getContentsHash(),
closeTimeOffset, closeTimeOffset};

bool* pRes = mTxSetValidCache.maybeGet(key);
if (pRes == nullptr)
{
std::string zoneTxt("miss");
ZoneText(zoneTxt.c_str(), zoneTxt.size());

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.

nit: You should be able to use one-line ZoneNamed here, as your string is static (same for 'hit' branch)

auto validationTime = mSCPMetrics.mTxSetValidation.TimeScope();
Comment thread
SirTyson marked this conversation as resolved.

// The invariant here is that we only validate tx sets nominated
// to be applied to the current ledger state. However, in case
// if we receive a bad SCP value for the current state, we still
Expand Down Expand Up @@ -1895,6 +1903,8 @@ HerderSCPDriver::checkAndCacheTxSetValid(TxSetXDRFrame const& txSet,
}
else
{
std::string zoneTxt("hit");
ZoneText(zoneTxt.c_str(), zoneTxt.size());
return *pRes;
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/herder/HerderSCPDriver.h
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,9 @@ class HerderSCPDriver : public SCPDriver
// download
medida::Timer& mBallotBlockedOnTxSet;

// Timer tracking time to check and cache a tx set
medida::Timer& mTxSetValidation;

// Tracks how many ledgers we externalized an empty-tx-set value.
medida::Counter& mEmptyTxSetExternalized;

Expand Down
22 changes: 22 additions & 0 deletions src/main/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,23 @@ parseApplyLoadModelTx(ConfigItem const& item)
"invalid 'APPLY_LOAD_MODEL_TX', expected one of: sac, custom_token, "
"soroswap");
}

ApplyLoadTimingPhases
parseApplyLoadTimingPhases(ConfigItem const& item)
{
auto phases = readString(item);
if (phases == "apply")
{
return ApplyLoadTimingPhases::APPLY_ONLY;
}
if (phases == "txset-validation-and-apply")
{
return ApplyLoadTimingPhases::TX_SET_VALIDATION_AND_APPLY;
}
throw std::invalid_argument(
"invalid 'APPLY_LOAD_TIMING_PHASES', expected one of: apply, "
"txset-validation-and-apply");
}
#endif

template <typename T>
Expand Down Expand Up @@ -1866,6 +1883,11 @@ Config::processConfig(std::shared_ptr<cpptoml::table> t)
}},
{"APPLY_LOAD_TIME_WRITES",
[&]() { APPLY_LOAD_TIME_WRITES = readBool(item); }},
{"APPLY_LOAD_TIMING_PHASES",
[&]() {
APPLY_LOAD_TIMING_PHASES =
parseApplyLoadTimingPhases(item);
}},
#endif // BUILD_TESTS
{"GENESIS_TEST_ACCOUNT_COUNT",
[&]() {
Expand Down
11 changes: 11 additions & 0 deletions src/main/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ enum class ApplyLoadModelTx
CUSTOM_TOKEN,
SOROSWAP
};

// Which apply-load timing path to use.
enum class ApplyLoadTimingPhases
{
APPLY_ONLY,
TX_SET_VALIDATION_AND_APPLY
};
#endif

class Config : public std::enable_shared_from_this<Config>
Expand Down Expand Up @@ -425,6 +432,10 @@ class Config : public std::enable_shared_from_this<Config>
// If set to true, database writes will count towards TPS calculation.
// Otherwise, BucketList writes will not be counted.
bool APPLY_LOAD_TIME_WRITES = true;

// Which apply-load timing path to use.
ApplyLoadTimingPhases APPLY_LOAD_TIMING_PHASES =
ApplyLoadTimingPhases::APPLY_ONLY;
#endif // BUILD_TESTS

// Waits for merges to complete before applying transactions during catchup
Expand Down
Loading
Loading