Expand description
Messages passed between agave and an external pack process.
Messages are passed via shaq::spsc::Consumer/Producer.
Memory freeing is responsibility of the external pack process,
and is done via rts-alloc crate. It is also possible the external
pack process allocates memory to pass to agave, BUT it will still be
the responsibility of the external pack process to free that memory.
Setting up the shared memory allocator and queues is done outside of
agave - it can be done by the external pack process or another
process. agave will just join shared memory regions, but not
create them.
Similarly, agave will not delete files used for shared memory regions.
See shaq and rts-alloc crates for details.
The basic architecture is as follows: ┌───────────────┐ ┌─────────────────┐ │ tpu_to_pack │ │ progress_tracker│ └───────┬───────┘ └───────┬─────────┘ │ │ │ │ │ │ ┌──▼───────────────────────▼───┐ │ external scheduler │ └─▲─────── ▲────────────────▲──┘ │ │ │ │ │ │ ┌───▼───┐ ┌──▼─────┐ … ┌───▼───┐ │worker1│ │worker2 │ │workerN│ └───────┘ └────────┘ └───────┘
TpuToPackMessageare sent fromtpu_to_packqueue to the external scheduler process. This passes in tpu transactions to be scheduled, and optionally vote transactions.ProgressMessageare sent fromprogress_trackerqueue to the external scheduler process. This passes information about leader status and slot progress to the external scheduler process.PackToWorkerMessageare sent from the external scheduler process to worker threads within agave. This passes a batch of transactions to be processed by the worker threads. This processing can also involve resolving the transactions’ addresses, or similar operations beyond execution.WorkerToPackMessageare sent from worker threads within agave back to the external scheduler process. This passes back the results of processing the transactions.
Ownership and pointer lifetime rule:
- Sending a message that contains offsets or pointers to memory transfers ownership of that memory to the receiver for the lifetime defined by the protocol.
- The sender must treat that memory as not owned until ownership is explicitly returned by a later message, if any. In particular, the sender must not free or modify that memory while it is not owned.
- If the protocol does not return the memory to the sender, the receiver is responsible for freeing it.
Modules§
- pack_
message_ flags - Flags for
crate::PackToWorkerMessage::flags. UseCHECKorEXECUTEto specify how a batch should be processed. Seecheck_flagsandexecution_flagsfor details. - processed_
codes - tpu_
message_ flags - worker_
message_ types
Structs§
- Pack
ToWorker Message - Message: [Pack -> Worker] External pack processe passes transactions to worker threads within agave.
- Progress
Message - Message: [Agave -> Pack] Agave passes leader status to the external pack process.
- Sharable
Pubkeys - Reference to an array of Pubkeys that can be shared safely across processes.
- Sharable
Transaction Batch Region - Reference to an array of
SharableTransactionRegionthat can be shared safely across processes. General flow: - Sharable
Transaction Region - Reference to a transaction that can shared safely across processes.
- TpuTo
Pack Message - Message: [TPU -> Pack] TPU passes transactions to the external pack process. This is also a transfer of ownership of the transaction: the external pack process is responsible for freeing the memory.
- Transaction
Response Region - Reference to an array of response messages. General flow:
- Worker
ToPack Message - Message: [Worker -> Pack]
Message from worker threads in response to a
PackToWorkerMessage.
Constants§
- LEADER_
READY - The node is in a leader slot and has a working bank ready.
- LEADER_
STARTING - The node is in a leader slot but the working bank is not yet ready.
- MAX_
TRANSACTIONS_ PER_ MESSAGE - Maximum number of transactions allowed in a
PackToWorkerMessage. If the number of transactions exceeds this value, agave will not process the message. - NOT_
LEADER - The node is not currently in a leader slot.