Is possible to reduce Ubuntu 16.04's RAM usage to Ubuntu 15's or Ubuntu 14's?

Asked by tomsk on 2017-03-04

Like titile is possible to reduce Ubuntu 16.04's RAM usage to Ubuntu 15's or Ubuntu 14's?

I mean this question: http://askubuntu.com/questions/888509/unity-reduce-ram-usage/888522

I made some tests :)

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu linux Edit question
Assignee:
No assignee Edit question
Last query:
2017-03-16
Last reply:
2017-03-16

Use a lighter desktop session like XFCE or LXDE.

I use Openbox as a standalone window manager and my RAM use is very low.

tomsk (tomsk-slovak) said : #2

No I didn't ask about switching desktop enviroments :) I asked if is it possible to reduce usage. I have a 16GB RAM and I like Unity.

I mean this: http://www.hecticgeek.com/2016/04/ubuntu-16-04-lts-review/ read section called "Memory Usage Upon Desktop Loading", I can't understand why there is double RAM usage.

Oh wait I understand, Ubuntu 16.04 has worse memory management, so Ubuntu devs are lazy to optimize Unity/Ubuntu.

I've used Ubuntu on 2Gb RAM. No issues. How much RAM are you using??

What is the output of:

free -m

Thanks

The way Linux works keeps RAM use low. It keeps only one version of a library in RAM. Even if many applications use it there is only one copy in RAM as well as in storage (on your HDD). This means that updates to one library affect and upgrade all those applications that use it. It's incredibly efficient.

tomsk (tomsk-slovak) said : #5

I am using 1.2GB RAM with nothing running (Ubuntu is going to be memory heavy like Windows haha :) )

I know that in RAM is app cache, file cache, etc.. but older versions of Ubuntu (for example 15.10) had that cache too and had a much less memory usage.

Normal usage and free command: https://i.gyazo.com/cf35e97bf51e2bab95850f6e4f172064.png

You have to agree that Ubuntu 16.04 LTS has a much worse memory management than older versions it shows my tests: http://askubuntu.com/questions/888509/unity-reduce-ram-usage/888522

I tried in VM set memory to 512MB and it runs: https://i.gyazo.com/e92b09fb6c9139e78a1f470fc9b00baa.png

The first one is using 750Mb which isn't bad. What is the output of the command on your current system please?

tomsk (tomsk-slovak) said : #7

Yes 750MB is not bad, but it is still about 250MB more than Ubuntu 15.10 and secondly Gnome System Monitor shows 1GB, and Gnome System Monitor on Ubuntu 15.10 shows something around 500MB.

My current system? Ehm I am running on Windows 7 right now, but I like Linux and I would like to switch to Linux, I was using Ubuntu 14.04 LTS at work (programmer) and it consumed only about 500MB, so I am astonished that Ubuntu 16.04 is using so much.

My Windows 7 machine is using 1.7 GB at start, in Ubuntu's trend it means that Ubuntu 18.04 LTS will be memory hungry like Windows? (joke)

Manfred Hampl (m-hampl) said : #8

Have you already investigated, whether the difference im memory usage is caused by similar processes in 15.* and 16.04 needing different amounts of memory, or whether there are additional processes running in 16.04 that did not exist in 15.* at all?

Can you provide the output of the command

ps -A --sort -rss -o comm,pmem,rss | head -n20

both on a 14.*/15.* and a 16.04 system?

Considering you have 16Gb RAM I'm surprised you are quibbling 250Mb... Seems strange.

http://askubuntu.com/questions/227632/average-memory-usage-after-complete-ubuntu-12-04-start-up

Reports 400Mb 500Mb at startup. So the "trend" is not a trend at all. It's a recent change. There is no trend at all.

tomsk (tomsk-slovak) said : #10

So I run "ps -A --sort -rss -o comm,pmem,rss | head -n20"

And here are results:

Ubuntu 14.04.5 LTS

COMMAND %MEM RSS
compiz 2.3 192776
Xorg 1.4 115028
evolution-calen 0.6 54412
nautilus 0.6 50072
hud-service 0.4 33104
gnome-terminal 0.3 29940
nm-applet 0.3 29924
unity-settings- 0.3 28136
unity-panel-ser 0.3 27656
ibus-ui-gtk3 0.3 24788
indicator-keybo 0.2 22852
update-notifier 0.2 22468
gnome-session 0.2 22108
bamfdaemon 0.2 21692
indicator-print 0.2 21376
notify-osd 0.2 20828
telepathy-indic 0.2 19428
polkit-gnome-au 0.2 18368
evolution-sourc 0.2 18328

Ubuntu 15.04

COMMAND %MEM RSS
compiz 1.7 143028
Xorg 0.7 62620
evolution-calen 0.7 57872
nautilus 0.6 52856
signon-ui 0.5 44780
hud-service 0.4 34012
nm-applet 0.3 32488
gnome-terminal- 0.3 32260
unity-panel-ser 0.3 31908
unity-settings- 0.3 31328
ibus-ui-gtk3 0.3 29032
indicator-keybo 0.3 25748
bamfdaemon 0.2 24088
indicator-print 0.2 23156
telepathy-indic 0.2 22676
evolution-sourc 0.2 21468
polkit-gnome-au 0.2 21308
unity-fallback- 0.2 20308
ibus-x11 0.2 17204

Ubuntu 15.10

COMMAND %MEM RSS
compiz 1.7 141956
Xorg 0.7 63052
evolution-calen 0.7 61472
nautilus 0.6 53304
signon-ui 0.5 45952
hud-service 0.4 36772
nm-applet 0.4 34676
gnome-terminal- 0.4 33848
unity-panel-ser 0.3 32292
unity-settings- 0.3 32108
ibus-ui-gtk3 0.3 29156
indicator-keybo 0.3 25528
indicator-print 0.3 25520
telepathy-indic 0.3 24992
bamfdaemon 0.2 24336
evolution-sourc 0.2 23240
unity-fallback- 0.2 22864
evolution-calen 0.2 20908
polkit-gnome-au 0.2 20628

Ubuntu 16.04.2 LTS

COMMAND %MEM RSS
compiz 2.3 194916
Xorg 1.3 110728
gnome-software 1.0 88060
evolution-calen 0.7 60296
nautilus 0.6 54964
evolution-calen 0.6 52232
evolution-calen 0.6 51080
hud-service 0.4 37204
fwupd 0.4 36404
gnome-terminal- 0.4 35036
unity-panel-ser 0.4 34556
nm-applet 0.3 32384
unity-settings- 0.3 31652
ibus-ui-gtk3 0.3 29744
bamfdaemon 0.3 27444
indicator-keybo 0.3 26508
indicator-print 0.2 23616
evolution-sourc 0.2 23224
ibus-x11 0.2 21380

As you can see there is everything ok, but there must be something hidden what is consuming memory.

And I am not quibbling, but I would like to fix it only from principle, because there is something hidden what is consuming 400MB and I don't know what is it.

What is using the RAM is pretty obvious. Just read your own output.....

tomsk (tomsk-slovak) said : #12

What? I just see that Xorg server and compiz uses about 0.6% of RAM more, so 1% is nothing.. Don't tell me that 1% of RAM makes double memory usage between Ubuntu 15 and Ubuntu 16.

Please open: http://www.hecticgeek.com/2016/04/ubuntu-16-04-lts-review/

And read:

There has been a massive increase in the memory usage of Ubuntu 16.04 LTS. It’s 48.1% (205 MiB) compared to Ubuntu 15.10 and 66.7% compared to Ubuntu 15.04. Now, I can’t point out all the reasons behind this massive increase in memory usage, but I used the system monitor to list processes by their memory usage on a freshly installed Ubuntu 15.10 (yes I went through the trouble of installing it on the partition where Ubuntu 16.04 LTS was installed just for taking a screenshot of it) and compared it with one that was taken on a freshly installed Ubuntu 16.04 LTS.

To make a long story short, I identified 6 processes that were related to GNOME3’s Evolution Calendar and in Ubuntu 15.10 they consumed about 60.1 MiB altogether. The same processes in Ubuntu 16.04 LTS consumed about twice as much (120.7 MiB). So altogether they’ve helped increasing the memory usage in Ubuntu 16.04 LTS by about 60 MiB. For some unknown reason, the new Software Center also gets opened with the desktop and it consumes about 18 MiB (you can disable this easily through the ‘Startup Applications’ utility).

It all adds up to 78 MiB but there’s still about a 127 MiB difference between the memory usage of Ubuntu 15.10 and 16.04 LTS. I have no idea where it’s coming from.

Manfred Hampl (m-hampl) said : #13

And what do you now expect from us?

Remark to one of my previous comments:
If you want to compare the full memory usage, you must not just look at the top 20 processes (by adding "| head -n20") but look at all of them (e.g. with a command like "ps -A --sort +comm -o comm,pmem,rss")

tomsk (tomsk-slovak) said : #14

So I run command "ps -A --sort +comm -o comm,pmem,rss" and here are results:

Ubuntu 15.10: https://drive.google.com/file/d/0B-4KsabPAuUFa1Q1UHpJa0N4Y2s/view?usp=sharing

Ubuntu 16.04.2: https://drive.google.com/file/d/0B-4KsabPAuUFYWRIVHJUNUhHbWc/view?usp=sharing

Manfred Hampl (m-hampl) said : #16

And what do you now expect from us?

tomsk (tomsk-slovak) said : #17

I created simple script in Perl, which calculate a difference in mamory usage between Ubuntu 15 and Ubuntu 16:

#!/usr/bin/perl

use strict;
use warnings;

use Scalar::Util qw(looks_like_number);

my $ram = 0.0;

open (my $fr, "ubuntu_15_v2.txt");

    while (<$fr>) {

        my @words = split / /, $_;

 foreach my $loop_variable (@words) {
            if(looks_like_number($loop_variable)){
  $ram += $loop_variable;
  last;
            }
        }
   }
close $fr;

print $ram . "\n";

my $ram2 = 0.0;

open ($fr, "ubuntu_16_v2.txt");

    while (<$fr>) {

        my @words = split / /, $_;

 foreach my $loop_variable (@words) {
            if(looks_like_number($loop_variable)){
  $ram2 += $loop_variable;
  last;
            }
        }
   }
close $fr;

print $ram2 . "\n";

And result is difference 3%, and 3% is about 240MB of RAM, BUT Ubuntu 16.04 is using 2x more RAM than Ubuntu 15, so real difference is about 400MB, where is that missing 150MB?

Manfred Hampl (m-hampl) said : #18

If I compare the two files, I see:
some new processes in 16.04 that did not exist in 15.10 (e.g. fwupd, gnome-software, gvfsd-network, snapd, ...) needing about 180 MB memory
some processes not existing any more (e.g. mission-control, signon-ui, ...) needing about 113 MB memory
some processes with the same name that now need more or need less memory than before, with 16.04 needing about 182 MB more memory. Significant differences: dhclient -6.5 MB, evolution-calen... two processes +34 MB each, Xorg +51 MB, compiz +56 MB

Grand total: 1.61 GB vs. 1.36 GB, difference 250 MB, i.e. 18% of the smaller value.

Where do you see a difference "2x more RAM"?

Why do you think that using more RAM is bad? In my opinion the most efficient operating system is the one that makes most efficient use of the available resources. And due to the fact that memory access is faster than any disk system, putting as much information as possible into memory will be faster than having to read from disk.

tomsk (tomsk-slovak) said : #19

I think your calculations are bad, because look at this: http://askubuntu.com/questions/888509/unity-reduce-ram-usage/888522

I don't say that using more RAM is bad, I just want to know why it is consuming 2x more RAM, because there is only few new things.. Look at KDE Neon (based on Ubuntu LTS) it uses only 500MB of RAM, 2x less than Unity.. Let's say that I have one PC where I was using Unity with no problem when it consumed about 500MB of RAM, but now when it consumes 1GB of RAM it just fill my RAM quicker, so now I can't use Unity on that system anymore and I have to look for any other desktop enviroments (and it is quite hard, because all Ubuntu 16.04 LTS flavours are much heavier that Ubuntu 14.04 LTS flavours).

For example look at MATE, Ubuntu MATE 14.04 consumes about 270MB-300MB, but Ubuntu MATE 16.04 consumes about 400MB-450MB and withMutiny it is about 600MB (same 2x more RAM usage).

Or look at Windows 7, my Windows 7 machine when starts it consumes about 1.2GB of RAM, so at this point Ubuntu 16.04 LTS is heavy like Windows, oh yes, why optimize stuff, let users to buy better hardware.

Manfred Hampl (m-hampl) said : #20

"I think your calculations are bad" They are based on a comparison of your files. These data do not show a double memory usage.

I doubt that the two system monitor screen shots for 15.10 and 16.04 in http://askubuntu.com/questions/888509/unity-reduce-ram-usage/888522 can serve as a base for a fair comparison. It is evident that the two systems were in different state (compare the CPU usage at the time of the screen shot, and the network data up/downloaded).

A real judgement is only possible, if both systems are in similar idle states.

Can you help with this problem?

Provide an answer of your own, or ask tomsk for more information if necessary.

To post a message you must log in.