The International Simutrans Forum

 

Author Topic: Simutrans-Experimental - Pak128.Britain-Ex 0.8.4 server perfomance  (Read 5112 times)

0 Members and 1 Guest are viewing this topic.

Offline wlindley us

  • Devotee
  • *
  • Posts: 979
    • Hacking for fun and profit since 1977
  • Languages: EN, DE
Playing with my 2.8 GHz Pentium D on a 1.5Mbps DSL line or my dad's 2.8 GHz Pentium D on a 7 Mbps cable connection, the game takes five to ten minutes to respond to simple commands.  I can't understand why commands cannot be carried out in milliseconds instead of minutes, regardless of synch issues.  This has gotten pretty well unplayable, it has taken me all week to start four canal boats without being interrupted by "Saving game... loading game..."
« Last Edit: December 14, 2012, 01:04:27 AM by prissi »

Offline ӔO

  • Devotees (Inactive)
  • *
  • Posts: 2345
  • Hopefully helpful
  • Languages: en, jp
I think the command is carried out, but because the client runs behind the server, to the client it appears to take a few seconds to minutes.


Maybe the server should slow down the game speed when slower computers are connected?

Offline TurfIt

  • Dev Team, Coder/patcher
  • Devotee
  • *
  • Posts: 1327
The command *is* being carried out in milliseconds - on the Server. When you do something on your client, it sends a request to the server. The server then issues the actual command to all clients telling them to execute the command at game time T=1234. For clients that are maintaining pace with the server, there's minimal lag (communication delay + some margin). On your client, the game time is laging behind, hence several real-time minutes pass before you reach game time 1234 and you finally see the result.

A Pentium D 2.8 is far too slow to run this savegame (about half the required speed). About 1200 is needed on this list: http://www.cpubenchmark.net/singleThread.html  (Bare minimum based on me seeing ~55% usage on one core of a 3.8GHz Ivy I7)

Offline asaphxiix

  • *
  • Posts: 723
I have a score of 1067 there, and I can run the game mostly ok on 50% CPU (100% of core), with all processes closed, including windows explorer. Every hour or two it goes lagged and I need to rejoin.

I'm considering today buying a new board, CPU and memoire.
Was thinking of the i5 3570K there, seems like best value for a single thread at least. Do you think a standard 1777mhz RAM will do? I understand memory bandwidth is also important.

Also what would you say is a good combination between single core performance and overall performance, in regards to choosing a CPU?

Offline ӔO

  • Devotees (Inactive)
  • *
  • Posts: 2345
  • Hopefully helpful
  • Languages: en, jp
i5-3570k can do both, actually.
Turbo mode gives it quite an impressive overhead in single threaded applications.

I am using it and it works just fine.

For memory, DDR3-1600Mhz is plenty.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9583
  • Languages: De,EN,JP
Simutrans experimental should rather be optimized, as I really wonder what is the hog. I highly suspect the acceleration code.

However the game could be run with 15 fps (which is the default setting I use for standard network games). This take a lot of load from the clients compared with 25 fps, since acceleration and moving has to be done each frame. (This can be only changed on the server, best with -fps 15 switch on command line.)

Unlike counter strike 15 fps will not result in very different movement as vehicles in simutrans anyway have to move two pixels when driving on a straight way.

Offline wlindley us

  • Devotee
  • *
  • Posts: 979
    • Hacking for fun and profit since 1977
  • Languages: EN, DE
15fps should be plenty.  ...If a dual-core processor each capable of over 5.6 billion instructions per second can't keep up, there's something seriously wrong somewhere.

Offline TurfIt

  • Dev Team, Coder/patcher
  • Devotee
  • *
  • Posts: 1327
Was thinking of the i5 3570K there, seems like best value for a single thread at least. Do you think a standard 1777mhz RAM will do? I understand memory bandwidth is also important.
Also what would you say is a good combination between single core performance and overall performance, in regards to choosing a CPU?
3570 would be good. It's with AMDs current offerings that are lacking in single threaded performance, Intel is fine there.
Simutrans likes memory bandwidth far more than typical programs/games. Most online CPU reviews show very little gain when using faster memory. However for Simutrans, with the current online experimental game, and my default ram setting @2400, I see ~45% 1 core usage. Dropping ram to 1600 results in ~55% usage. Quite significant...


Simutrans experimental should rather be optimized, as I really wonder what is the hog. I highly suspect the acceleration code.
1.8M passengers to route, 12500+ convois with many solid streams of boats with their expensive pathfinding. I'm sure game of this magnitude would be loading Simutrans standard down a fair bit too.


However the game could be run with 15 fps (which is the default setting I use for standard network games). This take a lot of load from the clients compared with 25 fps, since acceleration and moving has to be done each frame. (This can be only changed on the server, best with -fps 15 switch on command line.)

Unlike counter strike 15 fps will not result in very different movement as vehicles in simutrans anyway have to move two pixels when driving on a straight way.
It's already running @13-15fps! I presume the server CPU is overloaded too given the variance.
Low FPS in simutrans really shows up in the UI. Dragging windows around at 15fps vs 30 is quite choppy.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9583
  • Languages: De,EN,JP
In a server game, the fps is fixed. If the server is overloaded, then clients would immediately run ahead and wupps desync. The server does not adjust the fps, it says to the clients at which fps to run. At least this I read from the code.

The ship patchfinding occurs only when a ship starts, and then indeed the game may freeze for a split second or so and then to try to catch up. The number of passengers should be less a concern in experimental, as those are using predefined routing tables (however their recalculation takes time).

However, the shear number on convois would put many computer to its limit. I rather wonder how the VPS handles this at all. They seem to have a clever scheduler at his provider. Or all other VPS on the same cores where put elsewhere ;)

Offline TurfIt

  • Dev Team, Coder/patcher
  • Devotee
  • *
  • Posts: 1327
I think we're hijacking this... perhaps a mod could split off the performance discussion.

The server sets a target FPS, doesn't mean it can actually achieve it. Clients do have a rudimentary adjustment mechanism:
Code: [Select]
sint64 const difftime = (sint64)next_step_time - dr_time() + ((sint64)nwcheck->server_sync_step - sync_steps - settings.get_server_frames_ahead() - umgebung_t::additional_client_frames_behind) * fix_ratio_frame_time;
but this doesn't account for variable network latency or differences in the two systems. i.e. 15FPS on server != 15FPS on client - might be 14.99 or 15.01 - different oscillators...
Also, at 15FPS, the NWC_CHECK packets aren't sent often enough by default IMHO. every 256 frames... hard for clients adjust with this low frequency input. I'd guess you want timing checks at least every 5 secs given the highly fluctuating CPU loading that Simutrans causes.


While the ship pathfinding is only when a ship starts, the sheer number of ships present has quite a few starts per second. For passenger numbers, given an equal number of passengers in transit, experimental has far more ware packets due to tracking the origin than standard. Definitely a performance drain that.


I don't think the VPS is handling it. Seems the server is hitting 100% CPU. At least my client keeps running ahead and getting choked back by the above difftime adjustment(could be network latency instead but I'm seeing a steady 101ms to the server). i.e. It doesn't look like the server is achieving its target FPS. And of course one is very susceptible to disconnects when running ahead - a single other client sending a command and you're done. Why it's vital a server never maxes out.


Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 18752
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Simutrans-Experimental - Pak128.Britain-Ex 0.8.4 server perfomance
« Reply #10 on: December 14, 2012, 01:52:08 AM »
Prissi, thank you for splitting this. Most helpful. For reference, my last reply on the other thread (here) dealt with some of these performance issues and replies to some of these points.

TurfIt - my FPS value on the server is set to 14. Ought I change the server_frames_between_checks value in simuconf.tab to a lower number as a result of this? As noted in the other thread, my server is reporting 40.9% CPU usage from the Simutrans-Experimental process. The output of ps uww -A shows that no other process is using any CPU power, even Apache.

Players are not reporting frequent desyncs, and I don't generally experience desyncs when I connect (except very occasionally). The issue that players are reporting is generally that they get a very high latency, probably due to the client running behind, rather than ahead of, the server.

Offline greenling

  • Lounger
  • *
  • Posts: 1728
  • Simutransarchology it my hobby!
  • Languages: DE,EN
Re: Simutrans-Experimental - Pak128.Britain-Ex 0.8.4 server perfomance
« Reply #11 on: December 14, 2012, 02:03:34 PM »
Jamespetts
Can a Server support a Game with 10 fps per seconds?

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4607
  • Languages: EN, DE, AT
Re: Simutrans-Experimental - Pak128.Britain-Ex 0.8.4 server perfomance
« Reply #12 on: December 14, 2012, 02:32:15 PM »
Ought I change the server_frames_between_checks value in simuconf.tab to a lower number as a result of this?
Yes, then the clients will receive more check-commands and then can adjust their timings better.  You could set it to 16 (instead of the default 256).

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 18752
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Simutrans-Experimental - Pak128.Britain-Ex 0.8.4 server perfomance
« Reply #13 on: December 16, 2012, 08:01:30 PM »
Dwachs - thank you very much for that. That is most helpful. I have modified the value in simuconf.tab, which should take effect the next time that I restart the server.

Greenling - yes, in theory, a server could be set to run at only 10fps.

Offline greenling

  • Lounger
  • *
  • Posts: 1728
  • Simutransarchology it my hobby!
  • Languages: DE,EN
Re: Simutrans-Experimental - Pak128.Britain-Ex 0.8.4 server perfomance
« Reply #14 on: December 16, 2012, 09:08:01 PM »
jamespetts
Can a Server support a Game with 10 fps per seconds?
I have that be ask because i notice that simutransgames with more than 20fps my cpu from laptop full use.

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 18752
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Simutrans-Experimental - Pak128.Britain-Ex 0.8.4 server perfomance
« Reply #15 on: December 16, 2012, 09:33:14 PM »
The current server is set to run with 14fps, so that should suffice for your laptop, hopefully.

Offline greenling

  • Lounger
  • *
  • Posts: 1728
  • Simutransarchology it my hobby!
  • Languages: DE,EN
Re: Simutrans-Experimental - Pak128.Britain-Ex 0.8.4 server perfomance
« Reply #16 on: December 16, 2012, 10:02:53 PM »
Jamespetts
I do that test next weekend and then can i view how my CPU in the laptop in the using it.
Next week have i from Monday until Wednesday not enough  freetime.

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 18752
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Simutrans-Experimental - Pak128.Britain-Ex 0.8.4 server perfomance
« Reply #17 on: December 27, 2012, 11:37:10 PM »
The switch from bzip2 to gzip for compression of saved games has made a big (positive) difference to the loading/saving time.