The International Simutrans Forum

 

Author Topic: Bridgewater-Brunel no. 1 - Great Britain sized map (no. 2)  (Read 85516 times)

0 Members and 1 Guest are viewing this topic.

Offline CK

  • *
  • Posts: 26
  • Languages: NL, EN, FR
Re: Bridgewater-Brunel no. 1 - Great Britain sized map (no. 2)
« Reply #490 on: January 09, 2020, 07:11:20 PM »
That is useful to know. May I ask what the performance is like once you do manage to login?
Sluggish, to summarise.

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 19078
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Bridgewater-Brunel no. 1 - Great Britain sized map (no. 2)
« Reply #491 on: January 09, 2020, 07:55:19 PM »
Sluggish, to summarise.

Thank you. Are you able to elaborate on this; is it unresponsive to commands; is the speed inconsistent; are there regular pauses? The particular type of sluggishness can help to narrow down how best to deal with a high load.

Offline CK

  • *
  • Posts: 26
  • Languages: NL, EN, FR
Re: Bridgewater-Brunel no. 1 - Great Britain sized map (no. 2)
« Reply #492 on: January 09, 2020, 08:28:32 PM »
Thank you. Are you able to elaborate on this; is it unresponsive to commands; is the speed inconsistent; are there regular pauses? The particular type of sluggishness can help to narrow down how best to deal with a high load.
The speed appears to be consistent, but the pauses are regular, and the game is occasionally unresponsive to commands.

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 19078
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Bridgewater-Brunel no. 1 - Great Britain sized map (no. 2)
« Reply #493 on: January 09, 2020, 09:10:43 PM »
The speed appears to be consistent, but the pauses are regular, and the game is occasionally unresponsive to commands.

Interesting - thank you for letting me know.

Offline freddyhayward au

  • *
  • Posts: 95
  • Languages: EN
Re: Bridgewater-Brunel no. 1 - Great Britain sized map (no. 2)
« Reply #494 on: January 14, 2020, 01:07:33 PM »
Is there anywhere I can view the autosave logic for this server?

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 19078
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Bridgewater-Brunel no. 1 - Great Britain sized map (no. 2)
« Reply #495 on: January 14, 2020, 02:39:26 PM »
The logic is here:

Code: [Select]
root@438242:~# cat rotate-backup.sh
# Rotation and backup script for the Simutrans-Experimental server
# Written by James E. Petts, December 2012
# Modified September 2018 to add thd date/time

# This script is designed to:
# (1) check whether the saved game has been modified in the last hour;
# (2) if it has not, run the force-sync command;
# (3) check again whether the saved game has been modified in the last hour
# (the force-sync command might or might not modify it depending on whether -
# (a) Simutrans-Experimental is running; and
# (b) there are any players connected); and
# (4) if it has, rotate the saved games using the rotate.sh script.

echo
echo "******"
echo
echo "Running the backup and rotation script..."
echo
echo "The current date and time is"
date
echo
SAVEGAME="/usr/share/games/simutrans-extended/server13353-network.sve"

# Check that the server saved game exists at all
if [ ! -e $SAVEGAME ]
then
echo "Error: saved game not found at $SAVEGAME"
echo
exit 1
fi

# Check the current time and the last modification time of the saved game file
# Use Unix time (seconds since 1 Jan. 1970)
NOWTIME=$(date +%s)
NOWTIME_FRIENDLY=date

SAVEMODTIME=$(stat -c %Y $SAVEGAME)
SAVEMODTIME_FRIENDLY="stat -c %y $SAVEGAME"

HOURAGO=$(expr $NOWTIME - 3600)
HALFHOURAGO=$(expr $NOWTIME - 1800)

echo "Current time:"
$NOWTIME_FRIENDLY
echo
echo "Game last saved:"
$SAVEMODTIME_FRIENDLY
echo

# Check whether the saved game was modified more than an hour ago
if [ $HALFHOURAGO -gt $SAVEMODTIME ]
then
echo "The game was last saved more than half an hour ago. Run a force sync."
echo
/root/force-sync.sh

# Check again whether the saved game was modified more than an hour ago.
# But first, wait two minutes, as it might take a while to execute the
# force-sync command.
sleep 120
else
echo "The game was last saved within half an hour - do not run a force sync."
echo
fi

NEWSAVEMODTIME=$(stat -c %Y $SAVEGAME)

if [ $HOURAGO -gt $NEWSAVEMODTIME ]
then
echo "The game was not updated with a force-sync. Either the server is not running, or no clients are connected."
echo
exit 2
else
echo "The saved game has been updated in the last hour. Rotate the backups."
echo
/root/rotate.sh
fi
sync

The above is a shell script set to run once every minute on the server.

Offline freddyhayward au

  • *
  • Posts: 95
  • Languages: EN
Re: Bridgewater-Brunel no. 1 - Great Britain sized map (no. 2)
« Reply #496 on: January 14, 2020, 03:02:03 PM »
Thanks, would you mind also sharing force-sync.sh?

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 19078
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Bridgewater-Brunel no. 1 - Great Britain sized map (no. 2)
« Reply #497 on: January 14, 2020, 03:05:43 PM »
Here it is:


Code: [Select]
# Shell script to run a force-sync on the running Simutrans-Experimental server
# Written by James E. Petts, December 2012
# Modified September 2018 to add the date/time for logging purposes

echo "Running a force-sync..."
date
echo

/usr/share/games/simutrans-extended/nettool -s bridgewater-brunel.me.uk -p [PASSWORD REDACTED] clients

echo

/usr/share/games/simutrans-extended/nettool -s bridgewater-brunel.me.uk -p [PASSWORD REDACTED] -q force-sync

sleep 3m
sync

Offline freddyhayward au

  • *
  • Posts: 95
  • Languages: EN
Re: Bridgewater-Brunel no. 1 - Great Britain sized map (no. 2)
« Reply #498 on: January 14, 2020, 03:21:47 PM »
Thanks. From what I can tell, this uses code from network_cmd_ingame.cc, which goes ahead with autosaves even when no clients are connected. Perhaps this is contributing to the server's connection difficulties?

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 19078
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Bridgewater-Brunel no. 1 - Great Britain sized map (no. 2)
« Reply #499 on: January 14, 2020, 03:28:56 PM »
The difficulty, I think, is that the time that it takes to save is equal to or greater than the designated interval between saves.  From what I can deduce from looking at memory allocation, most of the data are player routes.

I notice from the code that, although the comments refer to hourly saving, it was changed at some point to half-hourly saving. I can re-increase it to hourly saving and see whether that helps for the time being; but the ultimate issue is that the saved game is too demanding for the server.

Edit: I have now made this modification.

Offline DrSuperGood

  • Dev Team
  • Devotee
  • *
  • Posts: 2791
  • Languages: EN
Re: Bridgewater-Brunel no. 1 - Great Britain sized map (no. 2)
« Reply #500 on: January 14, 2020, 09:55:42 PM »
I think at this point people mostly want a new server game. I have not been able to play for over a month because every time I try to join it fails...

At times I want to join for 5-15 minutes and maintain my stuff or do part of a new route. But currently it is taking over 30 minutes to join which is counter productive to this play style. Instead of repeatedly trying to rejoin once it fails I rather let people who want to play for 2-3 hours play uninterrupted.