Change tx batching in banking process and record (#5832)
* Change tx batching in banking process and record * Change batching to reduce impact on replay stage
This commit is contained in:
parent
fd33b27af1
commit
b426dfb2c0
|
@ -2816,6 +2816,7 @@ dependencies = [
|
||||||
"solana-drone 0.19.0-pre0",
|
"solana-drone 0.19.0-pre0",
|
||||||
"solana-exchange-api 0.19.0-pre0",
|
"solana-exchange-api 0.19.0-pre0",
|
||||||
"solana-exchange-program 0.19.0-pre0",
|
"solana-exchange-program 0.19.0-pre0",
|
||||||
|
"solana-genesis 0.19.0-pre0",
|
||||||
"solana-local-cluster 0.19.0-pre0",
|
"solana-local-cluster 0.19.0-pre0",
|
||||||
"solana-logger 0.19.0-pre0",
|
"solana-logger 0.19.0-pre0",
|
||||||
"solana-metrics 0.19.0-pre0",
|
"solana-metrics 0.19.0-pre0",
|
||||||
|
@ -2853,6 +2854,7 @@ dependencies = [
|
||||||
"solana-client 0.19.0-pre0",
|
"solana-client 0.19.0-pre0",
|
||||||
"solana-core 0.19.0-pre0",
|
"solana-core 0.19.0-pre0",
|
||||||
"solana-drone 0.19.0-pre0",
|
"solana-drone 0.19.0-pre0",
|
||||||
|
"solana-genesis 0.19.0-pre0",
|
||||||
"solana-librapay-api 0.19.0-pre0",
|
"solana-librapay-api 0.19.0-pre0",
|
||||||
"solana-local-cluster 0.19.0-pre0",
|
"solana-local-cluster 0.19.0-pre0",
|
||||||
"solana-logger 0.19.0-pre0",
|
"solana-logger 0.19.0-pre0",
|
||||||
|
|
|
@ -3,10 +3,8 @@
|
||||||
//! can do its processing in parallel with signature verification on the GPU.
|
//! can do its processing in parallel with signature verification on the GPU.
|
||||||
use crate::blocktree::Blocktree;
|
use crate::blocktree::Blocktree;
|
||||||
use crate::cluster_info::ClusterInfo;
|
use crate::cluster_info::ClusterInfo;
|
||||||
use crate::entry;
|
use crate::entry::hash_transactions;
|
||||||
use crate::entry::{hash_transactions, Entry};
|
|
||||||
use crate::leader_schedule_cache::LeaderScheduleCache;
|
use crate::leader_schedule_cache::LeaderScheduleCache;
|
||||||
use crate::packet;
|
|
||||||
use crate::packet::PACKETS_PER_BATCH;
|
use crate::packet::PACKETS_PER_BATCH;
|
||||||
use crate::packet::{Packet, Packets};
|
use crate::packet::{Packet, Packets};
|
||||||
use crate::poh_recorder::{PohRecorder, PohRecorderError, WorkingBankEntries};
|
use crate::poh_recorder::{PohRecorder, PohRecorderError, WorkingBankEntries};
|
||||||
|
@ -51,6 +49,8 @@ pub const NUM_THREADS: u32 = 4;
|
||||||
|
|
||||||
const TOTAL_BUFFERED_PACKETS: usize = 500_000;
|
const TOTAL_BUFFERED_PACKETS: usize = 500_000;
|
||||||
|
|
||||||
|
const MAX_NUM_TRANSACTIONS_PER_BATCH: usize = 512;
|
||||||
|
|
||||||
/// Stores the stage's thread handle and output receiver.
|
/// Stores the stage's thread handle and output receiver.
|
||||||
pub struct BankingStage {
|
pub struct BankingStage {
|
||||||
bank_thread_hdls: Vec<JoinHandle<()>>,
|
bank_thread_hdls: Vec<JoinHandle<()>>,
|
||||||
|
@ -578,12 +578,10 @@ impl BankingStage {
|
||||||
let mut chunk_start = 0;
|
let mut chunk_start = 0;
|
||||||
let mut unprocessed_txs = vec![];
|
let mut unprocessed_txs = vec![];
|
||||||
while chunk_start != transactions.len() {
|
while chunk_start != transactions.len() {
|
||||||
let chunk_end = chunk_start
|
let chunk_end = std::cmp::min(
|
||||||
+ entry::num_will_fit(
|
transactions.len(),
|
||||||
&transactions[chunk_start..],
|
chunk_start + MAX_NUM_TRANSACTIONS_PER_BATCH,
|
||||||
packet::BLOB_DATA_SIZE as u64,
|
);
|
||||||
&Entry::serialized_to_blob_size,
|
|
||||||
);
|
|
||||||
|
|
||||||
let (result, retryable_txs_in_chunk) = Self::process_and_record_transactions(
|
let (result, retryable_txs_in_chunk) = Self::process_and_record_transactions(
|
||||||
bank,
|
bank,
|
||||||
|
@ -959,11 +957,11 @@ mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::blocktree::get_tmp_ledger_path;
|
use crate::blocktree::get_tmp_ledger_path;
|
||||||
use crate::cluster_info::Node;
|
use crate::cluster_info::Node;
|
||||||
use crate::entry::EntrySlice;
|
use crate::entry::{Entry, EntrySlice};
|
||||||
use crate::genesis_utils::{create_genesis_block, GenesisBlockInfo};
|
use crate::genesis_utils::{create_genesis_block, GenesisBlockInfo};
|
||||||
use crate::packet::to_packets;
|
use crate::packet::to_packets;
|
||||||
use crate::poh_recorder::WorkingBank;
|
use crate::poh_recorder::WorkingBank;
|
||||||
use crate::{get_tmp_ledger_path, tmp_ledger_name};
|
use crate::{entry, get_tmp_ledger_path, packet, tmp_ledger_name};
|
||||||
use crossbeam_channel::unbounded;
|
use crossbeam_channel::unbounded;
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
use solana_sdk::instruction::InstructionError;
|
use solana_sdk::instruction::InstructionError;
|
||||||
|
|
Loading…
Reference in New Issue