Skip to content

poc: async backpressure for transaction notifications #9296

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lexnv
Copy link
Contributor

@lexnv lexnv commented Jul 23, 2025

This is a proof of concept/poc for for sending notifications asynchronously.

There are several benefits to this:

  • notifications are sent in a background task using FuturesUnordered, allowing for parallel handling
  • No twicking of constants or increase memory usage
  • Uses natural backpressure, ideally every notif protocol wants this (ie, spamming disputes)

While this is still a PoC, there are a few areas that could be improved:

  • No timeout for sending transactions to a peer (average time for the scenario led to 130us during each async call, with a peak of 1ms)
  • Consider switching the interval timer to use Tokio interval
  • Make sure tokio::select! is handled safely to avoid panics
  • the transaction pool might not always have all transactions available
  • Improve error handling for cases when peers disconnect or async sends fail
  • Batching in substrate/client/service/src/builder.rs could be optimized (if further needed)

cc @lrubasze @skunert

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
@lexnv lexnv changed the title poc: async backpressure for notifs poc: async backpressure for transaction notifications Jul 23, 2025
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.

1 participant