Page 1 of 1

memory usage

Posted: Fri Feb 07, 2020 7:21 pm
by retired
I've got a fresh up to date MX 19 install on my Thinkpad with 2 gb memory. Right now with just this window open in Firefox I'm using 41 % memory - Is this typical ? - reason I ask is with Facebook open I use over 90 % and occasionally freeze.

Re: memory usage

Posted: Fri Feb 07, 2020 7:42 pm
by bll
Open a terminal.
Type: top
Type a single > symbol (this will sort by %MEM).

The 'firefox-bin and 'Web Content' processes are all firefox.
You can see they use up quite a bit of memory (8.2% on my system with four tabs).
Within firefox, you can change your habits, close tabs a lot and re-open them when needed.

Take a look at what else has a high percentage in the %MEM column and see what
you can turn off or stop running.

Go to MX/Settings/Session and Startup/Application Autostart.
See what services and extra programs you can turn off.
(e.g. I never use the USB Unmounter, I'm turning it off).

Some processes like the MX Updater are really nice, but if you can get into the habit
of running your checks manually, memory can be saved that way.

Every little bit of memory saved helps.

With only 2GB of memory, you will want to set your system's vm.swappiness to 30 or 40.
( viewtopic.php?t=45005 )

Re: memory usage

Posted: Fri Feb 07, 2020 7:50 pm
by Stevo
MX 19 has swappiness set to 15% by default. A 32-bit version of MX should use about 20% less RAM than 64-bit, too.

Yes, especially with sites like Facebook that load who knows how much data-mining crap without you knowing, Firefox eats RAM.

Are you using a good ad blocker like Ublock Origin?

You may also want to switch to a browser like Pale Moon, which should be lighter on RAM.

There's also a program you can install from the repos called "earlyoom", which I ran across yesterday. It should kill the browser before your system slows to a near-crawl, but Firefox sets a session restore every 15 seconds unless you change that manually, so it won't hurt that much. (also recommended for many users). I haven't used it, so don't know yet if you need to configure it, or if it just works after installation.

Re: memory usage

Posted: Fri Feb 07, 2020 9:29 pm
by az2020
retired wrote: Fri Feb 07, 2020 7:21 pm I've got a fresh up to date MX 19 install on my Thinkpad with 2 gb memory. Right now with just this window open in Firefox I'm using 41 % memory - Is this typical ? - reason I ask is with Facebook open I use over 90 % and occasionally freeze.
Some of your 2gb is being used for dedicated graphics, right? You can open a terminal window and type "free." That will tell you how much memory is being used. Then you can start a browser, open a new tab etc., and see how the free memory changes.

I just did some distro "fast dating" (nstalled 20 distros, measured how much memory they use). MX 19 uses 410mb in a virtual box. On my actual hardware, it was 580mb (which will be different on different machines, due to different drivers. That's what it was on my Ryzen 3 3200u).

That right there would be 25% of 2gb. And then some of my memory is shared with the video, I believe. If I only had 2gb, I'd be closer to 30% used. Then the browser, and heavy sites like FB.

If you turn off MX's background image, that will save a little. I'm sure there's other things. I think I remember seeing some composter things somewhere (maybe MX Tweaks). Some distros have some window "animation" that can be turned off and use less resources.

If you really need small, AntiX is the smallest distro I measured (I didn't do Puppy. It's probably smaller.). Bodhi was the next one. Peppermint, then Linux Lite.

Re: memory usage

Posted: Fri Feb 07, 2020 11:24 pm
by az2020
az2020 wrote: Fri Feb 07, 2020 9:29 pm I just did some distro "fast dating" (nstalled 20 distros, measured how much memory they use). MX 19 uses 410mb in a virtual box. On my actual hardware, it was 580mb (which will be different on different machines, due to different drivers. That's what it was on my Ryzen 3 3200u).
...
If you really need small, AntiX is the smallest distro I measured (I didn't do Puppy. It's probably smaller.). Bodhi was the next one. Peppermint, then Linux Lite.
I just realized I might have sounded like I was saying MX is large. It's not, but if you have limited resources, there are smaller (and less polished) distros. It's a tradeoff that way.

So you can see for yourself, this is the data I collected:

Image
[Click for larger]

For more info, see the spreadsheet or PDF: https://jmp.sh/kNTBnT4

Between Antix/Bodhi & MX, there's not that much difference. But, if you have very low resources that could make a difference (just like Puppy could make a difference compared to Antix. I think Puppy is pretty "out there" for the extreme resource-limits. I didn't compare it.).

The "real hardware" numbers may not be representative of you computer. Mine probably uses much larger drivers than yours. It's probably better to compare the VirtualBox numbers. Installing on real hardware should be higher than that. But, probably not as high as mine (newer, more complicated features?).

Re: memory usage

Posted: Fri Feb 07, 2020 11:53 pm
by SwampRabbit
az2020 wrote: Fri Feb 07, 2020 11:24 pm So you can see for yourself, this is the data I collected
Thank you sharing that awesome spreadsheet!

Re: memory usage

Posted: Sun Feb 09, 2020 8:01 am
by retired
OK - I would like to up my swappiness to 35 - what command should I enter in a terminal - thanks.

Re: memory usage

Posted: Sun Feb 09, 2020 8:08 am
by junoluna
retired wrote: Sun Feb 09, 2020 8:01 am OK - I would like to up my swappiness to 35 - what command should I enter in a terminal - thanks.

Code: Select all

sudo sysctl vm.swappiness=35
......

if that is good for you, you will have to make it permanent

Re: memory usage

Posted: Sun Feb 09, 2020 8:32 am
by chrispop99
junoluna wrote: Sun Feb 09, 2020 8:08 am
retired wrote: Sun Feb 09, 2020 8:01 am OK - I would like to up my swappiness to 35 - what command should I enter in a terminal - thanks.

Code: Select all

sudo sysctl vm.swappiness=35
......

if that is good for you, you will have to make it permanent
To make it permanent, add the following to the bottom of the file /etc/sysctl.conf as root:

Code: Select all

vm.swappiness = 35
After rebooting, you can check you have done it properly by entering this in a terminal:

Code: Select all

cat /proc/sys/vm/swappiness
FWIW, changing swappiness has less effect than might be hoped.

Chris

Re: memory usage

Posted: Sun Feb 09, 2020 8:47 am
by m_frank
In MX-19, instead of modifying /etc/sysctl.conf, there is a "drop-in" in /etc/sysctl.d/:

Code: Select all

$ tree /etc/sysctl.d/
/etc/sysctl.d/
├── 99-mx_allow_non_root_dmesg.conf
├── 99-swappiness_mx.conf
├── 99-sysctl.conf -> ../sysctl.conf
├── 99-vm-dirtybytes_mx.conf
├── protect-links.conf
└── README.sysctl

Code: Select all

$ cat /etc/sysctl.d/99-swappiness_mx.conf
vm.swappiness = 15
So you need to edit /etc/sysctl.d/99-swappiness_mx.conf

For MX-18.X, you can create the /etc/sysctl.d/99-swappiness_mx.conf "drop-in", modeled on the MX-19 example.

Re: memory usage

Posted: Sun Feb 09, 2020 12:00 pm
by seaken64
Have you tried MX-Fluxbox? It is an desktop overlay in MX. You still have your MX but the memory footprint is a lot lower. This is different than booting to antiX (which is another viable option for lower ram use).

There is a Sub-Forum on MX-Fluxbox in the forum directory. Check it out.

I have initial memory under 100MB on a MX-18 install. It is more on some of my MX-19 systems but still half of what is reported in XFCE.

Seaken64

Re: memory usage

Posted: Sun Feb 09, 2020 4:12 pm
by retired
OK - so I didn't have a swap partition so I reinstalled and created a 2 gb swap - hope that resolves the issue - thanks for the support - regards to all

Re: memory usage

Posted: Sun Feb 09, 2020 7:50 pm
by Stevo
Swap just keeps your system from freezing totally when it runs out of RAM. Having it slow down to a crawl as it uses swap is not much less frustrating, so you want to avoid using swap if at all possible.

Re: memory usage

Posted: Sat Feb 22, 2020 5:11 pm
by anticapitalista
az2020 wrote: Fri Feb 07, 2020 11:24 pm
...

Between Antix/Bodhi & MX, there's not that much difference....
Sorry, but I can't agree.
Based on your own posted figures, there is a huge difference between these 3. antiX is below 200MB RAM, Bodhi is just above 200MB RAM and MX RAM usage is more than double antiX's at over 400MB RAM!

Re: memory usage

Posted: Sat Feb 22, 2020 5:19 pm
by Jerry3904
That sounds right. Most users I have seen report 400+ for MX-19 with the more demanding Xfce 4.14, and about 200 with MX-Fluxbox.

Re: memory usage

Posted: Sat Feb 22, 2020 5:42 pm
by az2020
anticapitalista wrote: Sat Feb 22, 2020 5:11 pm
az2020 wrote: Fri Feb 07, 2020 11:24 pm
...

Between Antix/Bodhi & MX, there's not that much difference....
Sorry, but I can't agree.
Based on your own posted figures, there is a huge difference between these 3. antiX is below 200MB RAM, Bodhi is just above 200MB RAM and MX RAM usage is more than double antiX's at over 400MB RAM!
Are we looking at the same thing? The table I posted above shows (after updating in the virtual box) Antix was 195mb, Bodhi was 214mb. [EDIT: Sorry, I realize you were emphasizing MX. I saw the "bodhi/antix" and stopped reading there. I think when I wrote what you quoted, 200mb didn't seem like that much compared to the full range of distros. But, I agree that could be substantial to someone on a low-resource machine. I'm thinking the range between MX & Antix/Bodhi are all considered lightweight. But, I agree MX is up there. And, that could make a difference for very resource-limited machines. I wish distros would publish a "how to make this as skinny as possible." Turning off samba, etc. could make a big difference, and make MX more comparable to Antix?]

I did a comparison April 2019 (posted in another thread). Antix 17.4.1 was 99mb. Bodhi (still 5.0.0 then) was 146mb.

It's interesting that Bodhi remained 5.0.0, but grew from 146mb to 214mb. I guess that's due to the system update bring more new stuff(?). Or, maybe there was a difference between Qemu (I used that last time) and VirtualBox (used this time).

I don't know how comparable the installs on real hardware are. To me, in terms of comparing distros, the vitrual environment seems more comparable about the distro itself. But, those installs don't reflect installation on real hardware with real drivers, doing real things. :) But, then the distros vary a lot depending on how well they support newer hardware, I suppose. For example, Bodhi's virtually the same whether installed in virtual or my relatively new Ryzen 3 3200u/Vega 3. Whereas other distros jump very high in mem use when installed on that laptop.

So, you have to weight those numbers for what they are. (I did document in the linked materials how I compared. Anyone can recreate that on other hardware.)

I'm going to this again this summer after the 20.04 stuff is out, and the LTS-based distros like Peppermint & Linux Lite are released. If there's something I can do different to shed more light, I will (assuming it easily fits into what I do. I don't want to spend a lot of time on it.). One thing I think I'm going to do differently is do the "free" command once every 5 minutes (for 15 minutes) and take the average. What I have been doing is waiting for it to settle down. But, that could be arbitrary. Sometimes they start high, and then stabilize lower. Sometimes they start low, then jump high. Sometimes they cycle up and down (and I try to take what looks like the average). Maybe I should take a "free" reading every 5 minutes (3 times, until 15 minutes elapse) and average that.

Re: memory usage

Posted: Sat Feb 22, 2020 6:00 pm
by anticapitalista
I don't dispute your tests and the results of the tests (i find them very valuable), but I do dispute that particular conclusion you came to i.e. there is not much difference between antiX/bodhi and MX.

In your same test, there were other distros that showed significantly less RAM usage than MX e.g. Peppermint, Linux lite, Lubuntu, Sparky, Xubuntu and even KDE neon used less RAM than MX.

MX doesn't claim to be lightweight so it is no surprise that its RAM usage is higher than distros that do claim to be such as antiX and bodhi and possibly sparky.

Re: memory usage

Posted: Sat Feb 22, 2020 7:01 pm
by christophe
@retired
FWIW, I found my MX-19 setup on my 2 GB laptop (Dell D420, 32-bit, frugal install) starts up at about 282 MB, and with Firefox (only this 1 tab open) is 530 MB -- 2 MX forum tabs brought it to 606 MB, with 68 KB swap used. I got here by tweaking it slightly with:

1. /etc/sysctl.conf added ("borrowed" from antiX):

Code: Select all

 vm.swappiness=10
vm.vfs_cache_pressure=50 
2. changed the kernel to the 4.9 antiX kernel (from the MX Package Installer).
3. disabled a couple of startup programs (from settings manager on top of whisker menu) that I KNEW I could live without, like clipit & blueman.
4. enabled zram for swap (from the wiki) -- and no hdd swap.

That made my old 32-bit 2 GB system very responsive & enjoyable for me to use. I'm not sure which part did what % of the improvement. I just threw everything at it that I thought would work.

(As a side note, my antiX-19 32-bit on the same computer boots up to 127 MB memory used.)
*** edit: Just noticed the 29.2 MB for my ROX panel launcher; that is what pushes my antiX over 100 MB.

Re: memory usage

Posted: Sat Feb 22, 2020 8:09 pm
by JayM
On my 2009 Averatec N1130 netbook, 2gb DDR2-800 ram, 32-bit 1.6gb Intel Atom single-core CPU, with MX-19.1 and the antiX 4.9 kernel installed, using Fluxbox, with non-essential (to me) services like Bluetooth, samba, cups and saned disabled, no conky, using Falkon web browser instead of Firefox: 118MB idle memory use with just htop running in a terminal, 287MB in use with Falkon open to the forum (one browser tab open) plus htop.

Since OP never gave his Quick System Info it's impossible to offer him specific suggestions on how to reduce memory consumption on his computer. If he's interested in reducing memory use by reducing the number of service daemons that run in the background and using MX Fluxbox he can follow seaken64's instructions as I did.