-
Notifications
You must be signed in to change notification settings - Fork 25
feat: introduces workerpool #306
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
base: master
Are you sure you want to change the base?
Conversation
Great job! No new security vulnerabilities introduced in this pull request |
b7f3ada
to
3a71a7c
Compare
Benchmark Analysis (10 runs each) on a CPU with 8 coresPerformance Summary50 Items - Best Performers (by mean)
100 Items - Best Performers (by mean)
500 Items - Best Performers (by mean)
1000 Items - Best Performers (by mean)
10000 Items - Best Performers (by mean)
Key InsightsBest Worker Counts (Overall Average)
|
76c6ed0
to
615d684
Compare
8c0ae9e
to
71aedac
Compare
71aedac
to
066f87c
Compare
pkg/scan.go
Outdated
@@ -88,6 +88,10 @@ func (s *scanner) Scan(scanItems []ScanItem, scanConfig ScanConfig) (*reporting. | |||
return &reporting.Report{}, fmt.Errorf("error(s) processing scan items:\n%w", errors.Join(errs...)) | |||
} | |||
|
|||
if err := engineInstance.Shutdown(); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we add this to ScanDynamic function as well?
cmd/workers_test.go
Outdated
go ProcessItems(engineTest, "mockPlugin") | ||
pluginName := "mockPlugin" | ||
if rand.Intn(2) == 0 { | ||
// 50% chance of filesystem, even though a scan eithers runs on one or the other, I just want to test both |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we just do one test case for each? I don't get the non-deterministic part
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because it takes twice as long and I just wanted to figure out the relationship of CPU vs IO. I can do it separate though to stay on the repo long term (I was not thinking on keeping this).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, this is a mistake, I thought I was on the benckmark
cmd/workers.go
Outdated
for item := range Channels.Items { | ||
Report.TotalItemsScanned++ | ||
item := item | ||
item := item // capture loop variable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is no longer required since go 1.22: https://tip.golang.org/doc/go1.22, "Previously, the variables declared by a “for” loop were created once and updated by each iteration. In Go 1.22, each iteration of the loop creates new variables, to avoid accidental sharing bugs..."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
old habits die hard
@@ -137,5 +137,9 @@ func (s *scanner) ScanDynamic(itemsIn <-chan ScanItem, scanConfig ScanConfig) (* | |||
} | |||
} | |||
|
|||
if err := engineInstance.Shutdown(); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you remove this call from the Scan function above? I think you had it earlier
de0fcec
to
ca72934
Compare
Closes #
Proposed Changes
Checklist
I submit this contribution under the Apache-2.0 license.