[Linux] Reducing loading time
rkfg
Russia Join Date: 2013-09-03 Member: 187744Members, Reinforced - Supporter, Reinforced - Silver, Reinforced - Gold, Reinforced - Diamond, Reinforced - Shadow
Just a hint from a fellow NS2 player which I tested myself. And it works, probably. Before, I was loading for about 1 min 20 seconds joining a server with mods. Now it's like 37 seconds. Quite the difference, huh? So, what's the magic behind it? It's btrfs filesystem. It's better optimized for big directories (i.e. those with many files, like thousands of them) and as such has less seek times. Even on SSDs where seek time is small but a directory is technically a file that contains a list of other files and directories. It should be read entirely to traverse the path further.
So, you can convert your drive to btrfs with btrfs-convert /dev/sda1 (for example) and if it somehow won't satisfy you, you can later do btrfs-convert -r /dev/sda1
Though you'll lose any changes you did after the conversion, i.e. it will be restored to the state you had right before conversion. Make backups first anyway and use UPS. Btrfs can probably be considered stable, it has lots of advanced features (compared to the traditional FS like ext4) and looks like it's much faster when you need to read many little files.
For this to work you should use btrfs on all drives that are involved in the game loading process. For example, if your home directory is on one drive (HDD) and Steam is on another one (SSD), it's better to create a new user on SSD so its home directory is also there. Even if you symlink or mount --bind "~/.config/Natural Selection 2" to SSD, it doesn't seem to help.
Of course, you may just cut a bit of your SSD for btrfs and put Steam+NS2+new user there. It can be done with any bootable system like SysRescueCD. Btrfs can't be used as a boot partition though so you have to use a separate ext2 partition for /boot. Most configurations already use such layout but just in case.
You can also resize btrfs partition without unmounting it and it's done immediately. So give it a try.
So, you can convert your drive to btrfs with btrfs-convert /dev/sda1 (for example) and if it somehow won't satisfy you, you can later do btrfs-convert -r /dev/sda1
Though you'll lose any changes you did after the conversion, i.e. it will be restored to the state you had right before conversion. Make backups first anyway and use UPS. Btrfs can probably be considered stable, it has lots of advanced features (compared to the traditional FS like ext4) and looks like it's much faster when you need to read many little files.
For this to work you should use btrfs on all drives that are involved in the game loading process. For example, if your home directory is on one drive (HDD) and Steam is on another one (SSD), it's better to create a new user on SSD so its home directory is also there. Even if you symlink or mount --bind "~/.config/Natural Selection 2" to SSD, it doesn't seem to help.
Of course, you may just cut a bit of your SSD for btrfs and put Steam+NS2+new user there. It can be done with any bootable system like SysRescueCD. Btrfs can't be used as a boot partition though so you have to use a separate ext2 partition for /boot. Most configurations already use such layout but just in case.
You can also resize btrfs partition without unmounting it and it's done immediately. So give it a try.
Comments
And btw, this isn't a bugfix, it's a workaround outside NS2. The real fix is probably coming in build 275 if they'll mark non-existing files in mods folders so there would be less filesystem scans. This would reduce loading times for Windows players as well.
Yes this would be a lovely improvement for windows players!
Regarding the topic, interesting find. The next build will actually contain a functionality that should slightly help with loadtimes on linux, probably related to what you observed.