Skip to content

⚡ Concurrent network requests during vulnerability scan - #102

Merged
ffalcinelli merged 2 commits into
mainfrom
perf-scan-concurrency-16550724750647880890
Aug 4, 2026
Merged

⚡ Concurrent network requests during vulnerability scan#102
ffalcinelli merged 2 commits into
mainfrom
perf-scan-concurrency-16550724750647880890

Conversation

@ffalcinelli

Copy link
Copy Markdown
Owner

💡 What

Refactored the sequential await calls in the unique_targets loop of src/pipeline/scan.rs to use futures::stream::iter and .buffer_unordered(10).

🎯 Why

When scanning multiple dependency targets, the OSV vulnerability check and provenance verification previously blocked on each network response sequentially. By using a concurrent stream, we avoid spinning up explicit tasks/threads while allowing up to 10 network requests to execute simultaneously, substantially reducing the total wall-clock time for I/O-bound security checks.

📊 Measured Improvement

Although measuring raw network calls in local benchmarks is flaky, tests compiled cleanly, and this change transforms an O(N) sequential I/O wait into a parallelized execution scaled by a fixed concurrency factor of 10. Time spent blocked on network queries is strictly minimized compared to the original sequential loop.


PR created automatically by Jules for task 16550724750647880890 started by @ffalcinelli

Refactored the sequential `await` of network requests for `verify_provenance`
and `check_vulnerabilities` into a concurrent stream using `futures::stream::iter`
and `.buffer_unordered(10)`. This reduces the total scan time by allowing
up to 10 asynchronous I/O bounds to run simultaneously.

Co-authored-by: ffalcinelli <1167082+ffalcinelli@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Refactored the sequential `await` of network requests for `verify_provenance`
and `check_vulnerabilities` into a concurrent stream using `futures::stream::iter`
and `.buffer_unordered(10)`. This reduces the total scan time by allowing
up to 10 asynchronous I/O bounds to run simultaneously. Includes rustfmt
fixes to pass CI.

Co-authored-by: ffalcinelli <1167082+ffalcinelli@users.noreply.github.com>
@ffalcinelli
ffalcinelli merged commit 5eced0a into main Aug 4, 2026
4 checks passed
@ffalcinelli
ffalcinelli deleted the perf-scan-concurrency-16550724750647880890 branch August 4, 2026 06:45
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.

1 participant