-
Notifications
You must be signed in to change notification settings - Fork 217
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
generic scheduler #3611
base: master
Are you sure you want to change the base?
generic scheduler #3611
Conversation
core/src/banking_stage.rs
Outdated
let packet_deserializer = PacketDeserializer::new(non_vote_receiver); | ||
let receive_and_buffer = SanitizedTransactionReceiveAndBuffer::new( | ||
packet_deserializer, | ||
bank_forks.clone(), | ||
forwarder.is_some(), | ||
); | ||
let container = TransactionStateContainer::with_capacity(TOTAL_BUFFERED_PACKETS); |
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.
Once the other structures/impl for new transaction type are ready there will be a switch here on spawning.
- Receiving and buffering is generic so that we can skip over all deserialization (never pass through
ImmutableDeserializedPacket
) - Container is generic because the current impl isn't good if we want to copy as little data as possible. For new tx types, it will wrap the old type with a pre-allocated (separate) container for getting free
Bytes
spaces to copy our packet data into. Eventually this would go away once we haveBytes
upstream, but for now we don't and this is much faster than allocating space or copying aPacket
for every tx move.
core/src/banking_stage/transaction_scheduler/transaction_state.rs
Outdated
Show resolved
Hide resolved
@@ -44,7 +44,7 @@ pub trait ReceiveAndBuffer<Tx: TransactionWithMeta> { | |||
) -> bool; | |||
} | |||
|
|||
pub(crate) struct SanitizedTransactionReceiveAndBuffer { |
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.
nit: don't think visibility change was necessary
pub(crate) struct SchedulerController< | ||
C: LikeClusterInfo, | ||
Tx: TransactionWithMeta, | ||
R: ReceiveAndBuffer<Tx>, | ||
> { |
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.
Idk I prefer keeping the Tx
generic parameter personally. Feels backwards to be getting it from the ReceiveAndBuffer
rather than passing it
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.
Idea I had here is that ReceiveAndBuffer
's type(s) are a single-point controlling all the inner implementations.
I also think this sort of set up is somewhat necessary with what I have planned.
(See most recent push, Container
type is also chosen by the ReceiveAndBuffer
).
Old transaction type:
- receive packet batches, deserialize into
ImmutableDeserializedPacket
- do filtering, eventually end up with
RuntimeTransaction<SanitizedTransaction>
- insert those into the
TransactionStateContainer<RuntimeTransaction<SanitizedTransaction>>
New transaction type:
- receive packet batches. get pre-allocated space
(BytesMut)
from the container, copy bytes of packet, parse (usingBytes
). - do filtering, eventually end up with
RuntimeTransaction<ResolvedTransactionView>
- insert those into the the a different container type (
WrappedTransactionStateContainer
).- this wrapping is necessary so that we can get and re-use the
Bytes
for the transactions
- this wrapping is necessary so that we can get and re-use the
So it doesn't make sense if we have the TransactionViewReceiveAndBuffer
and a TransactionStateContainer<..>
, because we need slightly different behavior due to the type differences; and they require a slightly different interface as well, since getting free space to work on received packets isn't something the base TransactionStateContainer
needs to do.
A lot of this gets simplified once we are receiving Bytes
from upstream, because we could just insert those into the TransactionStateContainer
. But that's blocked rn because of CUDA stuff (that no one uses) 🫠
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.
^ kind of a long winded explanation. let me know if you want to hop on a call to discuss, or if you have questions here it's fine too!
92773e4
to
c3a8caf
Compare
Problem
SanitizedTransaction
typesSanitizedTransaction
for performanceSummary of Changes
Fixes #