Skip to content

Commit

Permalink
test: fine tune block streamer buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
jpraynaud committed Jul 3, 2024
1 parent d49850c commit febf43a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -205,13 +205,20 @@ impl CardanoTransactionRepository {
&self,
transactions: Vec<T>,
) -> StdResult<()> {
println!("Storing transactions");
const DB_TRANSACTION_SIZE: usize = 100000;
for transactions_in_db_transaction_chunk in transactions.chunks(DB_TRANSACTION_SIZE) {
for (idx, transactions_in_db_transaction_chunk) in
transactions.chunks(DB_TRANSACTION_SIZE).enumerate()
{
println!("Creating transactions in chunks of {DB_TRANSACTION_SIZE}] #{idx}");
let connection = self.connection_pool.connection()?;
let transaction = connection.begin_transaction()?;

// Chunk transactions to avoid an error when we exceed sqlite binding limitations
for transactions_in_chunk in transactions_in_db_transaction_chunk.chunks(100) {
for (sub_idx, transactions_in_chunk) in
transactions_in_db_transaction_chunk.chunks(100).enumerate()
{
println!("Storing sub chunks of 100 #{sub_idx}");
self.create_transactions_with_connection(
transactions_in_chunk.to_vec(),
&connection,
Expand Down
4 changes: 2 additions & 2 deletions mithril-aggregator/src/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ impl Configuration {
step: 15,
},
cardano_transactions_prover_max_hashes_allowed_by_request: 100,
cardano_transactions_block_streamer_max_roll_forwards_per_poll: 1000,
cardano_transactions_block_streamer_max_roll_forwards_per_poll: 10000,
}
}

Expand Down Expand Up @@ -399,7 +399,7 @@ impl Default for DefaultConfiguration {
step: 30,
},
cardano_transactions_prover_max_hashes_allowed_by_request: 100,
cardano_transactions_block_streamer_max_roll_forwards_per_poll: 1000,
cardano_transactions_block_streamer_max_roll_forwards_per_poll: 10000,
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions mithril-signer/src/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ impl Configuration {
allow_unparsable_block: false,
enable_transaction_pruning: false,
transactions_import_block_chunk_size: 1000,
cardano_transactions_block_streamer_max_roll_forwards_per_poll: 1000,
cardano_transactions_block_streamer_max_roll_forwards_per_poll: 10000,
}
}

Expand Down Expand Up @@ -246,7 +246,7 @@ impl Default for DefaultConfiguration {
preload_security_parameter: 3000,
enable_transaction_pruning: true,
transactions_import_block_chunk_size: 1500,
cardano_transactions_block_streamer_max_roll_forwards_per_poll: 1000,
cardano_transactions_block_streamer_max_roll_forwards_per_poll: 10000,
}
}
}
Expand Down

0 comments on commit febf43a

Please sign in to comment.