Page 1 of 1

Swappiness

PostPosted: May 1st, '20, 04:45
by Zeeman
With which command line can I check the swappiness and how should I change the swappiness to 10?

Re: Swappiness

PostPosted: May 1st, '20, 11:02
by doktor5000
Do you want to change it permanently or only temporarily?
You can check the current setting as root with
Code: Select all
´┐╝sysctl vm.swappiness

and you can change it during runtime with
Code: Select all
sysctl -w vm.swappiness=10


If you want to change it permanently, you should put vm.swappiness=10 into a file below /etc/sysctl.d/ which is read during boot.

Although it would probably be a good idea if you add some context information on WHY you want to change it, also how much RAM and swap you currently have ?

Re: Swappiness

PostPosted: May 1st, '20, 18:24
by Zeeman
Hello doktor5000, thanks for the quick response. I have 4GB-RAM (3.9GB) and at the moment is the swappiness 60.
I want change the swappiness permanently but I'm a computer dummy so I don't understand what you mean with vm.swappiness=10 into a file below /etc/sysctl.d/ which is read during boot. I have used before a couple of years Linux mint and it looks a lot easy-er there. but I think it's only that I used it for a few years.

Re: Swappiness

PostPosted: May 1st, '20, 18:37
by doktor5000
OK, but WHY do you want to change swappiness in particular?

Re: Swappiness

PostPosted: May 1st, '20, 18:48
by Zeeman
on all debian and ubuntu they recommend it because linux is used a lot of swappiness.
Decrease the swappiness (important)
1.5. With normal computer use (when you don't have a server), you definitely want to decrease Mint's swappiness . That can make a huge difference to the speed of your system.

You will notice this especially with little RAM (2 GB or less). At 8 GB of RAM or more, you probably won't notice a difference when swapping down.
https://rudd-o.com/linux-and-free-softw ... o-fix-that
https://easylinuxtipsproject.blogspot.c ... iness.html

Re: Swappiness

PostPosted: Nov 16th, '20, 17:43
by laidlaws
I have just come across this thread. My computer is suddenly locking up for a few minutes at a time. I hafe 8 Gb RAMand 4 Gb swap. htop shows that only avout 700 MiB of ordinary RAMis in use, but over 3 Gib of swap. I read the same Ubuntu threads as the OP, but decided to check the Mageia forum first. I have no other reason to fiddle with the swappiness. Am I barking up the wrong tree completely?

Re: Swappiness

PostPosted: Nov 17th, '20, 02:57
by doktor5000
You should create a separate thread for that, and add some actual details like output of free -ltm and vmstat and htop or similar, along with some more context information and also some journalctl excerpts.

Re: Swappiness

PostPosted: Nov 17th, '20, 10:31
by laidlaws
Thanks, Doktor. I will do that when I have collected more info.

[SOLVED] Re: Swappiness

PostPosted: Nov 17th, '20, 11:38
by laidlaws
I just wiggled both my onboard RAM sticks, and everything seems back to normal. No swap is being used. Dust is a real problem here. Here's hoping.

Re: Swappiness

PostPosted: Nov 19th, '20, 06:24
by JoesCat
@Zeeman - if you do not have that much RAM, you may want to consider loading Mageia Classic install which uses 32bit code.
32bit code is a bit more compact than 64bit, therefore using less code for executable programs and more space for data. Many users won't see a difference or impact between 32bit or 64bit code, so this may be to your benefit.

@laidman, if you are wiggling the onboard RAM, you may as well remove them, and rub a pencil eraser across the contact fingers to clean-off grit, dirt, greases. Some people put their fingers on the contacts, which is bad in adding whatever is on your hands to the contacts (making them dirty or oxidized). Some people also have their towers sit on the floor, and it can be expected you have a load of dust inside the case (this happens in work environments, and homes too when people kick-up dirt from the floor and it gets sucked in through the vents.
If this is the case (dust, dirt), you can unplug the PC, open the case, grab the bare metal with one hand (to ground yourself from creating static), and with the other hand, run a vacuum around to suck-out, or blow-out dust and dirt inside the computer. When I say grab bare metal, I mean the same PC you are cleaning, so you are like a bird on a wire, at the same voltage potential as the PC itself - I've seen people grab other metal, and that is wrong - saying this one more time - make sure the PC is unplugged.
If it is an old PC, you may be dealing with "cold solder joints", this happens with hot/cold/hot/cold/hot/cold as you turn on and turn-off a PC over the years....it is metal fatigue due to expansion and contraction - you might have discovered a location when you wiggled the RAM....but then again, it could have been a dirty connection.
The what-ifs increase with time, and older equipment.