Page 1 of 1

Run FAH below certain CPU threshold

Posted: Thu Sep 17, 2020 10:45 pm
by StoreyODST
Hi there!

I'm part of a community which is paying for a relatively powerful virtual private server, and we're looking into ways to run the FAH client whenever it's idling/not in use to pitch in for the cause. However, this will depend on us being able to kick FAH off whenever CPU rises above a certain threshold so that it doesn't eat up our CPU when we use it for normal functions.

Does anyone know how to make it so that FAH only kicks in above a certain % CPU usage? We're running box-standard Windows 10 Pro which we access remotely, if it helps.

First post on this site, so thanks a ton for any help :D

Re: Run FAH below certain CPU threshold

Posted: Fri Sep 18, 2020 12:07 am
by JimboPalmer
Welcome to Folding@Home!

1) by default F@H is run at a very low CPU priority, so any other task will run instead.

2) one option is 'on idle' which only runs when the OS thinks it is idle. (and so the rules are different for every OS)

3) There are various scripts to start and stop F@H, but again they vary by OS.

Re: Run FAH below certain CPU threshold

Posted: Fri Sep 18, 2020 2:00 am
by MeeLee
Another option is to manually pause the client, when you know you're going to do a lot of (CPU/GPU) work on the server, and unpause when done.

Re: Run FAH below certain CPU threshold

Posted: Fri Sep 18, 2020 8:08 am
by PantherX
Welcome to the F@H Forum StoreyODST,

Can you please describe your physical hardware you have and how you're managing your virtualization?

For example, you can create a 8 CPU Ubuntu VM which runs at a lower priority in VMWare which means that if other VMs need CPU cycles, they get it.

You can also allocate minimum CPU Usage to production VMs and non for F@H VM in Hyper-V.

BTW, the preference for an Ubuntu VM is that there's lower overhead and no licensing costs associated so can be cheaper to run.

Re: Run FAH below certain CPU threshold

Posted: Sat Sep 19, 2020 4:58 pm
by StoreyODST
PantherX wrote:Welcome to the F@H Forum StoreyODST,

Can you please describe your physical hardware you have and how you're managing your virtualization?

For example, you can create a 8 CPU Ubuntu VM which runs at a lower priority in VMWare which means that if other VMs need CPU cycles, they get it.

You can also allocate minimum CPU Usage to production VMs and non for F@H VM in Hyper-V.

BTW, the preference for an Ubuntu VM is that there's lower overhead and no licensing costs associated so can be cheaper to run.
We don't own the physical hardware- we're paying for a VM hosted by a provider, which we use to run a game server for our community. We run the VM with on Windows 10 for ease of use, since some of the programs specific to our use aren't available on Linux. Since our players aren't on as often during the week, we'd like to dedicate some of our off-hour processing power to running FAH, but we're looking to find a way to have it turn automatically on and off when non-FAH CPU usage is above a certain threshold, i.e. when servers are in use.

We don't have access to HyperV, so our VM functions just like a normal Windows machine, albeit a bit faster in CPU/bandwidth. We usually access it via RDP, with backups available for the head admin.

Approximate specs are as follows:
- CPU: 1x vCPU w/ 4 vCores @ 4.0+ GHz (Shows up as an Intel Core i9 9900K in Task Manager))
- RAM: 10gb DDR4
- 150 GB SSD (Most of it already in use)
- No GPU
- 500 Mb/s unmetered bandwidth

Additionally, some other questions to ask:
1. Does anyone know if FAH's idle function only works when there's user input (such as from RDP), or does it turn off when other programs are in use?
2. Is there any way to 'limit' FAH CPU usage in Windows aside from modifying core count?
3. As a backup, any recommended mobile apps to control FAH? Do they work?

Thanks for the help!

Re: Run FAH below certain CPU threshold

Posted: Sat Sep 19, 2020 5:13 pm
by ajm
As JimboPalmer said above, if you only use the CPU, you don't have to do anything special: by default, FAH runs at the lowest priority and will let your VM do other CPU tasks as soon as they are launched.
As for a mobile app, if you already use RDP, why not use its mobile version?
https://docs.microsoft.com/en-us/window ... op-clients

Re: Run FAH below certain CPU threshold

Posted: Sat Sep 19, 2020 5:21 pm
by Joe_H
1. The Idle function on Windows is based around user input and typically is when either the screen would be turned off due to inactivity or a screensaver would run.

The client normally runs at the lowest priority, so usually that is enough to get it out of CPU scheduling once a higher priority process becomes active. It is scriptable, the FAHClient process accepts connections using telnet over port 36330 on the local IP 127.0.0.1. So a script that monitors whether a particular program is active or not could be used to send a Pause or Resume command.

FAHControl can also be setup on a remote system to control the client.

3. The mobile apps I am familiar with mostly do monitoring, I don't know if any also allow control such as stopping and starting processing. FAH Mobile Monitor for iOS devices is one, he was working on porting to Android at one point.

You can also program your own, there is an API defined for communicating with the client - https://github.com/FoldingAtHome/fah-co ... Client-API.

Re: Run FAH below certain CPU threshold

Posted: Sat Sep 19, 2020 6:17 pm
by bruce
The idea of suspending FAHClient/FAHCore_xx when other tasks are using resources is a challenging approach. Wouldn't it be easier to take advantage of priority settings that are built into the OS so that whenever resources are needed by other programs, FAH suspends itself and yields resources to the other activities? That's the sole purpose that priority settings were invented.

Re: Run FAH below certain CPU threshold

Posted: Sat Sep 19, 2020 6:52 pm
by MeeLee
ajm wrote:As JimboPalmer said above, if you only use the CPU, you don't have to do anything special: by default, FAH runs at the lowest priority and will let your VM do other CPU tasks as soon as they are launched.
As for a mobile app, if you already use RDP, why not use its mobile version?
https://docs.microsoft.com/en-us/window ... op-clients
Not sure this still works when ran in a VM.
Usually, I would expect that the CPU would distribute resources to the VMs. Not to FAH.
FAH wouldn't see that there's something else using CPU cycles in a VM.

However, you could run FAH on all cores 100%, and set the VM priority to idle or low.
And set the VM hosting the game server as high.
The main issue with that, is that your server will be running 100% all the time. And that with a reset, reboot or power outage, Windows would reset the thread priorities upon booting up.