forked from matter-labs/zksync-era
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Archive old prover jobs (matter-labs#1516)
## What ❔ Add recurring job that moves fri prover jobs that are older than set time to fri_prover_jobs_archive ## Why ❔ To make querying the jobs faster ## Checklist <!-- Check your PR fulfills the following items. --> <!-- For draft PRs check the boxes as you complete them. --> - [x] PR title corresponds to the body of PR (we generate changelog entries from PRs). - [x] Tests for the changes have been added / updated. - [x] Documentation comments have been added / updated. - [x] Code has been formatted via `zk fmt` and `zk lint`. - [x] Spellcheck has been run via `zk spellcheck`. - [x] Linkcheck has been run via `zk linkcheck`.
- Loading branch information
1 parent
0a13602
commit 201476c
Showing
12 changed files
with
203 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
core/lib/zksync_core/src/house_keeper/fri_prover_jobs_archiver.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
use prover_dal::{Prover, ProverDal}; | ||
use zksync_db_connection::connection_pool::ConnectionPool; | ||
|
||
use crate::house_keeper::periodic_job::PeriodicJob; | ||
|
||
#[derive(Debug)] | ||
pub struct FriProverJobArchiver { | ||
pool: ConnectionPool<Prover>, | ||
reporting_interval_ms: u64, | ||
archiving_interval_secs: u64, | ||
} | ||
|
||
impl FriProverJobArchiver { | ||
pub fn new( | ||
pool: ConnectionPool<Prover>, | ||
reporting_interval_ms: u64, | ||
archiving_interval_secs: u64, | ||
) -> Self { | ||
Self { | ||
pool, | ||
reporting_interval_ms, | ||
archiving_interval_secs, | ||
} | ||
} | ||
} | ||
|
||
#[async_trait::async_trait] | ||
impl PeriodicJob for FriProverJobArchiver { | ||
const SERVICE_NAME: &'static str = "FriProverJobArchiver"; | ||
|
||
async fn run_routine_task(&mut self) -> anyhow::Result<()> { | ||
let archived_jobs = self | ||
.pool | ||
.connection() | ||
.await | ||
.unwrap() | ||
.fri_prover_jobs_dal() | ||
.archive_old_jobs(self.archiving_interval_secs) | ||
.await; | ||
tracing::info!("Archived {:?} fri prover jobs", archived_jobs); | ||
metrics::counter!("server.prover_fri.archived_jobs", archived_jobs as u64); | ||
Ok(()) | ||
} | ||
|
||
fn polling_interval_ms(&self) -> u64 { | ||
self.reporting_interval_ms | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
[house_keeper] | ||
l1_batch_metrics_reporting_interval_ms=10000 | ||
gpu_prover_queue_reporting_interval_ms=10000 | ||
prover_job_retrying_interval_ms=300000 | ||
prover_stats_reporting_interval_ms=5000 | ||
witness_job_moving_interval_ms=30000 | ||
witness_generator_stats_reporting_interval_ms=10000 | ||
fri_witness_job_moving_interval_ms=40000 | ||
fri_prover_job_retrying_interval_ms=30000 | ||
fri_witness_generator_job_retrying_interval_ms=30000 | ||
prover_db_pool_size=2 | ||
fri_prover_stats_reporting_interval_ms=30000 | ||
fri_proof_compressor_job_retrying_interval_ms=30000 | ||
fri_proof_compressor_stats_reporting_interval_ms=10000 | ||
l1_batch_metrics_reporting_interval_ms = 10000 | ||
gpu_prover_queue_reporting_interval_ms = 10000 | ||
prover_job_retrying_interval_ms = 300000 | ||
prover_stats_reporting_interval_ms = 5000 | ||
witness_job_moving_interval_ms = 30000 | ||
witness_generator_stats_reporting_interval_ms = 10000 | ||
fri_witness_job_moving_interval_ms = 40000 | ||
fri_prover_job_retrying_interval_ms = 30000 | ||
fri_witness_generator_job_retrying_interval_ms = 30000 | ||
prover_db_pool_size = 2 | ||
fri_prover_stats_reporting_interval_ms = 30000 | ||
fri_proof_compressor_job_retrying_interval_ms = 30000 | ||
fri_proof_compressor_stats_reporting_interval_ms = 10000 | ||
fri_prover_job_archiver_reporting_interval_ms = 1800000 | ||
fri_prover_job_archiver_archiving_interval_ms = 172800 |
22 changes: 22 additions & 0 deletions
22
...ver_dal/.sqlx/query-6cfc59d2fc039c706f30ae91b7d9d0c658093dede5eb61489205aa751ad5b8ec.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters