Skip to content

Conversation

@heifner
Copy link
Contributor

@heifner heifner commented Jan 2, 2026

WIRE-195

Add a separate trx execution queue, trx_read_write, that is executed from when there are no read_write or read_only tasks to execute. This preserves running trxs as the lowest priority task, but allows for individual prioritization of transactions. As of this PR, all transactions have the same priority, however, this adds the framework for specifying different priorities for transactions. The new trx_read_write queue is only for non-read-only transactions. Read-only transactions are still executed in FIFO order on multiple threads.

In addition to allowing for different priorities for transactions, this change also reduces the contention on the main io_context which in previous benchmarking was demonstrated to be a bottleneck for small transfer like transactions.

See AntelopeIO/leap#1860

…y. Transactions now execute when there are no other queued tasks to execute in the read-write or read-only queues. As of this commit, all trxs have the same priority, but that will change in the future.
@heifner heifner requested review from brianjohnson5972 and removed request for brianjohnson5972 January 2, 2026 16:34
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a separate transaction execution queue (trx_read_write) to enable individual prioritization of non-read-only transactions and reduce contention on the main io_context. Transactions are now executed as the lowest priority task in the write window, only when no read_write or read_only tasks are pending. This maintains the existing priority hierarchy while providing a framework for future transaction prioritization based on individual transaction characteristics.

Key changes:

  • Added new trx_read_write queue type that executes only when read_write and read_only queues are empty
  • Introduced enable/disable mechanism for the trx queue to prevent processing when no block is being built
  • Refactored queue storage from individual members to an array indexed by queue type

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
libraries/custom_appbase/include/sysio/chain/exec_pri_queue.hpp Adds trx_read_write queue enum value, refactors queue storage to use array, implements special locking and post logic for trx queue
libraries/custom_appbase/include/sysio/chain/application.hpp Updates executor to handle trx queue posting, adds execute_highest logic to process trx queue when read queues are empty, adds enable/disable control for trx queue
plugins/producer_plugin/src/producer_plugin.cpp Changes transaction posting from read_write to trx_read_write queue, enables/disables trx queue during block production lifecycle
plugins/chain_plugin/src/chain_plugin.cpp Optimizes method lookup with static local variables for incoming transaction handler
libraries/custom_appbase/tests/custom_appbase_tests.cpp Adds comprehensive test for three-queue scenario validating priority ordering and execution sequencing

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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