From 7cbff0d17711205d109be3a4dc0807e99cdff3d5 Mon Sep 17 00:00:00 2001 From: frisitano Date: Wed, 22 Oct 2025 21:41:01 +0800 Subject: [PATCH 1/2] update database config --- crates/database/db/src/db.rs | 19 ++++++++++++++++--- crates/derivation-pipeline/src/lib.rs | 2 +- sequencer-migration/send-l1-messages.sh | 4 +++- tests/launch_rollup_node_sequencer.bash | 2 ++ 4 files changed, 22 insertions(+), 5 deletions(-) mode change 100644 => 100755 sequencer-migration/send-l1-messages.sh diff --git a/crates/database/db/src/db.rs b/crates/database/db/src/db.rs index f28ae5bc..d5ffdc1a 100644 --- a/crates/database/db/src/db.rs +++ b/crates/database/db/src/db.rs @@ -24,14 +24,23 @@ use tokio::sync::{Mutex, Semaphore}; const BUSY_TIMEOUT_SECS: u64 = 5; /// The maximum number of connections in the database connection pool. -const MAX_CONNECTIONS: u32 = 32; +const MAX_CONNECTIONS: u32 = 6; /// The minimum number of connections in the database connection pool. -const MIN_CONNECTIONS: u32 = 5; +const MIN_CONNECTIONS: u32 = 2; /// The timeout for acquiring a connection from the pool. const ACQUIRE_TIMEOUT_SECS: u64 = 5; +/// The cache size in KB +const CACHE_SIZE_KB: &str = "-131072"; // 128 MB + +/// The mmap size in bytes +const MMAP_SIZE_BYTES: &str = "536870912"; // 512 MB + +/// The wal auto checkpoint size in pages +const WAL_AUTO_CHECKPOINT_PAGES: &str = "50000"; // 200 MB (with default page size of 4 KB) + /// A wrapper around `DatabaseInner` which provides retry features. #[derive(Debug)] pub struct Database { @@ -444,7 +453,11 @@ impl DatabaseInner { .journal_mode(sea_orm::sqlx::sqlite::SqliteJournalMode::Wal) .busy_timeout(Duration::from_secs(busy_timeout_secs)) .foreign_keys(true) - .synchronous(sea_orm::sqlx::sqlite::SqliteSynchronous::Normal); + .synchronous(sea_orm::sqlx::sqlite::SqliteSynchronous::Normal) + .pragma("cache_size", CACHE_SIZE_KB) + .pragma("mmap_size", MMAP_SIZE_BYTES) + .pragma("wal_autocheckpoint", WAL_AUTO_CHECKPOINT_PAGES) + .pragma("temp_store", "MEMORY"); let sqlx_pool = SqlitePoolOptions::new() .max_connections(max_connections) diff --git a/crates/derivation-pipeline/src/lib.rs b/crates/derivation-pipeline/src/lib.rs index ed245e89..e34f00a2 100644 --- a/crates/derivation-pipeline/src/lib.rs +++ b/crates/derivation-pipeline/src/lib.rs @@ -95,7 +95,7 @@ impl Stream for DerivationPipeline { } /// The maximum number of concurrent batch derivation futures. -const DERIVATION_PIPELINE_WORKER_CONCURRENCY: usize = 5; +const DERIVATION_PIPELINE_WORKER_CONCURRENCY: usize = 3; /// A structure holding the current unresolved futures for the derivation pipeline. #[derive(Debug)] diff --git a/sequencer-migration/send-l1-messages.sh b/sequencer-migration/send-l1-messages.sh old mode 100644 new mode 100755 index 73ef984f..9e289939 --- a/sequencer-migration/send-l1-messages.sh +++ b/sequencer-migration/send-l1-messages.sh @@ -78,5 +78,7 @@ main() { log_info "Next queue index: $next_queue_index " done - echo "Done" + log_info "Done" } + +main "$@" diff --git a/tests/launch_rollup_node_sequencer.bash b/tests/launch_rollup_node_sequencer.bash index 0410dfbf..44c49fdc 100644 --- a/tests/launch_rollup_node_sequencer.bash +++ b/tests/launch_rollup_node_sequencer.bash @@ -18,6 +18,8 @@ exec rollup-node node --chain /l2reth/l2reth-genesis-e2e.json --datadir=/l2reth --rpc.rollup-node \ --log.stdout.format log-fmt -vvv \ --sequencer.enabled \ + --sequencer.auto-start \ + --sequencer.max-l1-messages 10 \ --sequencer.allow-empty-blocks \ --signer.key-file /l2reth/sequencer-key \ --sequencer.block-time 500 \ From 8d45c4c6294e24c7fc3b8d9ee21a9afb0832c80e Mon Sep 17 00:00:00 2001 From: frisitano Date: Wed, 22 Oct 2025 21:42:34 +0800 Subject: [PATCH 2/2] revert changes on test bash script --- tests/launch_rollup_node_sequencer.bash | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/launch_rollup_node_sequencer.bash b/tests/launch_rollup_node_sequencer.bash index 44c49fdc..0410dfbf 100644 --- a/tests/launch_rollup_node_sequencer.bash +++ b/tests/launch_rollup_node_sequencer.bash @@ -18,8 +18,6 @@ exec rollup-node node --chain /l2reth/l2reth-genesis-e2e.json --datadir=/l2reth --rpc.rollup-node \ --log.stdout.format log-fmt -vvv \ --sequencer.enabled \ - --sequencer.auto-start \ - --sequencer.max-l1-messages 10 \ --sequencer.allow-empty-blocks \ --signer.key-file /l2reth/sequencer-key \ --sequencer.block-time 500 \