Skip to content

Commit

Permalink
introduce config to have page lock in different phases
Browse files Browse the repository at this point in the history
  • Loading branch information
eaypek-tfh committed Jan 28, 2025
1 parent 78e8598 commit 18c109f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
5 changes: 4 additions & 1 deletion iris-mpc-common/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,10 @@ pub struct Config {
pub load_chunks_buffer_size: usize,

#[serde(default)]
pub page_lock_after: bool,
pub page_lock_sleep: bool,

#[serde(default)]
pub page_lock_before: bool,
}

fn default_load_chunks_parallelism() -> usize {
Expand Down
13 changes: 10 additions & 3 deletions iris-mpc/src/bin/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1094,10 +1094,10 @@ async fn server_main(config: Config) -> eyre::Result<()> {

let device_manager_clone = actor.device_manager.clone();

let page_lock_after = config.page_lock_after;
let page_lock_sleep = config.page_lock_sleep;
// prepare the handle for the rest of the page locks
let page_lock_handle = spawn_blocking(move || {
if page_lock_after {
if page_lock_sleep {
tracing::info!("Sleeping before page lock");
sleep(Duration::from_secs(120));
}
Expand Down Expand Up @@ -1129,6 +1129,11 @@ async fn server_main(config: Config) -> eyre::Result<()> {
now.elapsed()
);
});
let mut page_lock_handle = Some(page_lock_handle);

if config.page_lock_before {
page_lock_handle.take().unwrap().await?;
}

let now = Instant::now();
let mut record_counter = 0;
Expand Down Expand Up @@ -1268,7 +1273,9 @@ async fn server_main(config: Config) -> eyre::Result<()> {
actor.preprocess_db();

tracing::info!("Waiting for all page-locks to finish");
page_lock_handle.await.expect("Error while page-locking");
if !config.page_lock_before {
page_lock_handle.take().unwrap().await?;
}

tracing::info!(
"Loaded {} records from db into memory in {:?} [DB sizes: {:?}]",
Expand Down

0 comments on commit 18c109f

Please sign in to comment.