Tsuwamono

High CPU Usage

6 posts in this topic

Hi all!
I have a few questions about Dedicated Server’s CPU usage.

Background:
1. I have installed Dedicated Server on a headless server running Debian 8, intending to serve a game for 2-6 friends. 
The machine is really small and I am aware of it’s capabilities, but has served me well for many projects. It’s a mITX-based PC with AMD E-350 (2x1.6GHz) and 4GB of RAM
After starting DST Dedicated Servers (with pause_when_empty = true), each of them (Master and Caves) was taking about 23% of CPU’s core with no clients connected. The usage was rising by 15-20% with each new client. 
2. I found it a bit too much so I have tested it on an Intel [email protected] running Ubuntu 16.04, but the results were even worse – about 19% per server process with no clients on a way more powerful CPU (let’s say it’s more than 5x faster than the E-350). The CPU usage “per client“ was indeed much lower (~7%), but not as much as one would expect.
3. Next test was on an [email protected] with Windows 10 and gave interesting results – each idle server process used ~0,6% according to Windows Task Manager, which would give ~7.2% of a single logical core. Such a huge difference was actually a surprise, since core’s performances of i7-6700 and i7-5930K are not so different (according to PassMark, it’s 2160 and 2093 respectively). I would understand a difference under 30%, but this confused me. I’m still going to test it on i7-5930K with Ubuntu to confirm the OS impact, I just didn’t have time yesterday to do that.

My concerns:
1. Are my observations of CPU usage correct? Is it normal for the Server to be such a CPU hog? I’m new to this game (3 days), so I can’t correctly estimate the amount of work that the Server has to do to handle players, so I totally accept that there is something that I’m not aware of. I just have problem with imagining what that would be. I can only relate to some other game servers (including Java-based MMO server) which I tested in the past on my AMD machine and which I would expect to be way more resource demanding, but still were performing better.
2. What’s with the enormous CPU usage in the IDLE state? What I mean is, the server is basically doing nothing but waiting for players. The world is paused and nothing is actually happening there. Am I missing something?

These concerns bring up the questions – Is it normal behavior for the Server (high "idle" CPU usage and high “per client” CPU usage)? Was it always like that or is it only a bug in the recent version? Or maybe I simply have done something wrong installing/configuring it? I used the pinned tutorial from this forum, so the configuration is exactly the same as in examples.

I will be grateful for any help and hints.

Share this post


Link to post
Share on other sites

Hi!

As much as I'd love to set up a dedicated Don't Starve Together server on a headless GNU/Linux machine, I haven't had the time or opportunity to do so. :/ Hence I only have limited personal experience to share.

That being said, here is a link to a similar question which I had earlier: http://forums.kleientertainment.com/topic/78145-dst-and-cpu-scaling

As stated in the answers, DST server instances rely on a single core. If you run a server setup with two shards (Overworld + Caves), it could maybe be a good idea to reserve one CPU core for each shard. I haven't tried it myself, but it would probably be one of the first things that I would try in order to optimize performance.

As for high idling CPU usage, I am not sure. Even when "idling" I am sure that the game is doing quite a few things. A high tick rate (60) will surely cause high CPU usage when a few players are connected. You can set the tick rate in the server configuration. A higher tick rate is better, as long as the CPU can keep up with updating the game (default is 30 and the highest is 60).

Share this post


Link to post
Share on other sites

Posted (edited)

Thanks for your response!

I've read about the Server not using more than 1 core. Developers had their reasons - I'm not judging.
Unfortunately pinning each server process to its own core didn't make any difference, but thanks for the idea.

I'v played around with configuration parameters. Especially 2 of them had some effect (tests were performed on the AMD server):

  1. tick_rate (as you suggested) - from what I've read, the default value is actually 15. Indeed setting it explicitly to 15 had no impact on the CPU usage. Setting it to 60 increased the usage drastically (0 clients: 32%, 1 client: 62-70%, 2 clients: 86-90%)
  2. offline_server - setting it to true halved “idle” CPU usage. Unfortunately, I need my server to be easily available from the Internet (no VPNs and other tricks), also you can't receive all the shiny things on the offline server. And I will stick to my opinion - 11% is still too much for an idle server.
3 hours ago, Captain_Rage said:

As for high idling CPU usage, I am not sure. Even when "idling" I am sure that the game is doing quite a few things.

Out of curiosity, what would you suggest it is doing? I mean tasks that combined would constantly use more than 0.1%. So I'm not talking about re-announcing itself to the main server, etc. One clue is that there are some heavy tasks related to the server being an Online one (offline_server parameter).

To sum up what I've got so far:

offline_server = false
tick_rate = 15

0 clients - Master (23%), Caves (23%)
1 client - Master (49%), Caves (30%)
2 clients - Master (55-60%), Caves (30%)

 

offline_server = true
tick_rate = 15

0 clients - Master (11%), Caves (11%)
1 client - Master (37%), Caves (22%)
2 clients - Master (50%), Caves (22%)

 

offline_server = false
tick_rate = 60

0 clients - Master (32%), Caves (32%)
1 client - Master (62%), Caves (40%)
2 clients - Master (88%), Caves (40%)

 

All clients connect to the Master. Nobody is entering caves, so I guess that the ~7-11% jump on the Caves server, after the first client's connection, is the effect of resuming the world.

Edited by Tsuwamono

Share this post


Link to post
Share on other sites

From what I experienced so far the CPU usage is dictated by at least 3 factors: tick_rate (set at 15), max player slots (set at 8) and depending on the world age how much junk is on the ground.

offline_server = false, tick_rate = 15, max_players = 8, running from a Linux Mint with E8200 CPU

0 clients - Master (10-11%), Caves (10-11%)
1 client - Master (21-23%), Caves (17-18%)

When will get more people on will return with the stats.

Share this post


Link to post
Share on other sites

Nice that you tried changing the core affinities in practice. Too bad it didn't have any impact on CPU utilitization.

I don't have anything to back up my claims, sorry. Once you start a new world on a dedicated server, without any players, the CPU usage shouldn't be extremely high. I also find that a bit strange. I was thinking that maybe the server is still populating the game with different things, even once it has loaded (like world regrowth), but 23% CPU usage does indeed sound hefty for a freshly started and uninhabitated game.

When I start a non-dedicated game on my poor laptop, it actually runs smooth for the first few minutes, but as time goes on and the world gets populated with different entities my laptop succumbs. The amount of "junk", like cezarica wrote, seems to have a big impact (even things off-screen). With that said, DST runs way better now though, in comparison to a few months ago, on the same machine. Kudos to Klei.

Share this post


Link to post
Share on other sites

Posted (edited)

It eat the CPU usage a lot... Especially when it saving too. If your CPU can't handle while it saving, you will notice the entire world froze for few seconds.

Your AMD might not able to handle it with the 1.6Ghz. I got the one with around 2.4Ghz or something around there. It will start reaching to 100% CPU with 4 or 5 clients in it. It cause me a huge lag in the game due to the CPU performance. So you will have same issue if more than 4 players join.

I got an i7 running with multiple game servers on it.

PBuaFlB.png

That DST take like 20%-40% of a thread. I don't seem to worry about it tho. Tick rate is as default.

Those CPU usage you have, its actually a normal behavior.

Edited by Circleus

Share this post


Link to post
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