Author Topic: When I enter a game room, Megaglest starts to lag  (Read 2031 times)

uncle

  • Guest
When I enter a game room, Megaglest starts to lag
« on: 2 February 2012, 18:01:36 »
It happens always. During the lag, a diode displaying the hard drive activity turns on and does not stop until the lag is gone and I am allowed to change anything on the screen.

This is what happens captured on a video:
https://www.youtube.com/watch?v=lJN_dX4LIBE

How to solve this problem?

My laptop specification:
OS: Ubuntu 11.04 64bit
CPU: Intel Pentium Dual-Core (2.26 GHz)
GPU: Intel GMA X4500M (384 MB memory)
MG version: 3.6.0.2
« Last Edit: 2 February 2012, 18:07:00 by uncle »

tomreyn

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 2,764
    • View Profile
    • MegaGlest - the free and open source cross platform 3D real-time strategy game
Re: When I enter a game room, Megaglest starts to lag
« Reply #1 on: 2 February 2012, 19:50:12 »
This is probably triggered by the game data synchronization between client and server. Both ends generate checksums on data files (which means all important data files need to be read which can keep the storage media somewhat busy and checksums need to be calculated and written to disk which can keep the CPU somewhat busy), then exchange those to ensure they have the same files. This prevents out of synch situations due to different sets of files (and mod versions, and purposefully modified game data, i.e. cheating).

The reason why this is a problem for you seems to be that your disk I/O is slow (slow controller bandwidth, slow disk platter rotation speed, limited HDD bandwidth), or your file system is slow (this usually happens when you have a lot of have disk fragmentation on Windows NTFS or FAT32 or the file system capacity is at least 90% used on any platform) or that you use external storage over a slow link (such as USB 1.*). Another possible reason is a lower disk layer which slows things down, e.g. (especially) software based disk encryption such as Bitlocker, Truecrypt, dm-crypt/LUKS, ecryptfs, Filevault etc. Yet another possible reason is that your storage media is partially broken, repeated attempts to access broken sectors are made and error correction is slowing things down further.

Recommended actions:
  • check file system usage
  • check file system fragementation and defragment if needed
  • Do a disk I/O bandwidth check (there are free tools out there for this purpose)
  • have a look at the drives' S.M.A.R.T. state, run short S.M.A.R.T. self-test
Possible actions:
  • run long S.M.A.R.T. self-test
  • setup a RAM drive, write a script to copy game data to it upon start of MegaGlest, and make MegaGlest read the data from there
  • if MegaGlest is on a storage which is on top of a disk encryption layer: move MegaGlest to a separate storage media which is not on top of a disk encryption layer
  • replace HDDs by new ones, HDDs with higher rotational speed or SSD
  • replace HDD controller (probably not an option on a  laptop)
  • replace motherboard, CPU and memory to achieve faster bus speeds (probably not an option on a  laptop)
« Last Edit: 2 February 2012, 20:10:11 by tomreyn »
atibox: Ryzen 1800X (8 cores @3.6GHz), 32 GB RAM, MSI Radeon RX 580 Gaming X 8G, PCI subsystem ID [1462:3417], (Radeon RX 580 chipset, POLARIS10) @3440x1440; latest stable Ubuntu release, (open source) radeon (amdgpu) / mesa video driver
atibox (old): Core2Quad Q9400 (4 cores @2.66GHz), 8 GB RAM, XFX HD-467X-DDF2, PCI subsystem ID [1682:2931], (Radeon HD 4670, RV730 XT) @1680x1050; latest stable Ubuntu release, (open source) radeon / mesa video driver
notebook: HP envy13d020ng
internet access: VDSL2+

· · · How YOU can contribute to MG · Latest development snapshot · How to build yourself · Megapack techtree · Currently hosted MG games · · ·

uncle

  • Guest
Re: When I enter a game room, Megaglest starts to lag
« Reply #2 on: 2 February 2012, 21:12:38 »
Well, my file system is ext4 (I think that it is pretty quick) and my /home partition has 7 GB free space (the whole partition has 50 GB).

But my whole /home folder is encrypted (I choosed this option when I was installing the OS), so this may cause the problem.
It also seems that the disk has about 65k corrupted sectors (Is there anything I can do about that?).
How can I move MG to a non encrypted partition? Just by moving it's files? What about the .megaglest folder in my /home directory?

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
Re: When I enter a game room, Megaglest starts to lag
« Reply #3 on: 2 February 2012, 21:27:05 »
I have this lag too, but not so long , maybe 5 seconds.
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

tomreyn

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 2,764
    • View Profile
    • MegaGlest - the free and open source cross platform 3D real-time strategy game
Re: When I enter a game room, Megaglest starts to lag
« Reply #4 on: 2 February 2012, 21:50:03 »
Well, my file system is ext4 (I think that it is pretty quick) and my /home partition has 7 GB free space (the whole partition has 50 GB).

This should be fine but performance may degrade rapidly when you have <= 5 GB free space there.

But my whole /home folder is encrypted (I choosed this option when I was installing the OS), so this may cause the problem.

Yes, it may. I have been using MG  on a (more modern) Desktop computer with ext4 on top of a full disk encryption (dm-crypt + LUKS + AES-CBC-ESSIV) and some other layers and it's been fast enough for me (no I/O bottleneck), so I assume you're either using a very different software encryption mechanism and/or there is another issue on your end.

It also seems that the disk has about 65k corrupted sectors (Is there anything I can do about that?).

If this is due to the disk platters loosing cohesion (and it usually is - check the S.M.A.R.T. data to get a better idea) then you should replace the disk drive. As an added bonus this may allow you to get a faster drive.

This would provide a good explanation for the lag/freeze you're reporting.

How can I move MG to a non encrypted partition? Just by moving it's files? What about the .megaglest folder in my /home directory?

You may change the UserData_Root option in glest.ini to move the contents (such as downloaded game mods, but also glestuser.ini) of ~/.megaglest elsewhere. You may use the glestuser.ini option  DataPath to change the location of MegaPack. Alternatively you may use the --data-path command line argument to specify this location. Another option would be to recompile and to specify these locations as build options.

Yet another option, provided by your operating and file system, is to use mount binding. E.g. use mount --bind /mnt/megaglest-conf ~/.megaglest to make the contents of /mnt/megaglest-conf appear at ~/.megaglest.

Summing up, based on the preliminary information you provided, your HDD may be toast. If this assumption can be confirmed by further examination (S.M.A.R.T. self-test, data R/W tests - use testdisk, hdparm + dd) then replacing your HDD now is prudent and unavoidable in the mid term (ideally do it before you experience data loss or, worse, undetected corruption).
atibox: Ryzen 1800X (8 cores @3.6GHz), 32 GB RAM, MSI Radeon RX 580 Gaming X 8G, PCI subsystem ID [1462:3417], (Radeon RX 580 chipset, POLARIS10) @3440x1440; latest stable Ubuntu release, (open source) radeon (amdgpu) / mesa video driver
atibox (old): Core2Quad Q9400 (4 cores @2.66GHz), 8 GB RAM, XFX HD-467X-DDF2, PCI subsystem ID [1682:2931], (Radeon HD 4670, RV730 XT) @1680x1050; latest stable Ubuntu release, (open source) radeon / mesa video driver
notebook: HP envy13d020ng
internet access: VDSL2+

· · · How YOU can contribute to MG · Latest development snapshot · How to build yourself · Megapack techtree · Currently hosted MG games · · ·

uncle

  • Guest
Re: When I enter a game room, Megaglest starts to lag
« Reply #5 on: 2 February 2012, 22:18:06 »
Thank your for the instructions.

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,239
    • View Profile
Re: When I enter a game room, Megaglest starts to lag
« Reply #6 on: 3 February 2012, 07:34:29 »
One thing to try is enable debugging then send the logfile for us to examine to find out exactly what is taking so long.

Edit ~/.megaglest/glestuser.ini

Code: [Select]
DebugMode=true
DebugNetwork=true
Then run the same steps, and afterwards pastebin the context of ~/.megalgest/debug.log

Make sure to set the debug values to false when done.

uncle

  • Guest
Re: When I enter a game room, Megaglest starts to lag
« Reply #7 on: 3 February 2012, 12:27:27 »
OK, here is the file: http://me.hu.cz/files/debug.log.zip

I started MG and joined to an empty headless server, waited until the lag is gone and then I quit the game via its interface,

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,239
    • View Profile
Re: When I enter a game room, Megaglest starts to lag
« Reply #8 on: 3 February 2012, 15:58:59 »
The logfile shows some kind of problem calculating the CRC values for data files, its not caching them and always recalculating:

Code: [Select]
[2012-02-03 13:22:34] In [/home/softcoder/Code/megaglest/trunk/source/shared_lib/sources/platform/common/platform_common.cpp::getFolderTreeContentsCheckSumRecursively] scanning folders DID NOT FIND CACHED FILE checksum for cacheKey [/home/uncle/software/mg3.6.0.2//tilesets/winter_forest/*_.xml] forceNoCache = 1
I'll need to look more closely at the code to see how this is possible.

*UPDATE:

Please paste a listing of all filenames in /home/uncle/.megaglest/cache/

Thanks
« Last Edit: 3 February 2012, 16:18:33 by softcoder »

 

anything