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

CI: better parallelism for functionality-test build #1805

Closed
wants to merge 2 commits into from

Conversation

kinkie
Copy link
Contributor

@kinkie kinkie commented Apr 29, 2024

Use nproc to detect the actual number of CPU cores available instead of
going by an old "2 cores" value from GitHub Actions runners docs.

.github/workflows/default.yaml Show resolved Hide resolved
- run: |
sudo make install
sudo make -j`nproc` install
Copy link
Contributor

Choose a reason for hiding this comment

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

This change request assumes that old "make [all]" command was restored and this line is specific to Squid installation.

I am not violently against adding -jn to "make install", but it feels wrong (unless it buys us significantly faster builds) because most folks are not going to use this kind of installation command and because errors from parallel installs are more difficult to interpret. In other words, I think this optimization needs to be justified.

@@ -44,9 +44,8 @@ jobs:

- run: ./bootstrap.sh
- run: ./configure --with-openssl
- run: make -j2
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a better way to trigger parallel builds than remembering to specify -j... every time we ran "make"? Perhaps we should set MAKEFLAGS or use some kind of autoconf/automake tricks?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think environment variables are even worse than -jarg as they are not explicitly visible, are sticky and might be not propagated in case of exec or containerized runs

Copy link
Contributor

Choose a reason for hiding this comment

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

Just -j with not specific N value may be what you are after.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

AFAIK "-j" with no numeric argument means "use as many parallel processes as you want". This doesn't sound a good idea in a shared environment where resources (especially core memory) might be constrained. Am I missing anything?

Copy link
Contributor

Choose a reason for hiding this comment

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

I share Francesco's concern. FWIW, IIRC, in some environments I have tested (with more than n=2 CPU cores), -j was noticeably slower than -jn.

I am not going to object to bare -j if others prefer that but please make this decision based on GitHub Actions CI tests.

@rousskov rousskov changed the title github workflow: improve parallelism CI: Parallelize GitHub Actions functionality-tests install Apr 29, 2024
@rousskov rousskov added the S-waiting-for-author author action is expected (and usually required) label Apr 29, 2024
@kinkie kinkie changed the title CI: Parallelize GitHub Actions functionality-tests install CI: better parallelism for functionality-test build Apr 29, 2024
@kinkie kinkie requested a review from rousskov April 29, 2024 21:19
@kinkie kinkie added S-waiting-for-reviewer ready for review: Set this when requesting a (re)review using GitHub PR Reviewers box and removed S-waiting-for-author author action is expected (and usually required) labels Apr 29, 2024
@@ -44,9 +44,8 @@ jobs:

- run: ./bootstrap.sh
- run: ./configure --with-openssl
- run: make -j2
Copy link
Contributor

Choose a reason for hiding this comment

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

I share Francesco's concern. FWIW, IIRC, in some environments I have tested (with more than n=2 CPU cores), -j was noticeably slower than -jn.

I am not going to object to bare -j if others prefer that but please make this decision based on GitHub Actions CI tests.

@rousskov rousskov added S-waiting-for-author author action is expected (and usually required) and removed S-waiting-for-reviewer ready for review: Set this when requesting a (re)review using GitHub PR Reviewers box labels Apr 30, 2024
@rousskov
Copy link
Contributor

I have adjusted PR description to detail this change rationale and the source of the original n=2 value.

@kinkie
Copy link
Contributor Author

kinkie commented May 1, 2024

Notice: in practice this might or might not help on average, but it will ensure we make use of whatever resources Github will give to the worker we are allocated when we are.

Landing this

@kinkie kinkie added M-cleared-for-merge https://github.com/measurement-factory/anubis#pull-request-labels and removed S-waiting-for-author author action is expected (and usually required) labels May 1, 2024
squid-anubis pushed a commit that referenced this pull request May 1, 2024
Use nproc to detect the actual number of CPU cores available instead of
going by an old "2 cores" value from GitHub Actions runners docs.
@squid-anubis squid-anubis added the M-waiting-staging-checks https://github.com/measurement-factory/anubis#pull-request-labels label May 1, 2024
@squid-anubis squid-anubis added M-merged https://github.com/measurement-factory/anubis#pull-request-labels and removed M-waiting-staging-checks https://github.com/measurement-factory/anubis#pull-request-labels M-cleared-for-merge https://github.com/measurement-factory/anubis#pull-request-labels labels May 2, 2024
kinkie added a commit to kinkie/squid that referenced this pull request Jun 22, 2024
Use nproc to detect the actual number of CPU cores available instead of
going by an old "2 cores" value from GitHub Actions runners docs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
M-merged https://github.com/measurement-factory/anubis#pull-request-labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants