Skip to content
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

[BlockSTM] Sender aware transaction shuffling #6518

Merged
merged 6 commits into from
Mar 4, 2023
Merged

Conversation

sitalkedia
Copy link
Contributor

@sitalkedia sitalkedia commented Feb 7, 2023

Description

An implementation of transaction shuffler, which tries to spread transactions from same senders in a block in order to reduce conflict. On a high level, it works as follows - It defines a conflict_window_size, which maintains a set of senders added to the block in last conflict_window_size transactions. When trying to select a new transaction to the block, the shuffler tries to find a transaction which are not part of the conflicting senders in the window. If it does, it adds
the first non-conflicting transaction it finds to the block, if it doesn't then it preserves the order and adds the first transaction in the remaining block. It always maintains the following invariant in terms of ordering

  1. Relative ordering of all transactions from the same before and after shuffling is same
  2. Relative ordering of all transactions across different senders will also be maintained if they are
    non-conflicting. In other words, if the input block has only one transaction per sender, the output ordering will remain unchanged.

The shuffling algorithm is O(n) and following is the pseudo-code for it.

 loop:
   if a sender fell out of the sliding window in previous iteration,
      then: we add the first pending transaction from that sender to the block
   else while we have transactions to process in the original transaction order
         take a new one,
         if it conflicts, add to the pending set
         else we add it to the block
  else
      take the first transaction from the pending transactions and add it to the block

Test Plan

Tested on Forge and this can give us a 25% TPS boost in case of P2P benchmark. Also verified the latency of the shuffle after all the optimizations is less than 10 ms.

@sitalkedia sitalkedia added the CICD:run-e2e-tests when this label is present github actions will run all land-blocking e2e tests from the PR label Feb 7, 2023
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

config/src/config/execution_config.rs Outdated Show resolved Hide resolved
consensus/src/payload_generator.rs Outdated Show resolved Hide resolved
consensus/src/payload_generator.rs Outdated Show resolved Hide resolved
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

consensus/src/sender_aware_shuffler.rs Outdated Show resolved Hide resolved
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2023

✅ Forge suite land_blocking success on fc726fcbcd0d56db99501a3183cd4851e341e805

performance benchmark with full nodes : 6092 TPS, 6514 ms latency, 9300 ms p99 latency,(!) expired 80 out of 2601480 txns
Test Ok

@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2023

✅ Forge suite framework_upgrade success on cb4ba0a57c998c60cbab65af31a64875d2588ca5 ==> fc726fcbcd0d56db99501a3183cd4851e341e805

Compatibility test results for cb4ba0a57c998c60cbab65af31a64875d2588ca5 ==> fc726fcbcd0d56db99501a3183cd4851e341e805 (PR)
Upgrade the nodes to version: fc726fcbcd0d56db99501a3183cd4851e341e805
framework_upgrade::framework-upgrade::full-framework-upgrade : 6989 TPS, 5509 ms latency, 7900 ms p99 latency,no expired txns
5. check swarm health
Compatibility test for cb4ba0a57c998c60cbab65af31a64875d2588ca5 ==> fc726fcbcd0d56db99501a3183cd4851e341e805 passed
Test Ok

@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2023

✅ Forge suite compat success on testnet_2d8b1b57553d869190f61df1aaf7f31a8fc19a7b ==> fc726fcbcd0d56db99501a3183cd4851e341e805

Compatibility test results for testnet_2d8b1b57553d869190f61df1aaf7f31a8fc19a7b ==> fc726fcbcd0d56db99501a3183cd4851e341e805 (PR)
1. Check liveness of validators at old version: testnet_2d8b1b57553d869190f61df1aaf7f31a8fc19a7b
compatibility::simple-validator-upgrade::liveness-check : 8122 TPS, 4719 ms latency, 7100 ms p99 latency,no expired txns
2. Upgrading first Validator to new version: fc726fcbcd0d56db99501a3183cd4851e341e805
compatibility::simple-validator-upgrade::single-validator-upgrade : 5125 TPS, 8047 ms latency, 10200 ms p99 latency,no expired txns
3. Upgrading rest of first batch to new version: fc726fcbcd0d56db99501a3183cd4851e341e805
compatibility::simple-validator-upgrade::half-validator-upgrade : 5152 TPS, 7826 ms latency, 10700 ms p99 latency,no expired txns
4. upgrading second batch to new version: fc726fcbcd0d56db99501a3183cd4851e341e805
compatibility::simple-validator-upgrade::rest-validator-upgrade : 7078 TPS, 5418 ms latency, 9700 ms p99 latency,no expired txns
5. check swarm health
Compatibility test for testnet_2d8b1b57553d869190f61df1aaf7f31a8fc19a7b ==> fc726fcbcd0d56db99501a3183cd4851e341e805 passed
Test Ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CICD:run-e2e-tests when this label is present github actions will run all land-blocking e2e tests from the PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants