LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   newbie to swapiness (https://www.linuxquestions.org/questions/linux-newbie-8/newbie-to-swapiness-4175671044/)

Basslord1124 03-09-2020 02:13 PM

newbie to swapiness
 
So on my Samsung NP305V5A laptop running Linux Mint 19.3 Cinnamon I had some sort freak issue where my system grinded to a halt. I had Openshot video editor up and then had to hop on Firefox for a moment to grab a quick download for my video. I had probably 4 tabs open on Firefox. That combination there froze up my laptop good. I'm actually thinking it was more of the GUI b/c I could slowly navigate through terminal OK. Me hopping on Firefox with my video editor open is something that would happen rarely anyways. Generally I stay off the net while editing my videos. What I observed is while doing this, my system used up about 1.5GB of swap (I have an 8GB swap partition that was created by the installer).

It was after this,I discovered the swapiness setting and have been playing with it here and there just to see how performance is. Here are my system specs:

CPU: AMD A6 3410MX APU at 1.6Ghz(quad core)
RAM: 4GB
HD: 500GB

I know swapiness is not one size fits all and the default setting is 60. Currently I am on 35. Using 1.82GB RAM, 10MB Swap, and the only big thing is Firefox with 6 tabs open and it seems to be running pretty good. I was thinking of having it use most of the RAM vs HD to help save on battery life. I did take the swapiness down to 10 and tried it like that for a little while. Not sure if I will keep it like that or not.

I was just curious what others would recommend with 4GB of RAM and by all means I'll keep experimenting with it too. :)

jefro 03-09-2020 03:53 PM

Not sure anyone can say what is right.

At one time swap was absolutely needed for almost every linux install. 4 gig on modern distro is almost near minimum and as they say, there is no substitute to ram. One can't easily replicate ram in swap by any setting or means. There may be an I/O issue on your system that may respond to swap on different drive.

You can keep playing with any setting on swap to include size and even removal (that may crash your system) but in the end with what you are running you should consider more ram.

teckk 03-09-2020 04:24 PM

Another option is
Code:

swapoff -a
Watch your system monitor, when you get close to all used, close something. Or clear RAM of not being used pages.

https://rudd-o.com/linux-and-free-so...ow-to-fix-that

Basslord1124 03-09-2020 09:23 PM

Thanks for the replies jefro and teckk and the link on swapiness and cache pressure (hadn't heard of that either). Just curious if others with similar specs had some recommended settings to try.

I'll be getting a newer laptop in the coming weeks/month anyways, so I probably won't spend a ton on this topic or even extra money on RAM. But I'll keep on experimenting with it.

Like I said, just a way to squeeze a little more performance out of this old thing which really it runs pretty good IMO.

DavidMcCann 03-10-2020 11:44 AM

The problem is Firefox, but you can tame it!
https://www.davidtan.org/tips-reduce...y-cache-usage/
I have swappiness set to 10.

Basslord1124 03-10-2020 01:52 PM

Update:

First, thanks for the link DavidMcCann...if there are ways to make Firefox run a little better to, I'm all for that as well. :)

What ended up happening is something I should've done a while back. Aside from the Samsung, I also have a Toshiba Satellite L75D laptop with almost identical specs and was my main laptop for quite some time. Then the Toshiba hard drive started getting sector issues and I had put it to the side. I then used the Samsung laptop more extensively.

So I dug out the Toshiba and started part swapping basically. I was able to get the Toshiba from 6GB RAM to 8GB RAM and then took the "still working" hard drive from the Samsung and put it in the Toshiba. I already knew that Linux Mint wouldn't have any issues with the Toshiba hardware from a previous attempt. So far things appear to be going fine. :)

I am typing on it as we speak. Oh, the Toshiba has a bigger screen too which is kinda nice. I am still planning on getting a more updated laptop, but this will definitely serve as a good backup one. Oddly enough the old Samsung drive that's in it now doesn't have quite the miles that the original Toshiba drive had, but still is up there a little bit.

With all this in mind, I am going to mark this thread as solved. Thanks again everyone!

rnturn 03-10-2020 03:47 PM

Quote:

Originally Posted by Basslord1124 (Post 6098855)
I was just curious what others would recommend with 4GB of RAM and by all means I'll keep experimenting with it too. :)

I ran OpenSUSE+KDE/Plasma with 4GB of RAM for a long time (before adding another 4GB). I gave the system plenty of swap---two 16GB swap partitions defined in the middle of two drives (to minimize and head seek time) and set to the same priority in /etc/fstab (to round-robin stripe across the two partitions. I typically have a slew of terminal windows open, an Emacs instance, Jack+Audacious running, and, normally, a half dozen Firefox windows running with an insane number of tabs open. With swappiness set to "50", memory utilization is at about 65% and swap at 7%. I find the browsers to be the biggest reason I wind up using swap (for some reason, a couple of web sites tend to start eating RAM if I don't shut them down overnight) though I have one Python3+psycopg2+PostgreSQL script that I've been working on that's guaranteed to make the memory subsystem thrash like crazy---if I turn my back on it, it's oodles of fun getting another terminal to respond so I can kill it. For everyday use, "50" has been working fine for me. Could it be better? Maybe but I don't think fiddling with it will fix that Python script's memory usage.

Some people claim you don't need swap but I used commercial UNIX boxes for a long time that, if you didn't have swap defined, would misbehave when someone tried to run a program when no memory was available. You could chalk up my preference to "old habits die hard" but I figure what's the harm in defining swap space in the age of terabyte hard drives?

GPGAgent 03-10-2020 05:54 PM

I've used the tips from here: https://easylinuxtipsproject.blogspot.com/p/1.html to tune my Linux Mint install.

Even if you're notusing Mint most of the tips are good for all distros, and there is good section on how to use an SSD with linux, and tips on tuning Firefox and Chrome.

Mike_Walsh 03-12-2020 09:38 AM

I, too, tend to run with around 10 in Puppy. This is the recommended setting for an HDD, though apparently lower still is often recommended for an SSD.....

One of our (murga-linux) Puppy Forum members put together a .pet package to take care of this years ago; it makes use of the info from the EasyLinuxTips project (which has been running for years & years).....it just takes care of all steps at one fell swoop, and installs in seconds.

I believe it's an acknowledged fact that the more RAM you have, the less that swap will be used (depending on what you have open at any given time, naturally). My old system, which has just died, had 3 GB of DDR1, and made frequent, though not heavy use of swap. My new system has 8 GB of DDR4 - still running the same Puppies - and uses swap hardly at all.

If I was mad enough to go with something like 32 GB of RAM - total, utter overkill for Puppies! - I would in all likelihood remove swap altogether, since I know for a fact it would never get used.....


Mike. :hattip:


All times are GMT -5. The time now is 08:39 PM.