Jump to content

Change CPU affinity for Rust on the fly


Dennis

Recommended Posts

Hi,

 

 

It's probably not a surprise to anyone hosting Rust that the server startup is using a lot of CPU during navmesh generation. Rust will actually use all available cores and max out CPU usage. If the machine is sitting at 0% idle, starting a Rust server will make it jump to 100%. It the machine is sitting at 50% idle, starting a Rust server will make it jump to 100%.

 

 

We're already setting the CPU priority to low for the first 3 minutes of the server startup, but it doesn't really help much. Other game servers on the same machine will experience lag for a short amount of time during the Rust server's navmesh generation.

 

 

Has anyone figured out a way to work around this?

I've been thinking about a way to set CPU affinity to 2-3 cores during startup and then set it to use all cores afterwards. It seems to be pretty easy using Python on Unix systems, but I haven't found a solution for Windows yet.

Link to comment
Share on other sites

We've had this, and of course 7D2D too.

Not much you can do about 7d2d we've tried everything.

Rust same situation, this seems to be a unity thing.

 

Assigning cores on 7d2d doesn't do anything, on Rust it does though.

 

So far we've been trying to see if we can do a query script that will change cpu priority/cores based on how high the CPU usage is but then high pop servers get affected so it's not ideal..

Other option is to see if there's an rcon readout for it or read the log and change based on that.

Link to comment
Share on other sites

Thanks for your input, mouseymars!

 

 

Are you willing to share the script? I'm curious what it looks like. So far I haven't found a viable solution to change Affinity on the fly for Windows. I've found multiple options for Unix based systems, but not Windows :p

Link to comment
Share on other sites

  • 2 weeks later...

I once opened a ticket with Facepunch studio's to get this looked into, they simply stated that my system is on the slow side.. (The system is equipped with two Intel Xeon Silver 4110 CPU's) :roll:

Since they can't or wont bother to fix it, I simply decided rust is not worth the trouble to provide hosting services for.

 

Dennis have you tried one of the methods listed here?: https://www.tenforums.com/tutorials/89548-set-cpu-process-priority-applications-windows-10-a.html

You could script it with PowerShell or CMD. Question is how to detect reliably if the startup process has completed.

 

Out of curiosity what kind of system specs do you use and how long does it take to generate the navmesh at startup for you?

Link to comment
Share on other sites

they simply stated that my system is on the slow side

 

 

... it doesn't matter what CPU you're using, lol. I've tried starting a Rust server on a freshly installed Windows Server 2016, only to see that it will still use 100% of the CPU on 32 cores. 8 cores, 16 cores, 32 cores - it's all the same. I've tried with various CPUs, both Intel and AMD. It's always the same. It does however generate faster on better CPUs but that doesn't solve anything since even 1 second of lag is enough to ruin a round in CSGO and other competitive games. Depending on the load on our machines, navmesh takes around 10-15 seconds to generate.

 

 

I've tried to script my way out of it but haven't found a solution for it yet.

Link to comment
Share on other sites

There is literally not a lot anyone can do about this, it is Rust.

 

You could turn of nav generation to stop it but then expect complaints to the tune of 'my creatures won't move/things are not roaming' etc. But from memory did stop the CPU spiking issue but just created another issue.

 

+nav_disable "True"

 

Set the process to idle for 3 minutes then back to normal or somehow convince Rust to change fix it is the only real option and we all know that won't happen any time soon.

Link to comment
Share on other sites

  • 1 month later...
On 2/12/2020 at 12:03 AM, LFA said:

It should be ready for next week.

I see it's available in the latest update, which is great. Just two suggestions to improve it:

  1. Allow us to configure a limit in the game template, for games like Rust.
  2. It would be nice if the Windows CPU limit functions similar to the Linux CPU limit, where 100% is a single CPU core. 200% is 2 cores, etc.
    We have systems with quad cores, but we also have systems with 16 cores. The current situation is that configuring the CPU limit to 25% would be a single core in the quad core system. However on a 16 cores system this would be 4 cores, which is undesirable.

    I'm aware that Windows itself does not calculate the CPU usage like Linux does. But TCAadmin can take the amount of cores into account and calculate the percentage needed in Windows.
    It's a simple formula: the desired CPU limit in % divided by the amount of CPU cores in the system.*

    Example:

A: 4 core system: 100%/4 = 25% cap
B:  16 core system: 100%/16 = 6,25% cap

The result is that the application is limited to run at 100% of a single core on both systems.

*You would need to add a exception case where values over 100% are replaced by 100% (to prevent issues, in case the limit is configured at 500%  and is applied on a quad core system for example)

Link to comment
Share on other sites

  • 1 month later...

This new rust config will select a random CPU and set low priority at startup. Then change it back to normal when the game server is finished starting up.

 

 

On 3/26/2020 at 5:25 AM, gijs007 said:

I see it's available in the latest update, which is great. Just two suggestions to improve it:

  1. Allow us to configure a limit in the game template, for games like Rust.
  2. It would be nice if the Windows CPU limit functions similar to the Linux CPU limit, where 100% is a single CPU core. 200% is 2 cores, etc.
    We have systems with quad cores, but we also have systems with 16 cores. The current situation is that configuring the CPU limit to 25% would be a single core in the quad core system. However on a 16 cores system this would be 4 cores, which is undesirable.

    I'm aware that Windows itself does not calculate the CPU usage like Linux does. But TCAadmin can take the amount of cores into account and calculate the percentage needed in Windows.
    It's a simple formula: the desired CPU limit in % divided by the amount of CPU cores in the system.*

    Example:

A: 4 core system: 100%/4 = 25% cap
B:  16 core system: 100%/16 = 6,25% cap

The result is that the application is limited to run at 100% of a single core on both systems.

*You would need to add a exception case where values over 100% are replaced by 100% (to prevent issues, in case the limit is configured at 500%  and is applied on a quad core system for example)

 

I'll see what I can do about this.

Link to comment
Share on other sites

  • 2 years later...

Hi, can you help me? I was using linux before for Rust server and with 90+ plugins and 70+ online I had on 5950X always around 30-50 server FPS on load. No laggs etc. I switched to Windows Server, I tried to check uncheck all cpu affinity, cpu limit is 0, realtime cpu, unlimited ram and server has at load just 10-12 FPS I dont know why. The same plugins, same config, same map, same CPU, same 128GB RAM, same NVME, just different OS. Isnt possible that CPU handling at Windows is somehow different or irs somehow limited? thanks a lot for help

Link to comment
Share on other sites

6 minutes ago, Amazing_Pony said:

Hi, can you help me? I was using linux before for Rust server and with 90+ plugins and 70+ online I had on 5950X always around 30-50 server FPS on load. No laggs etc. I switched to Windows Server, I tried to check uncheck all cpu affinity, cpu limit is 0, realtime cpu, unlimited ram and server has at load just 10-12 FPS I dont know why. The same plugins, same config, same map, same CPU, same 128GB RAM, same NVME, just different OS. Isnt possible that CPU handling at Windows is somehow different or irs somehow limited? thanks a lot for help

i have replied to your thread, that you created

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Who's Online   0 Members, 0 Anonymous, 12 Guests (See full list)

    • There are no registered users currently online
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Terms of Use