vmactions / freebsd-vm

Use FreeBSD in github actions
https://vmactions.org
MIT License
252 stars 22 forks source link

Option use all available CPUs on the host system #85

Closed nbolton closed 1 month ago

nbolton commented 1 month ago

Our FreeBSD runner serves an important purpose for our project, but it is the slowest runner. Part of that is the setup time, but it also seems slow to build relative to the other runners.

https://github.com/symless/synergy/actions/runs/10729741089/job/29756905498?pr=7474

I attempted to speed up the execution by using a 16-core paid-for GitHub runner, but that didn't seem to make any difference. Is it possible that the created VM is not being assigned all cores of the host?

Side note: Another speed optimization I'm thinking about is pre-installing all of the apt dependencies on a Docker container and using that instead of the stock GitHub Ubuntu image.

Neilpang commented 1 month ago

Hi,

I just don't get your point that: not assign all the cores to the vm could ever speed up it?

It uses about 8 minutes for your project. It looks to me not that slow. I would recommend to keep thing simple.

nbolton commented 1 month ago

Hi, thanks for replying.

not assign all the cores to the vm could ever speed up it?

Hmm, I'm not quite sure what this means. Could you rephrase?

keep thing simple.

I agree that keeping things simple is a good objective, and I'm not suggesting we add complexity.

My point was: Does the created FreeBSD VM use only a single core or does it use all/multiple cores from the host machine?

Our build step uses multiple cores to build concurrently and tends to build around 2x faster when increasing the cores from 4 to 8 (i.e. with -j8 and using an 8 core paid-for runner).

Neilpang commented 1 month ago

@nbolton please try with the latest release, it uses all the cpu cores on the host by default. you can also use the config "cpu: 4" to limit the cpu cores.

nbolton commented 1 month ago

Very nice, thank you, I'll give that a shot and let you know the result.

nbolton commented 1 month ago

Thank you, that made a positive difference. With a 16-CPU runs-on, our build time is reduced by 25% (-2 mins). With the previous version, the build time was the same between 4-CPU and 16-CPU runs-on.