SwapSet-v1.0_noarch....set your swappiness level wherever you want

Moderator: Forum moderators

Post Reply
User avatar
mikewalsh
Moderator
Posts: 6518
Joined: Tue Dec 03, 2019 1:40 pm
Location: King's Lynn, UK
Has thanked: 993 times
Been thanked: 2170 times

SwapSet-v1.0_noarch....set your swappiness level wherever you want

Post by mikewalsh »

Evening, kids.

I've had a wee .pet kicking around the kennels for a few years now. I can't remember who put it together now, except for the fact it was one of the old crew from the Murga forum.

It's a basic 'swappiness' .pet, putting the sysctl.conf file into /etc, and the run script into /root/Startup, and set to '10'. Most of you are probably aware that all Linux distros ship with this set at 60 by default, OOTB......which for most folks nowadays is way too high, especially as RAM amounts are steadily creeping ever upwards. The more RAM you have installed initially, the less you need to use swap. Simple, really.

There's also been quite a bit of discussion around the use of swap files recently (as opposed to swap partitions). Several weeks ago, I started writing some scripts'n'stuff for a GUI-based 'Swappiness' Control, but I've had rather a lot on my plate recently, so they've just been sitting there, half-finished. I had some spare time this evening, so I thought I'd get this thing thrown together at long last!

When launched, you get a wee YAD GUI, with a drop-down selector. This lets you set your "swappiness" level anywhere from 10 all the way up to 90 (if you're that mad!), in steps of 10. When OK'd, you then get a small gxmessage box appear to confirm what you've just selected.

Image

.....followed by:-

Image

It's nowt special, but I just wanted to make another of those necessary 'chores' a bit easier for everyone, especially our noobs. As it comes, it's set to the default, OOTB amount of 60. This will want setting considerably lower for those of us with 16GB of RAM or more.....usually, around 10 or 20 at most. Higher settings are kind of "de facto" for older, resource-challenged hardware, but the way this is put together, it's very quick & easy to experiment and find out what suits you.

I've attached the .pet to this post, for anyone who might wish to try it out.... You'll find it at Menu->System->'Swappiness' Control!

Hope it's useful for some of you.....

Mike. ;)

Attachments
SwapSet-1.0_noarch-portable.tar.xz
GUI solution for setting system "swappiness" levels...in 'portable' format
(24.46 KiB) Downloaded 10 times
SwapSet-1.0_noarch.pet
GUI solution for setting system "swappiness" levels...
(23.84 KiB) Downloaded 35 times
User avatar
mikewalsh
Moderator
Posts: 6518
Joined: Tue Dec 03, 2019 1:40 pm
Location: King's Lynn, UK
Has thanked: 993 times
Been thanked: 2170 times

Re: SwapSet-v1.0_noarch....set your swappiness level wherever you want

Post by mikewalsh »

I thought I'd already posted this, but obviously not! :roll:

Just to add that there's now a 'portable' build of SwapSet, available alongside the .pet in post #1 above. Merely another alternative way for using it...

As always:-

  • Download

  • Unzip

  • Put it anywhere you like

  • Click on it to launch (it's a ROX-app)

The usual MenuAdd and MenuRemove scripts let you add or remove a Menu entry, if so desired.....at Menu -> System -> SwapSet-Portable. Hope it's useful for some of you.

Mike. ;)

User avatar
Trapster
Posts: 228
Joined: Sat Aug 01, 2020 7:44 pm
Location: Texas
Has thanked: 2 times
Been thanked: 71 times

Re: SwapSet-v1.0_noarch....set your swappiness level wherever you want

Post by Trapster »

I am trying this in Vanilla Dpup 9.3.14

It fired up and I set it to 60 and it seems to work but......

When I check it, I get this:

Code: Select all

~#cat /etc/sysctl.conf
vm.swappiness = 60

and this:

Code: Select all

~$ cat /proc/sys/vm/swappiness
45

Do you know the difference and which one is actually working?

User avatar
mikewalsh
Moderator
Posts: 6518
Joined: Tue Dec 03, 2019 1:40 pm
Location: King's Lynn, UK
Has thanked: 993 times
Been thanked: 2170 times

Re: SwapSet-v1.0_noarch....set your swappiness level wherever you want

Post by mikewalsh »

@Trapster :-

Hm. That's strange.

I have mine set to 10 (no point having it higher with 32GB RAM!), and I'm getting:-

Code: Select all

root# cat /etc/sysctl.conf
vm.swappiness = 10

...and

Code: Select all

root# cat /proc/sys/vm/swappiness
10

Can't understand why yours are showing differently. Perhaps @dimkr would know better than I do; VanillaDPup is his "baby", after all.

Sorry, mate. That's stumped me, that has.

Mike. :o

User avatar
Trapster
Posts: 228
Joined: Sat Aug 01, 2020 7:44 pm
Location: Texas
Has thanked: 2 times
Been thanked: 71 times

Re: SwapSet-v1.0_noarch....set your swappiness level wherever you want

Post by Trapster »

After a reboot, both swappiness files read the same.

User avatar
mikewalsh
Moderator
Posts: 6518
Joined: Tue Dec 03, 2019 1:40 pm
Location: King's Lynn, UK
Has thanked: 993 times
Been thanked: 2170 times

Re: SwapSet-v1.0_noarch....set your swappiness level wherever you want

Post by mikewalsh »

Trapster wrote: Tue Feb 11, 2025 9:20 pm

After a reboot, both swappiness files read the same.

Ah. Of course..... I never thought to mention that, because it simply didn't occur to me (the more so if you're running a save-file which only writes at shutdown).

I run a save-folder, and it writes to it immediately. One advantage to having buckets of RAM..... :oops: :D

Mike. ;)

User avatar
AntonioPt
Posts: 306
Joined: Wed Aug 11, 2021 7:41 pm
Has thanked: 130 times
Been thanked: 55 times

Re: SwapSet-v1.0_noarch....set your swappiness level wherever you want

Post by AntonioPt »

i see there is a treat here gonna try to be updated

Why astronauts use Linux
Because you can't open windows in space

Post Reply

Return to “Utilities”