What is the server doing when idle? - high CPU usage

Discussion in 'Hosting Help' started by F1Fan07, Dec 17, 2012.

  1. Dave-NRT

    Dave-NRT Registered

    Joined:
    Jan 8, 2012
    Messages:
    364
    Likes Received:
    2
    Max:

    We have 3 VPS clients. We are using Server 2003 64 SP1 on each instance.

    I not sure 100% if the operating system has something to do with the issue or not.

    I would like to know if the servers showing consistent CPU while the dedicated is at sleep with no players, are using
    XP, Server 2000 or Win7 to host, and there might be some settings in use causing the above.

    Also if they are launching the servers using the GUI or from the dedicated inside the core.

    For the way we set up servers, we use the dedicated inside the core.

    I wonder what else might be in use using a home version OS?

    Just a thought.

    Other than slow load times on the dedicated this build, I have watched the CPU use between 60-80 while this happens, But like you drop back to 0-2 % after it is done loading.

    We set all the VPS's up with 2 megs of ram with the thinking that it will help with load time and other people entering the server.

    Any thoughts about the different Operating Systems to host?

    Dave
     
  2. Max Angelo

    Max Angelo Registered

    Joined:
    Oct 5, 2010
    Messages:
    4,958
    Likes Received:
    10
    Babs sent me a PM with some details and (disclaimer- i am not a programmer so i can only guess) sounds to me not a problem related to the OS. The PM is in italian, so i am going to make an extreme systesis: looks like sometime the dedicated process is doubled, one process with low CPU load and the other with pretty high CPU load.

    Can you guys confirm this behaviour?

    Also, if you all have more info to share, they might be helpful in order to track the problem.

    Now, lets pass Christmas and the day after, then i will post in the internal forum the issue, linking this thread too.
     
  3. Dave-NRT

    Dave-NRT Registered

    Joined:
    Jan 8, 2012
    Messages:
    364
    Likes Received:
    2
    Max:

    Will Do Sir... Hope the holidays treat you and your family well...I will do some testing like you said...and let all know.

    Cheers

    Dave
     
  4. Max Angelo

    Max Angelo Registered

    Joined:
    Oct 5, 2010
    Messages:
    4,958
    Likes Received:
    10
    You too. :)

    I appreciate your interest in rF2!
     
  5. Luc Devin

    Luc Devin Registered

    Joined:
    Jan 16, 2012
    Messages:
    1,133
    Likes Received:
    23
    Hi
    By running the server only dedicate this one takes a load on abnormal but a random time.
    Stopping the server dedicate, this one remains in the process while closing the window dedicate server.
     
  6. Luc Devin

    Luc Devin Registered

    Joined:
    Jan 16, 2012
    Messages:
    1,133
    Likes Received:
    23
    Hi

    You did what?
    The server is not overloaded by miracle.
    12 and not mounted overload.

    thx
     
  7. Spadge

    Spadge Registered

    Joined:
    Oct 4, 2010
    Messages:
    311
    Likes Received:
    7
    Mine is something like this: Windows XP pro, 1 core and 1.5g RAM in VMware.

    It doesn't overload, I haven't stress tested it but it seems to run fine with as many people as ever join. I think I had six people on Saturday night.

    I launch the game using the regular game launcher over VNC.
     
  8. ~IsR~Barabba

    ~IsR~Barabba Registered

    Joined:
    Oct 6, 2010
    Messages:
    1,160
    Likes Received:
    40
    Bat File

    I wanted to try to put the Bat file to see if it change something.
    I am using the program Batchrun.
    Except that when I start the server, it tells me that does not find the mod.
    What should I do to start the server with the program?

    Thx for Help Babs
     
  9. Spadge

    Spadge Registered

    Joined:
    Oct 4, 2010
    Messages:
    311
    Likes Received:
    7
    They can if you put quotes around them.

    start /min "rFactor2 Dedicated.exe" +procmask=1 <-- should work.
     
  10. ~IsR~Barabba

    ~IsR~Barabba Registered

    Joined:
    Oct 6, 2010
    Messages:
    1,160
    Likes Received:
    40
    [​IMG]
    this be my problem,I think it's all right perhaps we need to add something in the properties of the icon of the server.
    Help lol

    Babs:D
    Uploaded with ImageShack.us
     
  11. Radar

    Radar Registered

    Joined:
    Oct 20, 2010
    Messages:
    687
    Likes Received:
    60
    Has this been solved (ISI) for the next build. ?? I too have noticed this, and only last night did I notice it..

    Aftersome time, the CPU% goes right up after 0 players are in the server. Yes mulitple servers (my case 2) on the one machine..
     
  12. Max Angelo

    Max Angelo Registered

    Joined:
    Oct 5, 2010
    Messages:
    4,958
    Likes Received:
    10
    Try the workaround to disable the http server in the multiplayer.ini.

    HTTP Server Enabled="0" // Whether the dedicated server starts a HTTP server

    is the line to edit.

    Feedback, if the workaround works, is appreciated. :)
     
  13. Radar

    Radar Registered

    Joined:
    Oct 20, 2010
    Messages:
    687
    Likes Received:
    60
    I ran the servers again last night and watched closely.. I can say this... The CPU doesn't change immediately, but it didn't change when only 1 or 2 drivers join the server.. Looked at it this morning and still the CPU is low.. To me it would seem like, that if it has a load (a number of drivers) then it bumps up and stays up..

    Will try tonight your suggested fix Max.. Thanks for that.. Will advise in a day or two..
     
  14. Radar

    Radar Registered

    Joined:
    Oct 20, 2010
    Messages:
    687
    Likes Received:
    60
    Well Max, I can report that this fixed the problem. I've monitored this over the last few days, the only time it goes up (CPU usage) is when the next track loads on either of the dedicated servers running on the one machine..

    Hopefully this can be fixed in one of the updates soon..
     
  15. Max Angelo

    Max Angelo Registered

    Joined:
    Oct 5, 2010
    Messages:
    4,958
    Likes Received:
    10
    Thank you for the feedback. :)
     
  16. Diablo

    Diablo Registered

    Joined:
    Jan 20, 2013
    Messages:
    404
    Likes Received:
    0
    First of all, to be frank, do away with Batchrun. If it is supposed to make things easy, it fails miserably at that. I know my way around batch scripting quite well, and even I had problems figuring out the quirks, when I tried to reproduce your screenshot. I won´t even begin to name them all. You are better off without it. Sorry, I just can´t stand such things, claiming to have reinvented the wheel, but in the end they just painted it green or something.

    There are two quite simple alternatives:

    1. Create a Windows shortcut, with its working directory set to rFactor2´s root, not "Core", the one above that, or add +path=.. at the end of the command line. In my opinion setting the working dir is the cleaner way.

    2. Just create a simple batch file (.bat file extension is important), it´s not that hard, really. It is only two lines of simple text, you can even get that down to one, but at the cost of readability, i.e.:

    Code:
    cd /d "D:\Program Files (x86)\rFactor2"
    "Core\rFactor2 Dedicated.exe" +procmask=1
    Don´t put spaces between '+', 'procmask', '=' and '1', it is one string without spaces! That would not have worked with Batchrun either, judging from your screenshot; spaces are reserved as parameter delimiters. See how you do need to know certain things about Windows and batch scripting to make use of Batchrun, which is why it is no good for anything really useful, it even complicates things.


    That out of the way, hello Forum! This is my first post, and I hope to be in here more often. I purchased my license for rFactor2 a while back already but haven´t come around to really test it until recently. I am the admin of a small simracing community and tried to get rFactor2 running on our remote Linux root server (bare metal, not a virtual server) with the help of wine, just to find out, that it does not work, yet that is hopefully.
    BTW: ISI, please give us a native linux version of the Dedicated Server! Pretty Please!
    Anyway, so I went and installed Windows 7 Home Premium inside a virtual machine using kvm-qemu. I also noticed quite some CPU load with an idle "rFactor2 Dedicated.exe". I did not think much about it at the time, until I found this thread, and I checked again on the PC, I am sitting at right now. The load is so low, that Task Manager reports 0%. Whereas on the remote virtual machine, wich I connect to via VNC, shows about 20% +/-5. Now the systems are a bit different, but not that much. My PC has a Phenom II X4 with four cores running at up to 3.4 GHz, the remote machine has an Athlon II X4 with 2.3 GHz.
    Seeing as many who reported this happening are running some kind of virtual machine, I think it might have to do something with that. I will try and think about it some more, but just wanted to throw this into the room for others to maybe a look as well.

    But there is one thing I have just found out, which is strange:
    You do not need to actually start the dedicated server, just launch it from the rFactor2 Launcher or whatever means you fancy, doesn´t matter in my case. Don´t do anything, just leave the window that pops up open. Then check Task Manager and I am sure you will see this happening:
    View attachment 5798

    I also had a go with Process Monitor to get a closer look. I don´t know exactly what this is supposed to tell me, but virtually all those precious CPU cycles seem to be wasted on kernel time or, more precisely, context switching, see this excerpt of a profiling trace:

    Code:
    "14:34:07,9399770","rFactor2 Dedicated.exe","Process Profiling","","SUCCESS","User Time: 0.7644049 seconds, Kernel Time: 159.8542247 seconds, Private Bytes: 8.585.216, Working Set: 13.729.792"
    "14:34:07,9400394","rFactor2 Dedicated.exe","Thread Profiling","Thread 2300","SUCCESS","User Time: 0.0000000, Kernel Time: 0.0000000, Context Switches: 4"
    "14:34:07,9401161","rFactor2 Dedicated.exe","Thread Profiling","Thread 684","SUCCESS","User Time: 0.0000000, Kernel Time: 0.2184014, Context Switches: 408"
    
    "14:34:08,9636709","rFactor2 Dedicated.exe","Process Profiling","","SUCCESS","User Time: 0.7644049 seconds, Kernel Time: 159.9790255 seconds, Private Bytes: 8.585.216, Working Set: 13.729.792"
    "14:34:08,9637405","rFactor2 Dedicated.exe","Thread Profiling","Thread 684","SUCCESS","User Time: 0.0000000, Kernel Time: 0.1248008, Context Switches: 410"
    "14:34:08,9658847","rFactor2 Dedicated.exe","Thread Profiling","Thread 2300","SUCCESS","User Time: 0.0000000, Kernel Time: 0.0000000, Context Switches: 1"
    
    "14:34:09,9907467","rFactor2 Dedicated.exe","Process Profiling","","SUCCESS","User Time: 0.7644049 seconds, Kernel Time: 160.1818268 seconds, Private Bytes: 8.585.216, Working Set: 13.729.792"
    "14:34:09,9908377","rFactor2 Dedicated.exe","Thread Profiling","Thread 684","SUCCESS","User Time: 0.0000000, Kernel Time: 0.2028013, Context Switches: 438"
    "14:34:09,9930437","rFactor2 Dedicated.exe","Thread Profiling","Thread 2300","SUCCESS","User Time: 0.0000000, Kernel Time: 0.0000000, Context Switches: 1"
    
    "14:34:10,9968471","rFactor2 Dedicated.exe","Process Profiling","","SUCCESS","User Time: 0.7644049 seconds, Kernel Time: 160.3690280 seconds, Private Bytes: 8.585.216, Working Set: 13.729.792"
    "14:34:10,9969236","rFactor2 Dedicated.exe","Thread Profiling","Thread 684","SUCCESS","User Time: 0.0000000, Kernel Time: 0.1872012, Context Switches: 418"
    "14:34:10,9990809","rFactor2 Dedicated.exe","Thread Profiling","Thread 2300","SUCCESS","User Time: 0.0000000, Kernel Time: 0.0000000, Context Switches: 1"
    This is a CSV format file, so ',' is the column seperater, if you want make it look prettier, import it into a spreadsheet program. The emtpy lines are not actually in the original log, but were added for better readability.

    What you see is a log of 4 consecutive logging intervals (1s real time), in the left most column there is the time of day, 3 lines make up a data set. The first of those is for "Process Profiling", where you can see the "User Time" and the "Kernel Time", which the process has spent running since its birth. This first line is followed by two for "Thread profiling", one for each thread. The thing about the times in thread profiling, they show the amount of time spent, only during that last period (one second real time). Plus, these lines show context switches, which I think is the cause of the problem here, but I might be wrong, since that is a bit over my head, to be honest.
    But what you can see quite easily there is, that all, really all, of the process time is actual Kernel time, once it is setup and running. "User Time: 0.7644049" is the amount of time spent for initializing the process. And 0.2s Kernel time in 1s real time is my 20% CPU load. Now from my understanding user time, is what we really want here, but since the initial window is just sitting there, doing nothing, zero user time is to be expected. Whereas Kernel time is, when the process yields to the kernel, voluntarily or not, and the system is doing something on its behalf. So in my thinking, that should by no means be necessary with an idle window sitting around. Maybe the process should just go to sleep or something. Hmm, thinking again about it, maybe that´s what happens here, the process going to sleep, which I believe is a context switch, which in turn cost kernel time, but somehow gets woken up 400 times a second. And context switches are kernel time, but I have no clue about how much a context switch actually costs.

    Well, for the moment I will leave it at that, because my head started spinning half an hour ago, and I think I smell smoke. ;)
    I will think some more about it nonetheless. I just wanted to sahre this, so maybe someone with more knowledge might make sense of it.

    Kind regards

    P.S.: I also tried running with +ui=none and +ui=console, makes no difference.
     
  17. Diablo

    Diablo Registered

    Joined:
    Jan 20, 2013
    Messages:
    404
    Likes Received:
    0
    Oh, I forgot to write this in my earlier post. This workaround does not work for me. But maybe we see different problems with similar symptoms.
     
    Last edited by a moderator: Jan 23, 2013

Share This Page