Skip to content

Commit f0c0fe7

Browse files
authored
feat: update database config (#385)
* update database config * revert changes on test bash script
1 parent 59cb712 commit f0c0fe7

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

crates/database/db/src/db.rs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,23 @@ use tokio::sync::{Mutex, Semaphore};
2727
const BUSY_TIMEOUT_SECS: u64 = 5;
2828

2929
/// The maximum number of connections in the database connection pool.
30-
const MAX_CONNECTIONS: u32 = 32;
30+
const MAX_CONNECTIONS: u32 = 6;
3131

3232
/// The minimum number of connections in the database connection pool.
33-
const MIN_CONNECTIONS: u32 = 5;
33+
const MIN_CONNECTIONS: u32 = 2;
3434

3535
/// The timeout for acquiring a connection from the pool.
3636
const ACQUIRE_TIMEOUT_SECS: u64 = 5;
3737

38+
/// The cache size in KB
39+
const CACHE_SIZE_KB: &str = "-131072"; // 128 MB
40+
41+
/// The mmap size in bytes
42+
const MMAP_SIZE_BYTES: &str = "536870912"; // 512 MB
43+
44+
/// The wal auto checkpoint size in pages
45+
const WAL_AUTO_CHECKPOINT_PAGES: &str = "50000"; // 200 MB (with default page size of 4 KB)
46+
3847
/// A wrapper around `DatabaseInner` which provides retry features.
3948
#[derive(Debug)]
4049
pub struct Database {
@@ -595,7 +604,11 @@ impl DatabaseInner {
595604
.journal_mode(sea_orm::sqlx::sqlite::SqliteJournalMode::Wal)
596605
.busy_timeout(Duration::from_secs(busy_timeout_secs))
597606
.foreign_keys(true)
598-
.synchronous(sea_orm::sqlx::sqlite::SqliteSynchronous::Normal);
607+
.synchronous(sea_orm::sqlx::sqlite::SqliteSynchronous::Normal)
608+
.pragma("cache_size", CACHE_SIZE_KB)
609+
.pragma("mmap_size", MMAP_SIZE_BYTES)
610+
.pragma("wal_autocheckpoint", WAL_AUTO_CHECKPOINT_PAGES)
611+
.pragma("temp_store", "MEMORY");
599612

600613
let sqlx_pool = SqlitePoolOptions::new()
601614
.max_connections(max_connections)

crates/derivation-pipeline/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ impl Stream for DerivationPipeline {
9595
}
9696

9797
/// The maximum number of concurrent batch derivation futures.
98-
const DERIVATION_PIPELINE_WORKER_CONCURRENCY: usize = 5;
98+
const DERIVATION_PIPELINE_WORKER_CONCURRENCY: usize = 3;
9999

100100
/// A structure holding the current unresolved futures for the derivation pipeline.
101101
#[derive(Debug)]

sequencer-migration/send-l1-messages.sh

100644100755
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,5 +78,7 @@ main() {
7878
log_info "Next queue index: $next_queue_index "
7979
done
8080

81-
echo "Done"
81+
log_info "Done"
8282
}
83+
84+
main "$@"

0 commit comments

Comments
 (0)