Web lists-archives.com

some facts about memory usage for a change (was: Re: disable akonadi)




Beware, this is in part a rant. I am tired to no end about discussions 
about memory usage that lack meaningful *facts*. Those just spread 
misinformation on the Internet, which already has an abundance of fake 
facts these days. This may be my last post about this on this (IMHO 
meanwhile rather pointless) thread.

René J.V. Bertin - 02.09.18, 11:00:
> Running the kind of session you describe on a machine with only 2Gb of
> RAM is probably an exercise in SM with any modern DE... Chrome

I agree that 2 GiB can be tight, however the main reason for that is not 
the browser (see below).

Even with the session I describe below I get:

% free -m
       total  used   free  shared  buff/cache  available
Mem:   15825  3228   3284     459        9312      11838
Swap:  20479  1081  19398

(white space trimmed)

Which means that there are 3228 MiB actually physically used.

However on this system this is with MariaDB InnoDB buffer pool size set 
to 1 GiB. AFAIR the standard size is about 128 MiB with recent Akonadi 
versions. So you can reduce this number by about 870 MiB for a standard 
setup. On 2 GiB kernel, libraries and applications may use a bit less 
memory.

However… with a somewhat limited scope of running applications and in 
case you are willing to allow for some delays here and there, I bet a 
recent Plasma is actually workable with 2 GiB of RAM.

> readily uses around 600Mb just for the central process, FireFox even

600Mb of what? Apples, peaches, bananas? 600 Mb in itself just does not 
mean anything. Even 600 Mb of memory does not mean a lot. Am I 
nitpicking here? Probably yes. But for important reasons as you can see 
below:

> more; extensions like AdBlock run as a separate process and can grow
> quite large; the same applies for each tab you open. Audacity is
> surprisingly lightweight in comparison, even for large projects.
> (You'd at least need to install The Great Suspender in all the
> browsers you use.)

Here just an example on how actual facts may look like (it can be 
challenging to obtain actually facts about memory usage given the 
complexity of Linux´s virtual memory manager):

If you consider memory the Chromium processes that are there after just 
starting Chromium share with other processes running on this system I 
only see about half of the memory usage (Unique Set Size, USS column)

% smemstat | head -1 ; smemstat -c | grep chromium
   PID      Swap       USS       PSS       RSS D User       Command
 23980    48,0 K    95,8 M   110,6 M   172,1 M   martin     chromium
 24125     0,0 B    79,7 M    88,1 M   149,8 M   martin     chromium
 24090     0,0 B    53,9 M    63,1 M   129,1 M   martin     chromium
 24033     0,0 B    51,2 M    62,8 M   112,3 M   martin     chromium
 24062     0,0 B    12,9 M    22,1 M    87,6 M   martin     chromium
 24141     0,0 B    11,4 M    19,1 M    79,2 M   martin     chromium
 24117     0,0 B 10080,0 K    17,0 M    76,6 M   martin     chromium
 24156     0,0 B  9924,0 K    17,0 M    75,8 M   martin     chromium
 24001     0,0 B  7688,0 K    16,7 M    63,9 M   martin     chromium
 24151     0,0 B  9992,0 K    16,6 M    74,8 M   martin     chromium
 24087     0,0 B  4052,0 K  8072,0 K    47,3 M   martin     chromium
 24003     0,0 B   144,0 K  1599,0 K    17,7 M   martin     chromium

This system runs a full KDE Plasma Desktop with Akonadi + KMail, 
Akregator, Amarok, Quassel IRC on a ThinkPad T520 with Sandybridge i5.

Here with a fully loaded copy of today´s https://www.heise.de:

% smemstat | head -1 ; smemstat -c | grep --color chromium
   PID      Swap       USS       PSS       RSS D User       Command
 23980    48,0 K    95,4 M   110,9 M   173,3 M   martin     chromium
 24125     0,0 B    80,4 M    88,4 M   150,5 M   martin     chromium
 24033     0,0 B    59,6 M    71,4 M   121,2 M   martin     chromium
 24090     0,0 B    56,0 M    65,0 M   131,4 M   martin     chromium
 24435     0,0 B    43,3 M    54,3 M   124,1 M   martin     chromium
 24141     0,0 B    11,2 M    18,8 M    79,2 M   martin     chromium
 24117     0,0 B    10,0 M    17,2 M    76,8 M   martin     chromium
 24001     0,0 B  7688,0 K    16,7 M    63,9 M   martin     chromium
 24151     0,0 B 10028,0 K    16,6 M    74,9 M   martin     chromium
 24156     0,0 B  9132,0 K    16,1 M    75,0 M   martin     chromium
 24450     0,0 B  3984,0 K  7992,0 K    47,0 M   martin     chromium
 24003     0,0 B   144,0 K  1597,0 K    17,7 M   martin     chromium

But note: This Chromium has uBlock Origin running with quite strong 
settings. IMHO the only ad and tracking blocker most users ever need and 
way better than AdBlock Plus, Ghostery and you name it. Your memory 
usage may be higher with all the ad and tracking crap.

However this is all Chromium processes after starting Chromium, not just 
the "main" one.

Looking at Resident Memory Set Size (RSS) is better than looking as 
Virtual Memory Set Size (VSS / VSZ) which is just completely bogus when 
it comes to actual physically memory usage. But in a highly integrated 
desktop where lots of apps share the same libraries, even RSS is way 
over the board as you can see from above by comparing values or USS and 
RSS.

Even Plasma´s KSysGuard has it. Actually is shows just 80960 KiB for 
Chromium after just starting it. But it looks at only one of the 
processes. You can expand it with context menu and gain a detailed 
overview of memory consumption figures together with a basic explanation 
about it. A developer added this, I bet after having been tired to no 
end about the dozens or dozens of discussions about Plasma being a 
resource hog which have one thing in common: A total or partial lack of 
*facts*.


Without facts about actual resource there is really nothing to see here 
in this thread except personal user experiences. And that may very well 
be my last post about it. For those interested a search engine may help 
you to find out more about VSS, RSS, USS and how memory management on 
Linux actually work.

For those who do not understand at least the basics of it, I recommend 
to let go of trying to make something out of some values of some random 
tool, just install at least 4 GiB or even 8 GiB of RAM for basic day to 
day desktop work even with Firefox (recent version) or Chromium and 50+ 
tabs open in it… and *be done* with it already.

That does not mean that more memory would not help. Those 16 GiB of RAM 
in this ThinkPad T520 can help – already for the reason of additional 
caching. Just right now it caches 9312 MiB – and RAM still is a lot 
faster than at least SATA SSDs, but also NVMe SSDs and even persistent 
memory devices –, but for today´s resumed session Linux did not yet put 
all of the 16 GiB to work. 3284 MiB are still *completely* unused 
(however there is no point removing a quarter of a 8 GiB RAM chip :) 
from the machine).

% free -m
       total  used   free  shared  buff/cache  available
Mem:   15825  3228   3284     459        9312      11838
Swap:  20479  1081  19398

(repeated from above)

As well as the two SSDs with almost 1,5 TB of storage also help. If you 
are into speed I recommend at least 8 GiB for a single Plasma sessions + 
applications, together with SSD storage. This is much more important 
than trying to put the latest and greatest CPU into the system. So you 
can just buy an used ThinkPad or whatever and upgrade it. Even if its 
older than 5 years already. Depending on what you do 16 GiB may be way 
more than what your computer can put to good use. For 16 GiB you also 
need at least T520, X220 … or later.


Now I let this go… whether or not someone there actually picks up some 
of the facts about memory usage before posting again.

Thanks,
-- 
Martin