kev392
Crew Member
Posts: 356
Likes: 474
|
Post by kev392 on Aug 21, 2021 22:27:14 GMT
Has anyone experimented with their swappiness settings.
It's usually set at 60 in the /etc/sysctl.conf file at the bottom. It can be set anywhere from 0 to 100.
This control is used to define how aggressively the kernel will swap memory pages. Higher values will increase aggressiveness, lower values decrease the amount of swap. A value of 0 instructs the kernel not to initiate swap until absolutely necessary.
The more RAM a machine has, the lower swappiness should be set.
For a typical internet computer, if a person has 8 GB RAM, there will probably be no need for much swap. Setting the value to 0 or 10 would be perfectly fine. Doing video editing might require a higher number.
4 GB RAM, which I have, the number would be better between 30-50. I am currently set at 40, but there's no need for swap usually, unless I'm using 2 web browsers and viewing a video stream on YouTube. Performance starts to suffer if available RAM gets below 1.3 GB, and is really noticeable below 800 MB, so swap seems to avoid this.
I know this because a long time ago, even though I had a 4 GB swap partition, the swap was never activated for some reason. There were a few times when I had to reboot the machine because available RAM was getting too low and it was basically non-usable. I was checking htop and swap was never used. Once I figured out swap had to be turned on, and how to do this, I've never had RAM issues since.
|
|
|
Post by Hippytaff on Aug 21, 2021 23:03:31 GMT
That’s interesting kev. Thanks for that. Particularly relevant for me at the moment. I will soon have a really low powered netbook that I bought to put BL6 Legacy 32bit through its paces. It only has 1gb ram, so a pretty high swappiness will probably be required. I’ve never really bothered with adjusting swap values because I’ve never had to. So if it ain’t broke I ain’t gonna fix it, although I have broken my main machines over the years more times than I can remember, messing about with things I don’t yet understand and not reading about it first, before I finally embraced Virtualisation. Anyway. I digress.
Cheers, basically.
|
|
kev392
Crew Member
Posts: 356
Likes: 474
|
Post by kev392 on Aug 22, 2021 2:06:16 GMT
It can be a complicated subject. I have a few webpages that I keep saved, each with unique information.
1. You may not need to create swap partition, since Debian and Ubuntu currently offer a Swap File option.
2. For 1 GB RAM, it should be fine to set 1 GB, or 2 GB if hibernation is used.
3. You will need to check if the Swap is turned on once the system is running.
4. Swappiness, I would leave it at 60 and test. Usually a web browser will require the most RAM.
5. Then try 70 to see how that works, ect. Find the "sweet spot".
|
|
|
Post by Hippytaff on Aug 22, 2021 8:49:04 GMT
Excellent, I’ll have a play.
|
|
kiezel
Crew Member
Posts: 143
Likes: 220
|
Post by kiezel on Aug 22, 2021 8:54:55 GMT
|
|
kev392
Crew Member
Posts: 356
Likes: 474
|
Post by kev392 on Aug 23, 2021 0:45:56 GMT
Now it just got more complicated I'm doing fine with 2 core 1.8 GHz with 4 GB RAM, swappiness 40. I had it at 30 for Linux Mint. Each computer and each OS is different. I will definitely look at the zswap for an even older machine that has 1 GB RAM single core. It needs a new power supply. Might be awhile
|
|
kev392
Crew Member
Posts: 356
Likes: 474
|
Post by kev392 on Aug 26, 2021 2:32:35 GMT
Decided to keep lowering the swappiness. I think there was something like 450 megs swapped with it at 40.
Went from 40 to 35. Swap got reduced to under 50 megs. Then after a day lowered it to 30.
After a few hours there is only 28 megs used for swap. Maybe I should keep dipping down.
|
|
enigma9o7
Crew Member
Posts: 1,427
Likes: 1,336
|
Post by enigma9o7 on Aug 26, 2021 4:34:44 GMT
I've never changed from default, but I don't see much reason for OS to use any swap until I run out of conventional memory anyway. And in my experience swap usage stays at zero most of the time anyway, it only starts going up after many days of uptime when I do something like run multiple VMs at the same time or something, so I see no need to mess with defaults. If after a few weeks of uptime I notice a few MB of swap being used and it bothers me, I reboot, but I really don't think that matters at all. I guess I could change my swappiness to prevent that ever happening. But really this stuff is nonsense.
On my p4 (with 512 mb memory) if i open too many browser tabs it'll start to swap some of them out, which slows things down switching back, so I've learned just not to use multiple tabs unless absolutely necessary to avoid swapping at all. But still never messed with swappiness value.
I think better just learn to manage memory usage and not swap at all, than to mess with swappiness value. If you are constantly swapping, either learn to use less memory, or install more memory, so you don't have to swap so much.
|
|
|
Post by oblio on Aug 26, 2021 14:17:40 GMT
Fully admit, I have always kicked it to zero without issue. That said, I know that may not be possible for all systems and I believe it puts you at risk of a crash. Thankfully my old systems still exceed the minimum requirements for Bodhi with the exception of my 32bit machine; I do not run many tabs on browsers which likely helps a bit.
|
|
kev392
Crew Member
Posts: 356
Likes: 474
|
Post by kev392 on Aug 27, 2021 14:56:17 GMT
I've never changed from default, but I don't see much reason for OS to use any swap until I run out of conventional memory anyway. And in my experience swap usage stays at zero most of the time anyway, it only starts going up after many days of uptime when I do something like run multiple VMs at the same time or something, so I see no need to mess with defaults. If after a few weeks of uptime I notice a few MB of swap being used and it bothers me, I reboot, but I really don't think that matters at all. I guess I could change my swappiness to prevent that ever happening. But really this stuff is nonsense.
On my p4 (with 512 mb memory) if i open too many browser tabs it'll start to swap some of them out, which slows things down switching back, so I've learned just not to use multiple tabs unless absolutely necessary to avoid swapping at all. But still never messed with swappiness value.
I think better just learn to manage memory usage and not swap at all, than to mess with swappiness value. If you are constantly swapping, either learn to use less memory, or install more memory, so you don't have to swap so much.
The default setting is 60, which is rather high for me, causing unnecessary swap, since I have 4 GB. I am trying to set it as low as possible. I currently have it set to 20. I've been moving it down 5 per day and seeing how much it swaps. I did run into problems a few years ago when the swap partition was not active, so at some point swap does become needed. But I do agree, too much swap is not a good thing.
|
|
|
Post by zaivala23 on Aug 31, 2021 6:51:36 GMT
This setting is one I have adjusted before with various distros. I have no idea whether it actually does anything. But I hear you say that I need no swappiness on my Zia800 with 24 GB RAM, and likely not on my T540p or Kudu 3, which each have 16 GB RAM. Sorry, just bragging. Not everyone runs Bodhi from a lack of decent equipment.
|
|
wimc
Moderator
Posts: 478
Likes: 411
|
Post by wimc on Aug 31, 2021 10:34:35 GMT
... Not everyone runs Bodhi from a lack of decent equipment. I don't.
See signature link.
|
|
kev392
Crew Member
Posts: 356
Likes: 474
|
Post by kev392 on Sept 1, 2021 4:37:46 GMT
This setting is one I have adjusted before with various distros. I have no idea whether it actually does anything. But I hear you say that I need no swappiness on my Zia800 with 24 GB RAM, and likely not on my T540p or Kudu 3, which each have 16 GB RAM. Sorry, just bragging. Not everyone runs Bodhi from a lack of decent equipment. You might need swap if you're video editing, gaming or using AutoCAD. I've actually got my swap set to 0 for now. Since I have 4 GB RAM it only likes to swap if I'm running a 2nd web browser but not always. I have another machine with 12 GB RAM running Linux Mint and it never swaps.
|
|
kev392
Crew Member
Posts: 356
Likes: 474
|
Post by kev392 on Sept 1, 2021 4:51:00 GMT
... Not everyone runs Bodhi from a lack of decent equipment. I don't.
See signature link.
I'll get a rig like that when I hit the lottery
|
|
wimc
Moderator
Posts: 478
Likes: 411
|
Post by wimc on Sept 1, 2021 5:30:36 GMT
I'll get a rig like that when I hit the lottery Actually I make monthly payments on it. Since I am paying monthly, took advantage of it. As for lottery, yes, I would get 128GB or more ram.
To keep on topic, seen swap around, but never really paid much attention to it.
|
|