Score:0

Is there any way to use more of the swap file?

hm flag

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.

David avatar
cn flag
It may help to know the version of Ubuntu you are using.
user535733 avatar
cn flag
That "slow down" is usually *because* the system is using swap. RAM is much faster than swap.
Score:2
cn flag

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.

Score:0
in flag

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.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.