Skip to content

Commit

Permalink
add config for page lock at the beginning or during load
Browse files Browse the repository at this point in the history
  • Loading branch information
eaypek-tfh committed Jan 24, 2025
1 parent dad454c commit f281de6
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 5 deletions.
2 changes: 1 addition & 1 deletion deploy/stage/common-values-iris-mpc.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
image: "ghcr.io/worldcoin/iris-mpc:4065a7f06f7c3482417f387542bf76fbd7bae1f5"
image: "ghcr.io/worldcoin/iris-mpc:97fc97e80c1778dff895ffa3752eb9abcf331776"

environment: stage
replicaCount: 1
Expand Down
3 changes: 3 additions & 0 deletions deploy/stage/smpcv2-0-stage/values-iris-mpc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
3 changes: 3 additions & 0 deletions deploy/stage/smpcv2-1-stage/values-iris-mpc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
3 changes: 3 additions & 0 deletions deploy/stage/smpcv2-2-stage/values-iris-mpc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
3 changes: 3 additions & 0 deletions iris-mpc-common/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
17 changes: 13 additions & 4 deletions iris-mpc/src/bin/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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()
);

Expand Down

0 comments on commit f281de6

Please sign in to comment.