0

I have an old computer and it has 4GB of RAM and I want to test minecraft for research purposes and it freezes. I have a mod to speed up the game but i'm not sure if its using more ram or not, the game goes from smooth FPS to freezing the computer probably due to full ram. (I've tried to see the ram usage fill up but It never seems to happen when I'm looking.)

My idea is not to spend £100+ on more ram but to use the swap file more as a ram stick. Like data goes to the swap to stay there until used, then it gets brought to the ram to be processed. Instead of just going to ram and filling it up causing a slow down.

Thanks.

2
  • It may help to know the version of Ubuntu you are using.
    – David
    Oct 16, 2022 at 14:18
  • 2
    That "slow down" is usually because the system is using swap. RAM is much faster than swap.
    – user535733
    Oct 16, 2022 at 14:20

2 Answers 2

2

Increasing the swap space indeed will provide opportunity to the system to temporarily swap away working memory so it can be used by other processes. While it may prevent your old computer from totally locking up and crashing, swapping may render the processing unbearably slow, also to the extent that you will experience like freezing during several minutes, except then for the noise of the hard drive doing overwork.

While some tweaks like changing swappiness or using zswap may improve perceived performance on a slightly overcharged system, there is no true solution for heavy memory requirements than to actually invest in RAM.

0

To increase swap usage you might want to increase the 'swappiness' system parameter. To temporarily (until reboot) change swappiness, do sudo sysctl vm.swappiness=<whatever needed>. The swappiness could be any number between 100 and 0. After you've changed it, fire up a system monitor or htop and use the computer for some time. Try to perform tasks that take up a lot of ram that you might do in the future, and monitor the ram/swap usage closely. Tweak the swappiness as neccessary.

After you've achieved optimal performance, it's time to make the setting permanent:

sudo mkdir -p /etc/sysctl.d
sudo <your text editor of choice> /etc/sysctl.d/swappiness.conf

And just paste in vm.swappiness=<your optimal value>, without the sysctl bits. After that, the setting is going to be preserved between reboots.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .