Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: Add prover jobs as one multi-insert for Witness Generator #3587

Merged
merged 12 commits into from
Feb 11, 2025

Conversation

sanekmelnikov
Copy link
Collaborator

@sanekmelnikov sanekmelnikov commented Feb 10, 2025

What ❔

This PR modifies the logic of inserting prover jobs to the database - switching from adding each job sequentially to performing once multi-insert for all rows.

Why ❔

Currently insert_prover_jobs iterates over jobs one by one and makes one network call per job insert.
This is inefficient and can result into big latency for cases when Witness Generator and DB are located in different regions. BWG is especially affected since there can be 10k+ jobs added here
We expect a significant gain in performance for the non collocated BWG and DB setup.

Checklist

  • PR title corresponds to the body of PR (we generate changelog entries from PRs).
  • Tests for the changes have been added / updated.
  • Documentation comments have been added / updated.
  • Code has been formatted via zkstack dev fmt and zkstack dev lint.

@sanekmelnikov sanekmelnikov changed the title Prover chunked jobs insert fix: Add prover jobs as one multi-insert for Witness Generator Feb 10, 2025
@sanekmelnikov sanekmelnikov changed the title fix: Add prover jobs as one multi-insert for Witness Generator perf: Add prover jobs as one multi-insert for Witness Generator Feb 10, 2025
@sanekmelnikov sanekmelnikov marked this pull request as ready for review February 10, 2025 16:21
EmilLuta
EmilLuta previously approved these changes Feb 11, 2025
EmilLuta
EmilLuta previously approved these changes Feb 11, 2025
prover/crates/lib/prover_dal/Cargo.toml Outdated Show resolved Hide resolved
@sanekmelnikov sanekmelnikov added this pull request to the merge queue Feb 11, 2025
Merged via the queue into main with commit d150dca Feb 11, 2025
32 checks passed
@sanekmelnikov sanekmelnikov deleted the alm-prover-multiinsert branch February 11, 2025 19:29
Artemka374 pushed a commit that referenced this pull request Feb 12, 2025
## What ❔
This PR modifies the logic of inserting prover jobs to the database -
switching from adding each job sequentially to performing once
multi-insert for all rows.

## Why ❔
Currently
[insert_prover_jobs](https://github.com/matter-labs/zksync-era/blob/prover-v18.0.0/prover/crates/lib/prover_dal/src/fri_prover_dal.rs#L32-L57)
iterates over jobs one by one and makes one network call per job insert.
This is inefficient and can result into big latency for cases when
Witness Generator and DB are located in different regions. BWG is
especially affected since there can be 10k+ jobs added
[here](https://github.com/matter-labs/zksync-era/blob/prover-v18.0.0/prover/crates/bin/witness_generator/src/rounds/basic_circuits/artifacts.rs#L71-L111)
We expect a significant gain in performance for the non collocated BWG
and DB setup.

## Checklist

- [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 `zkstack dev fmt` and `zkstack dev
lint`.
Artemka374 pushed a commit that referenced this pull request Feb 13, 2025
## What ❔
This PR modifies the logic of inserting prover jobs to the database -
switching from adding each job sequentially to performing once
multi-insert for all rows.

## Why ❔
Currently
[insert_prover_jobs](https://github.com/matter-labs/zksync-era/blob/prover-v18.0.0/prover/crates/lib/prover_dal/src/fri_prover_dal.rs#L32-L57)
iterates over jobs one by one and makes one network call per job insert.
This is inefficient and can result into big latency for cases when
Witness Generator and DB are located in different regions. BWG is
especially affected since there can be 10k+ jobs added
[here](https://github.com/matter-labs/zksync-era/blob/prover-v18.0.0/prover/crates/bin/witness_generator/src/rounds/basic_circuits/artifacts.rs#L71-L111)
We expect a significant gain in performance for the non collocated BWG
and DB setup.

## Checklist

- [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 `zkstack dev fmt` and `zkstack dev
lint`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants