diff --git a/deploy/stage/common-values-iris-mpc.yaml b/deploy/stage/common-values-iris-mpc.yaml index 8cb0968ff..7ce08e138 100644 --- a/deploy/stage/common-values-iris-mpc.yaml +++ b/deploy/stage/common-values-iris-mpc.yaml @@ -1,4 +1,4 @@ -image: "ghcr.io/worldcoin/iris-mpc:4065a7f06f7c3482417f387542bf76fbd7bae1f5" +image: "ghcr.io/worldcoin/iris-mpc:97fc97e80c1778dff895ffa3752eb9abcf331776" environment: stage replicaCount: 1 diff --git a/deploy/stage/smpcv2-0-stage/values-iris-mpc.yaml b/deploy/stage/smpcv2-0-stage/values-iris-mpc.yaml index a43a87275..5de330d41 100644 --- a/deploy/stage/smpcv2-0-stage/values-iris-mpc.yaml +++ b/deploy/stage/smpcv2-0-stage/values-iris-mpc.yaml @@ -92,6 +92,9 @@ env: - name: SMPC__TEST_LOAD_INTO_MEMORY value: "false" + - name: SMPC__PAGE_LOCK_AT_BEGINNING + value: "true" + - name: SMPC__CLEAR_DB_BEFORE_INIT value: "true" diff --git a/deploy/stage/smpcv2-1-stage/values-iris-mpc.yaml b/deploy/stage/smpcv2-1-stage/values-iris-mpc.yaml index e7034dfe8..289c339ec 100644 --- a/deploy/stage/smpcv2-1-stage/values-iris-mpc.yaml +++ b/deploy/stage/smpcv2-1-stage/values-iris-mpc.yaml @@ -92,6 +92,9 @@ env: - name: SMPC__TEST_LOAD_INTO_MEMORY value: "false" + - name: SMPC__PAGE_LOCK_AT_BEGINNING + value: "true" + - name: SMPC__CLEAR_DB_BEFORE_INIT value: "true" diff --git a/deploy/stage/smpcv2-2-stage/values-iris-mpc.yaml b/deploy/stage/smpcv2-2-stage/values-iris-mpc.yaml index 76ebda9dd..2e640eec3 100644 --- a/deploy/stage/smpcv2-2-stage/values-iris-mpc.yaml +++ b/deploy/stage/smpcv2-2-stage/values-iris-mpc.yaml @@ -92,6 +92,9 @@ env: - name: SMPC__TEST_LOAD_INTO_MEMORY value: "false" + - name: SMPC__PAGE_LOCK_AT_BEGINNING + value: "true" + - name: SMPC__CLEAR_DB_BEFORE_INIT value: "true" diff --git a/iris-mpc-common/src/config/mod.rs b/iris-mpc-common/src/config/mod.rs index 980c1ff9a..ec0af8f63 100644 --- a/iris-mpc-common/src/config/mod.rs +++ b/iris-mpc-common/src/config/mod.rs @@ -123,6 +123,9 @@ pub struct Config { #[serde(default)] pub test_load_into_memory: bool, + + #[serde(default)] + pub page_lock_at_beginning: bool, } fn default_load_chunks_parallelism() -> usize { diff --git a/iris-mpc/src/bin/server.rs b/iris-mpc/src/bin/server.rs index a3bea5faa..ddc9f9f22 100644 --- a/iris-mpc/src/bin/server.rs +++ b/iris-mpc/src/bin/server.rs @@ -1203,9 +1203,15 @@ async fn server_main(config: Config) -> eyre::Result<()> { ); } }); + let mut page_lock_handle = Some(page_lock_handle); tokio::runtime::Handle::current().block_on(async { - let now = Instant::now(); + let mut now = Instant::now(); + if config.page_lock_at_beginning { + page_lock_handle.take().unwrap().await?; + tracing::info!("Page-locking took {:?}", now.elapsed()); + } + now = Instant::now(); let mut load_summary_ts = Instant::now(); let mut time_waiting_for_stream = time::Duration::from_secs(0); let mut time_loading_into_memory = time::Duration::from_secs(0); @@ -1365,12 +1371,15 @@ async fn server_main(config: Config) -> eyre::Result<()> { tracing::info!("Preprocessing db"); actor.preprocess_db(); - tracing::info!("Waiting for page-lock to finish"); - page_lock_handle.await?; + if !config.page_lock_at_beginning { + tracing::info!("Waiting for page-lock to finish"); + page_lock_handle.take().unwrap().await?; + } tracing::info!( - "Loaded {} records from db into memory [DB sizes: {:?}]", + "Loaded {} records from db into memory in {:?} [DB sizes: {:?}]", record_counter, + now.elapsed(), actor.current_db_sizes() );