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

Autotune memory #15564

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Autotune memory #15564

wants to merge 1 commit into from

Conversation

jsoref
Copy link
Contributor

@jsoref jsoref commented Feb 9, 2024

Public runners have ~10G of ram available.

XL runners have >50G of ram available.

It's nice to be able to run tests on public
runners.

Introduce an action that:

  • (Linux) frees some memory
  • (Linux) adds some swap
  • (Linux and macOS) calculates available memory
  • (Windows) suggests 10G of available memory

https://docs.github.com/en/code-security/codeql-cli/codeql-cli-manual/test-run#-m---rammb

This addresses #15471 (comment)

Note that the shooting services isn't strictly necessary and could easily be omitted.

Afaict, Windows isn't actually used, but it seemed to make sense to at least provide something.

The workflows also had some incorrect dependencies which I'm cleaning up here.

@jsoref jsoref requested review from a team as code owners February 9, 2024 05:58
@github-actions github-actions bot added the Swift label Feb 9, 2024
@jsoref jsoref force-pushed the autotune-memory branch 3 times, most recently from ca40e37 to e25316e Compare February 9, 2024 06:03
Public runners have ~10G of ram available.

XL runners have >50G of ram available.

It's nice to be able to run tests on public
runners.

Introduce an action that:
* (Linux) frees some memory
* (Linux) adds some swap
* (Linux and macOS) calculates available memory
* (Windows) suggests 10G of available memory
Comment on lines +20 to +35
- name: Stop services
if: env.RUNNER_OS == 'Linux'
shell: bash
run: |
sudo systemctl disable php8.1-fpm mono-xsp4 walinuxagent multipathd walinuxagent chrony cron getty@tty1 networkd-dispatcher rsyslog serial-getty@ttyS0 snapd multipathd.socket snapd.socket
sudo systemctl stop php8.1-fpm mono-xsp4 walinuxagent multipathd walinuxagent chrony cron getty@tty1 networkd-dispatcher rsyslog serial-getty@ttyS0 snapd
sudo killall mono

- name: enable swap
if: env.RUNNER_OS == 'Linux'
shell: bash
run: |
sudo fallocate -l 10G /mnt/big-swapfile
sudo chmod 600 /mnt/big-swapfile
sudo mkswap /mnt/big-swapfile
sudo swapon /mnt/big-swapfile
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This could be dropped

Comment on lines +65 to +70
- name: Report Available Memory (Windows)
id: memory-windows
if: runner.os == 'Windows'
shell: bash
run: |
echo "available=10240" >> "$GITHUB_OUTPUT"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

As noted, there doesn't appear to be a consumer for this at this time, but having at least a stub implementation seemed better than nothing.

Comment on lines +8 to +10
- .github/workflows/csharp-qltest.yml
- .github/actions/fetch-codeql/action.yml
- .github/actions/cache-query-compilation/action.yml
Copy link
Contributor Author

Choose a reason for hiding this comment

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

these two are used but weren't checked

@@ -16,6 +19,8 @@ on:
- "shared/**"
- .github/workflows/csharp-qltest.yml
- .github/actions/fetch-codeql/action.yml
- .github/actions/cache-query-compilation/action.yml
Copy link
Contributor Author

Choose a reason for hiding this comment

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

only one was missing here...

- .github/workflows/ruby-build.yml
- .github/workflows/ruby-qltest.yml
Copy link
Contributor Author

Choose a reason for hiding this comment

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

bad copy paste?

- .github/actions/fetch-codeql/action.yml
- .github/actions/cache-query-compilation/action.yml
Copy link
Contributor Author

Choose a reason for hiding this comment

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

used but not checked

- .github/actions/fetch-codeql/action.yml
- .github/actions/cache-query-compilation/action.yml
- .github/actions/reasonable-memory/action.yml
- csharp/actions/create-extractor-pack/action.yml
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is amusing -- it probably should be moved to .github/actions -- the idea that ruby is using a csharp action is pretty confusing.

- codeql-workspace.yml
branches:
- main
- "rc/*"
workflow_dispatch:
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's really handy to be able to test these workflows (especially given that they have branch constraints that prevent normal testing)

@@ -32,6 +32,7 @@ on:
- main
- rc/*
- codeql-cli-*
workflow_dispatch:
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's really handy to be able to test these workflows (especially given that they have branch constraints that prevent normal testing)

@jsoref jsoref mentioned this pull request Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant