Skip to content

Conversation

@efritz
Copy link
Contributor

@efritz efritz commented May 13, 2022

Following up from additional comments in #731 (some were hidden by the long timeline in the github view pre merge, and @DaedalusG and I forgot to address these in our 1-1).

Test plan

N/A.

@efritz efritz requested review from DaedalusG and LawnGnome May 13, 2022 19:15
@efritz efritz self-assigned this May 13, 2022
@efritz efritz mentioned this pull request May 13, 2022
ch := make(chan *archiveFile)
g, ctx := errgroup.WithContext(ctx)
semaphore := semaphore.NewWeighted(8)
semaphore := semaphore.NewWeighted(int64(runtime.GOMAXPROCS(0)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is interesting, I'm not familiar with runtime.GOMAXPROCS(0), will definitely do some research here 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It gives you the recommended number of processes/goroutines that can run in parallel (not just concurrently). It's relational to your cpu die count.

Copy link
Contributor

@DaedalusG DaedalusG May 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, will this potentially reintroduce issues with open file limits? Or reduce the effectiveness of the semaphore in throttling remotely executed requests? In my understanding, this will scale the semaphore's limit to the host machine running src's resources?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Number of cpu cores is way under the Linux file handle limit by many orders of magnitude

Copy link
Contributor

@DaedalusG DaedalusG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good and mostly seems like clarification of naming conventions. Except semaphore := semaphore.NewWeighted(int64(runtime.GOMAXPROCS(0))) which I'll need to learn more about.

Has the command been tested with these changes? If not I'm happy to test these out before merge.

Approving anyway

@efritz efritz merged commit 29df2bd into main May 18, 2022
@efritz efritz deleted the ef/wip branch May 18, 2022 16:11
scjohns pushed a commit that referenced this pull request Apr 24, 2023
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.

4 participants