-
Notifications
You must be signed in to change notification settings - Fork 9
Separate transaction queue #163
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
base: master
Are you sure you want to change the base?
Conversation
…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.
There was a problem hiding this 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_writequeue type that executes only whenread_writeandread_onlyqueues 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>
…se are logged when switching to read window.
WIRE-195
Add a separate trx execution queue,
trx_read_write, that is executed from when there are noread_writeorread_onlytasks 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 newtrx_read_writequeue 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_contextwhich in previous benchmarking was demonstrated to be a bottleneck for small transfer like transactions.See AntelopeIO/leap#1860