Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

Question 50+% CPU usage at idle (no players connected)?

Discussion in 'Game Server Hosting' started by Laumania, Oct 29, 2023.

  1. Laumania

    Laumania

    Joined:
    Jun 27, 2012
    Posts:
    223
    Hi

    I'm playing around with making dedicated server a possibility in my game and is via that playing around with Unity's Multiplay service.

    However, I have noticed a very odd thing. My server runs at idle 50+% CPU usage. So, just the server running no players connected. The game doesn't really have more than an Enviro Sky going if no players are in.
    When running it on my own machine, it runs at less than 1% in idle stage.

    Fair enough my CPU is a lot better than the 2 CORE ones on Multiplay (which I can't upgrade apparently which is also wierd), but still, 50% idle seems like a bug of some sort.

    Screenshot_179.png

    The spikes is when I'm joining 1 player and doing some stuff to stress the system - the flat line above 50% is just the server running alone.

    Is this normal or?
     
  2. Jishh_

    Jishh_

    Unity Technologies

    Joined:
    May 23, 2020
    Posts:
    1
    Hello!

    More often than not, massive baseline CPU usage like this can actually end up being due to framerates. Try setting a sensible targetFrameRate based on the needs of your server, and see if that helps with the CPU usage.

    On local machines, it is less of an issue usually, as you're often bound by the graphical engine in the game. As everything in Game Server Hosting is running headless, you can end up with 1000+ FPS which chews up the CPU pretty quickly.

    Cheers,
    Josh
     
  3. Laumania

    Laumania

    Joined:
    Jun 27, 2012
    Posts:
    223
    Brilliant! Makes so much sense, didn't think about that! I'll give it a try :)
     
  4. Laumania

    Laumania

    Joined:
    Jun 27, 2012
    Posts:
    223
    Wanted to try it out now, but for some reason I can't see any CPU usage in the dashboard now. It's like it's not being updated at all. And it was like that before I changed any code, so seems to be an issue with the Multiplay/Game Hosting Portal?
     
  5. Laumania

    Laumania

    Joined:
    Jun 27, 2012
    Posts:
    223
    Ok CPU and Memory usage now working again on Multiplay dashboard and it WAS the targetFramerate that was the problem. Really for dedicated builds, Unity should default to 30 or 60 per default, instead of just letting it run wild.

    Anyway, thanks for the input fixed it - now it idles around 3-4% :)
    upload_2023-11-8_9-22-24.png
     
    Alexis_UGS likes this.