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

Allow for number of scanners to be configurable #762

Merged
merged 1 commit into from
Jan 15, 2025

Conversation

egibs
Copy link
Member

@egibs egibs commented Jan 15, 2025

Follow-up for #760 -- turns out, yara-x is trying to reserve a large amount of memory for each scanner it creates which causes issues in Cloud Run.

To avoid this, we can make the number of scanners configurable (similar to overall concurrency).

I tested this and the performance difference between one scanner and the default of runtime.NumCPU is about 7x for very large packages (number of files), so hopefully we can at least run 2-4 in Cloud Run. That said, we can always sacrifice performance for stability and most scans are in the tens of files, not hundreds of thousands.

To set the new value, we'll just add MaxScanners: <value> to the config where necessary (similar to the changes in the refresh code in this PR).

@egibs egibs requested a review from stevebeattie January 15, 2025 04:20
@egibs egibs force-pushed the configurable-scanners branch 3 times, most recently from a6f6a36 to 41e9c52 Compare January 15, 2025 04:35
Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
@egibs egibs force-pushed the configurable-scanners branch from 41e9c52 to 43251f8 Compare January 15, 2025 04:37
@egibs egibs merged commit 4b4643a into chainguard-dev:main Jan 15, 2025
9 checks passed
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