LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-09-2020, 02:13 PM   #1
Basslord1124
Member
 
Registered: Jun 2004
Location: KY
Distribution: Debian, Mint, Puppy
Posts: 507

Rep: Reputation: 51
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.
 
Old 03-09-2020, 03:53 PM   #2
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,996

Rep: Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628
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.
 
1 members found this post helpful.
Old 03-09-2020, 04:24 PM   #3
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,141
Blog Entries: 6

Rep: Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828
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
 
1 members found this post helpful.
Old 03-09-2020, 09:23 PM   #4
Basslord1124
Member
 
Registered: Jun 2004
Location: KY
Distribution: Debian, Mint, Puppy
Posts: 507

Original Poster
Rep: Reputation: 51
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.
 
Old 03-10-2020, 11:44 AM   #5
DavidMcCann
LQ Veteran
 
Registered: Jul 2006
Location: London
Distribution: PCLinuxOS, Debian
Posts: 6,142

Rep: Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314
The problem is Firefox, but you can tame it!
https://www.davidtan.org/tips-reduce...y-cache-usage/
I have swappiness set to 10.
 
Old 03-10-2020, 01:52 PM   #6
Basslord1124
Member
 
Registered: Jun 2004
Location: KY
Distribution: Debian, Mint, Puppy
Posts: 507

Original Poster
Rep: Reputation: 51
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!
 
Old 03-10-2020, 03:47 PM   #7
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,803

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
Quote:
Originally Posted by Basslord1124 View Post
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?
 
Old 03-10-2020, 05:54 PM   #8
GPGAgent
Senior Member
 
Registered: Oct 2018
Location: Surrey UK
Distribution: Mint 20 xfce 64bit
Posts: 1,026
Blog Entries: 3

Rep: Reputation: 133Reputation: 133
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.
 
Old 03-12-2020, 09:38 AM   #9
Mike_Walsh
Member
 
Registered: Jul 2017
Location: King's Lynn, UK
Distribution: Nowt but Puppies....
Posts: 660

Rep: Reputation: 362Reputation: 362Reputation: 362Reputation: 362
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.

Last edited by Mike_Walsh; 03-12-2020 at 09:49 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Controlling swapiness of virtual memory the_gripmaster Linux - General 2 05-18-2012 01:22 AM
[SOLVED] apache newbie/mrtg newbie (newbie to everything) new2nagios Linux - Software 3 12-14-2009 09:05 AM
A challenge for a newbie and not onle for a newbie neo77777 General 1 06-06-2002 05:52 AM
ipchains newbie. Kernel newbie skeletal29 Linux - Security 3 06-02-2002 03:30 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:33 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration