Skip to content

Merge ms close time - #5454

Draft
SirTyson wants to merge 4 commits into
stellar:overlay-v2-sharedfrom
SirTyson:merge-ms-close-time
Draft

SirTyson wants to merge 4 commits into
stellar:overlay-v2-sharedfrom
SirTyson:merge-ms-close-time

Conversation

@SirTyson

Copy link
Copy Markdown
Contributor

Description

Merges in #5423.

This change adds ms closeTime. By itself, it doesn't improve TPS or latency significantly. However, it reduces our long tail fo very slow blocks, and also allows us to target intrasecond or subsecond block times, which are not currently possible at whole second resolution.

In addition to taking the change from the PR, the 2nd commit makes some minor adjustments to when we call the fallback timer. This was intentionally conservative for main net launch assuming lots of drifting clocks, but no reason we can't tighten it here.

Results, measured with 10 tier 1 topology (no watchers) with 2 second block time target:

2000 TPS

Metric Original overlay-v2-shared Changes
Median block interval 2.090 s 1.993 s
p99 block interval 4.563 s 4.298 s
Maximum block interval 6.219 s 5.090 s
Harness verdict FAIL FAIL

Rebased on #5453 so opening as a draft for now.

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

While the current logic intertwines reads and writes, in fact it can be cleanly separated into a read-only validation step, and a sequential commit step that simply bumps the sequence numbers and removes pre-authorized tx signers. This is possible because that while the writes change the entries that take part in validation, none of these changes are relevant during the validation. Specifically, sequence number bump is only observable by a single transaction (the one that has the respective account as a source), and the pre-authorized tx signer by definition belongs to a single transaction. There is also a subtle caveat to the latter operation: it increases the available balance of the signer owner (or its sponsor), but since at the pre-apply time the fees have already been charged, we're only checking that the account available balance is non-negative, which is an invariant that must always hold in the current protocol.

The change is not protocol-gated because it's not a protocol change for the *current* protocol. It was technically a protocol change prior to p26 where we had a bug that actually did allow overcharging the fee bump source accounts and thus making their available balance to go negative. However, the bug has been fixed without the behavior ever triggering on-chain, and thus this replay-only behavior change should be non-observable.

This change significantly speeds up the pre-apply step. On the local high TPL benchmarks I'm getting 30-60ms improvement locally compared to the main branch version.

(cherry picked from commit 3e8d70b)
This affects both nominating a new transaction set, and validating the incoming transaction set. Thanks to the fact that most of the time we're either applying the ledger, or validating a transaction set, we can use the efficient CPU-pinned batch executor for this.

This speeds up the invalid transaction trimming step by ~20ms on large benchmarks, and in general should increase the transaction validation step proportionally to the number of cores.

(cherry picked from commit e154b21)
Integrate 2061b31 on the parallel-validation branch. Enable millisecond close times at protocol 28 and adapt timestamp validation, scheduling, storage, overlay XDR handling, and regression fixtures. Preserve the fee-payer behavior of the current branch.
…ance

Integrate the trigger timestamp bookkeeping from 9193e36 and the elapsed-time heuristic from 209e581. Credit steady-clock time through first ballot entry, preserve clock drift fallbacks, and cover slow rounds, delayed callbacks, missing history, and ballot overlap. Keep the existing proposal preparation policy.
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