Skip to content

fatxpool: optimize per-transaction listeners #7071

Open
@michalkucharczyk

Description

During 2s block investigation it turned out that ForkAwareTxPool::register_listeners call takes significant amount of time.

As the current implementation was delivered in the sprit of "make it work, make it fast", the time for optimization has come. Here is the idea.

Instead of having a single listener for every transaction in every view, we need to use the single stream of aggregated events for every transaction in the single view.

Some implementation details / hints:

  • view provides the stream of tuples: (tx_hash, status), new stream needs to be added here, and should follow logic of dropped_by_limits_sink.
  • new task for multi_view_listener needs to be added. It will select: aggregated streams map, add/remove view msgs, per-tx msgs: invalidate,finalize,...,
  • external listener is a stream (could be unfold). Internally it selects: add/remove view, view event (block_hash,status), per-tx msgs: invalidated, drpoped, finalzied, broadcated) and implements required logic (which currently is implemneted in ExternalWatcherContext,
  • create_external_watcher adds a new channel (rx,tx) between an unfolded stream (external listener instance) and mvl task. New enum for messages is needed.

Brain dump pic attached for the record.
mvl-opimize-braindump

Metadata

Labels

T0-nodeThis PR/Issue is related to the topic “node”.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions