How to always keeping 30% of CPU cycles unused.

Moderators: Site Moderators, PandeGroup

How to always keeping 30% of CPU cycles unused.

Postby gijs007 » Sat Jan 25, 2014 3:59 pm

Hello everyone,

We've been using folding@home for a while now and also think of using it on our clans gaming servers.
These servers usually run idle for most of the day but in the evening they don't because a lot of gamers get online.

We currently have the problem that folding@home doesn't scale with the total cpu usage.
We noticed tat as the total cpu load increases folding@home doesn't doesn't scale down and causes lag on the servers.
We've even tested this with the idle light mode and using the slider under the advanced options.

Is it possible to set folding@home to always keep 30% of the cpu unused? (we want to keep the cpu load under 70% at all times to prevent lag on the servers)
gijs007
 
Posts: 5
Joined: Sat Jan 25, 2014 3:50 pm

Re: How to always keeping 30% of CPU cycles unused.

Postby P5-133XL » Sat Jan 25, 2014 4:19 pm

The normal way to limit %CPU usage is in the CPU slot (Advanced control->Config->Slots tab->double click the CPU slot) and decrease the number of threads folding uses. How much depends on the number of CPU cores your machine has.
Image
P5-133XL
 
Posts: 4034
Joined: Sun Dec 02, 2007 4:36 am
Location: Salem. OR USA

Re: How to always keeping 30% of CPU cycles unused.

Postby PantherX » Sat Jan 25, 2014 5:00 pm

Welcome to the F@H Forum gijs007,

Please note that the CPU Usage Percentage was applicable to older FahCores which are now no longer being used. Thus, the new version V7.4.2 (currently in Open Public Beta viewtopic.php?f=94&t=25657) have addressed this by removing it to avoid confusion.

If you can give us the CPU Model, we can help you find the correct value of CPU to closely match your CPU Usage. For example, if you have 8 CPUs, then the nearest match would be either 25% (set by using 2 CPUs) or 37.5% (set by using 3 CPUs), depending on your choice. The value of CPUs can be changed by the method mentioned by P5-133XL.

Also, is the priority of F@H set to idle or low? If you are unsure, please post the log especially the initial section (viewtopic.php?p=225958#p225958) which would help us.
ETA:
Now ↞ Very Soon ↔ Soon ↔ Soon-ish ↔ Not Soon ↠ End Of Time

Welcome To The F@H Support Forum Ӂ Chrome Folding App (Beta) Ӂ Troubleshooting "Bad WUs" Ӂ Troubleshooting Server Connectivity Issues
User avatar
PantherX
Site Moderator
 
Posts: 6321
Joined: Wed Dec 23, 2009 9:33 am

Re: How to always keeping 30% of CPU cycles unused.

Postby gijs007 » Sat Jan 25, 2014 7:30 pm

The cpu priority is set to lowest possible under the advanced settings.
Folding@home is set to the mode: idle light

We can reduce the amount of threads, but this wouldn't automatically change depending on the total cpu load.
Which is what we want to do because in the morning and most of the day folding@home can easily run on 6 of the 8 cores we have, but in the evening it can only run on 1 or 2 cores.

If there is some sort of application or script which could reduce the amount of cores by 1 every time the total cpu load exceeds 70% and increase the ammount of cores assigned to F@H if the total cpu load is under 50% for 1 minute we could get this working.
gijs007
 
Posts: 5
Joined: Sat Jan 25, 2014 3:50 pm

Re: How to always keeping 30% of CPU cycles unused.

Postby bruce » Sat Jan 25, 2014 8:35 pm

Do your servers have plenty of RAM?

If FAH is NOT running, how much free CPU and how much free RAM is available during "normal" gaming activities? What percentage of the CPU is Kernel processing and what percentage is user-state?
With FAH running, free CPU should be zero whether other activities are going on or not. Free RAM and Kernel processing may not change much.

What OS is running on those servers?
bruce
 
Posts: 21402
Joined: Thu Nov 29, 2007 10:13 pm
Location: So. Cal.

Re: How to always keeping 30% of CPU cycles unused.

Postby gijs007 » Sat Jan 25, 2014 10:35 pm

RAM isn't an issue we have plenty of that. The usage is like 12GB out of 32GB.

We use Windows Server 2012 on our game servers.
gijs007
 
Posts: 5
Joined: Sat Jan 25, 2014 3:50 pm

Re: How to always keeping 30% of CPU cycles unused.

Postby bruce » Sat Jan 25, 2014 11:14 pm

If RAM is not the problem, switching from a low priority CPU task like FahCore_xx to a higher priority CPU task should be virtually instantaneous even if the CPU is at 100%. That leaves no explanation for any lag introduced except for lag introduced on the GPU side of things.

What's the kernel percentage? In Task Manager, go to the Performance Tab and under View, turn on Show Kernel Times.
bruce
 
Posts: 21402
Joined: Thu Nov 29, 2007 10:13 pm
Location: So. Cal.

Re: How to always keeping 30% of CPU cycles unused.

Postby gijs007 » Sun Jan 26, 2014 12:44 pm

It's hard to say, but I would say the kernel CPU usage is about 80-90% of the the cpu usage according to the graph.

Low priority still causes for lag when using things which are affected by even the smallest delays such as games.
It wouldn't noticeable slow down your browser or anything like that, but it would with a game and maybe even with a video (if using CPU decoding instead of hardware).

The system only has a weak onboard GPU since it's a server, F@H hasn't been set to use the GPU and the game server software doesn't utilize it either.
gijs007
 
Posts: 5
Joined: Sat Jan 25, 2014 3:50 pm

Re: How to always keeping 30% of CPU cycles unused.

Postby Napoleon » Sun Jan 26, 2014 1:17 pm

HyperThreading is a possible explanation. Let's assume FAH is running in the background on all logical CPUs. An incoming request will suspend low-priority FAH thread(s) immediately and start servicing the request; this is done by the OS scheduler. However, the active folding threads will keep funneling instructions to physical CPU cores. There are two logical CPUs per physical core but only one FPU. FAH is very FPU intensive. If that is the case with the primary application as well, it might take twice as long to process a request when FAH is running. Said request and folding would be competing over the same resource (FPU), so the physical core would have to serialize the instructions from the two logical CPUs. Hence, lag.

More or less the same thing with Bulldozer-based and newer AMD CPUs, there are two logical CPUs per module but there's only one (wide) FPU per module.

Requests will be processed faster if they are heavy on integer operations, since there will be much less competition over shared resources within the physical CPU. However, the request can't be processed quite as fast when FAH is running, so perceivable - or at least measurable - lag is likely.

Perhaps the best compromise would be to (automatically) pause FAH during peak hours. Folding is rather sensitive to load imbalance, so frequent stalls to random folding threads may cause folding to slow down a lot during peak hours in any case.
Win7 64bit, FAH v7, OC'd
2C/4T Atom330 3x667MHz - GT430 2x832.5MHz - ION iGPU 3x466.7MHz
NaCl - Core_15 - display
User avatar
Napoleon
 
Posts: 1032
Joined: Wed May 26, 2010 2:31 pm
Location: Finland

Re: How to always keeping 30% of CPU cycles unused.

Postby PantherX » Mon Jan 27, 2014 12:20 am

Are those 8 real cores or 4 real cores which are hyper-threaded so you get 8 CPUs?

If you have only 4 real cores, then you can try 4 or 3 only and see if the lag disappears. The gain of points by hyper-threading isn't very significant but is still there. The reason is that F@H is FPU intensive so any gain/loss of FPU is very significant. If you have fixed game timings, you could write a script file which changes the power levels accordingly and run it on those intervals (maybe schedule a task to run those script files, am not sure of it).

Please note that a future release (V7.4.2 is currently in Open Public Beta viewtopic.php?f=94&t=25657) will change the power levels so you would have to tweak your script files if you upgrade the client version.
User avatar
PantherX
Site Moderator
 
Posts: 6321
Joined: Wed Dec 23, 2009 9:33 am

Re: How to always keeping 30% of CPU cycles unused.

Postby gijs007 » Mon Jan 27, 2014 11:29 am

Those are 4 real cores with 8 threads.
If the issue is caused by hyper threading, wouldn't disabling 4 threads in the cpu affinity solve the problem?
gijs007
 
Posts: 5
Joined: Sat Jan 25, 2014 3:50 pm

Re: How to always keeping 30% of CPU cycles unused.

Postby Napoleon » Mon Jan 27, 2014 2:22 pm

Probably, if you get it right. You might want to double-check your CPU topology with CoreInfo, but most likely it will be as follows:
  • logical CPUs 0 & 1 :arrow: physical core 0
  • logical CPUs 2 & 3 :arrow: physical core 1
  • logical CPUs 4 & 5 :arrow: physical core 2
  • logical CPUs 6 & 7 :arrow: physical core 3
If you fold with CPU:4, the OS probably is smart enough to spread folding load across the four physical cores by default, even though such behaviour might not be evident from Task Manager graphs. Whenever game requests need to be processed, they will be assigned to free logical CPUs first. FAH threads will remain fully suspended by the OS if and only if the game server SW uses up 100% of CPU (read: all eight logical CPUs) all the time.

If you don't want to pause folding entirely during peak hours, here's an idea:
  1. Configure the folding slot to CPU:4 and set FahCore_a?.exe affinity to logical CPUs 1, 3, 5, 7 outside peak hours. That'll ensure your 4 FPUs are going to be utilized pretty close to the max anyway, plus there will always be 4 logical CPUs available to deal with occasional game requests. That alone might reduce the lag to some extent
  2. During peak hours, set FahCore_a?.exe affinity to logical CPUs 4, 5, 6, 7. That way you will still be running the four FAH threads on four logical CPUs, but you'll also have two free physical CPU cores available to serve game requests
  3. In an extreme situation, you could adjust FahCore_a?.exe affinity to logical CPUs 6, 7. That would leave you three physical CPU cores free to respond to game requests, and most likely CPU:4 folding would still be limping along adequately
You will want to (actually have to) automate the process if you consider the proposal above a viable solution, but initial testing can be done very easily by using Task Manager to change the FahCore_a?.exe affinity. Do note that the FahCore affinity setting gets reset between WUs and pause/unpause cycles, hence the need for automation. There are handy 3rd party tools available for that, though.
User avatar
Napoleon
 
Posts: 1032
Joined: Wed May 26, 2010 2:31 pm
Location: Finland


Return to V7.3.6 Public Release Windows/Linux/MacOS X

Who is online

Users browsing this forum: No registered users and 1 guest

cron