feat(txpool): Batch insertions into the Tx Pool#17670
Merged
mattsse merged 62 commits intoparadigmxyz:mainfrom Aug 13, 2025
Merged
feat(txpool): Batch insertions into the Tx Pool#17670mattsse merged 62 commits intoparadigmxyz:mainfrom
mattsse merged 62 commits intoparadigmxyz:mainfrom
Conversation
mattsse
requested changes
Jul 29, 2025
crates/rpc/rpc/src/eth/core.rs
Outdated
Comment on lines
+306
to
+307
| /// Optional transaction batcher for batching tx insertions | ||
| tx_batcher: Option<TxBatcher<N::Pool>>, |
Collaborator
There was a problem hiding this comment.
maybe we just make this behaviour default, wdyt @klkvr
Member
There was a problem hiding this comment.
I'd be fine with that, can make the default batch size 1
Contributor
Author
There was a problem hiding this comment.
I updated the PR to use tx batching by default for transactions submitted via send_raw_transaction. The default batch size has been updated to 1.
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
Co-authored-by: Arsenii Kulikov <klkvrr@gmail.com>
klkvr
previously requested changes
Aug 7, 2025
mattsse
approved these changes
Aug 13, 2025
Collaborator
mattsse
left a comment
There was a problem hiding this comment.
lgtm,
we probably want to increase the max batch size but let's start with 1 for now, the overhead for a single 1 should be negligible here
lwedge99
pushed a commit
to sentioxyz/reth
that referenced
this pull request
Sep 16, 2025
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de> Co-authored-by: Arsenii Kulikov <klkvrr@gmail.com>
theochap
pushed a commit
to ethereum-optimism/optimism
that referenced
this pull request
Jan 22, 2026
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de> Co-authored-by: Arsenii Kulikov <klkvrr@gmail.com>
theochap
pushed a commit
to ethereum-optimism/optimism
that referenced
this pull request
Feb 11, 2026
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de> Co-authored-by: Arsenii Kulikov <klkvrr@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses #12811
This PR adds support for batch transaction insertions into the TxPool to reduce lock contention and improve throughput under high-load scenarios.
When enabled, transactions are funneled through a
TxBatcher, which accumulates txs in an internal buffer. Insertions are triggered either on a fixed interval or when a threshold is reached, whichever comes first. This avoids excessive locking and per-tx overhead during highly concurrentsend_raw_transactioncalls.The Batcher configuration is exposed via CLI flags:
--txpool.max-batch-size: Enables batch insertion and sets the maximum number of transactions that will be processed in a batch.When batching is enabled, the
EthApiroutes transactions through the batcher. Otherwise, it will falls back to the default logic executing each tx indivudally.Internally, the batcher uses a channel and a background task to process batches. Batched transactions are marked as
TransactionOrigin::Localand validated before being added.Opening a draft PR for initial feedback. I am still writing benchmarks as well as adding logging/metrics. Also happy to adjust if there is a preferred approach different than the current implementation.