-
Notifications
You must be signed in to change notification settings - Fork 115
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
Ptrus/benchmark/runtime scheduler #3434
Conversation
7d21467
to
27045d9
Compare
Codecov Report
@@ Coverage Diff @@
## master #3434 +/- ##
==========================================
- Coverage 66.12% 66.07% -0.06%
==========================================
Files 371 371
Lines 33368 33399 +31
==========================================
+ Hits 22065 22067 +2
- Misses 8059 8098 +39
+ Partials 3244 3234 -10
Continue to review full report at Codecov.
|
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.
Nice work! I only have some minor nits.
consider removing the incomming_queue & map txpool implementations before merging, as only the ordered queue will be used
Yeah this makes sense.
90147e1
to
a99f9c5
Compare
// Name is the transaction pool implementation name. | ||
Name() string | ||
|
||
// Add adds a single transaction into the transaction. |
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.
// Add adds a single transaction into the transaction. | |
// Add adds a single transaction into the transaction pool. |
// RemoveBatch removes a batch from the transaction pool. | ||
RemoveBatch(batch [][]byte) error | ||
|
||
// IsQueued returns whether a call is in the queue already. |
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.
// IsQueued returns whether a call is in the queue already. | |
// IsQueued returns whether a transaction is in the queue already. |
// IsQueued returns whether a call is in the queue already. | ||
IsQueued(txHash hash.Hash) bool | ||
|
||
// Size returns size of the transaction pool. |
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.
// Size returns size of the transaction pool. | |
// Size returns the number of transactions in the transaction pool. |
@@ -565,8 +565,8 @@ func (n *Node) HandleNewBlockLocked(blk *block.Block) { | |||
} | |||
} | |||
|
|||
// checkTx checks the given call in the node's runtime. | |||
func (n *Node) checkTx(ctx context.Context, call []byte) error { | |||
// checkTx checks the given tx in the node's runtime. |
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.
// checkTx checks the given tx in the node's runtime. | |
// checkTx requests the runtime to check the validity of the given transaction. |
a99f9c5
to
63fbd09
Compare
Closes #3358
Done:
txpool
interfacemap
,ordered_map
txpool implementationstxpool
andsimple scheduler
ordered_map
Benchmark results:
As expected in a scenario where a lot (compared to batch size) of transactions are submitted concurrently, the current queue implementation performs an order of magnitude worse, due to the removes doing
O(queueSize)
operations, (which happens after each dispatch). Themap
backed tx-pool serves as a baseline implementation as it doesn't maintain transaction order. Ordered map implementation performance is comparable to the baseline map implementation, and also maintains the transactions order.The delay benchmarks however show that the overall impact of the queue implementation is not as drastic whenever the dispatch is not instant.
Based on benchmark results I think it's reasonable to switch to the ordered queue implementation.