PDA

View Full Version : Linux 'top' Command...................



SurferJoe46
19-06-2018, 06:24 AM
I opened a terminal and input 'top' to see what was happening to my system.

It seems that after leaving it running, streaming some radio station that I like or even Pithos - that my 'puter gets really sluggish and takes a long time to paint a screen.

Now - I know I hae a coal-fired CPU and all - but this is Linux! after all! and it should play happily in this system - right?

Anyway - here's a readout for those who are L-intelligent to look over and see if they find something that's bad.

Hopefully not!

FYI: I have PITHOS running here at this time, so you'll see that in the readout.


top -o %MEM

OK - THAT didn't work - so I may have to resort to a screenshot - Let me try that .... BRB......

8900

Aha! I think it's working for me - I told it that I demanded* it to work - and it does now. Linux listens!

* begged, really


joseph@SurfersMintu1 ~ $ top

top - 12:11:52 up 51 min, 2 users, load average: 1.88, 1.38, 1.26
Tasks: 172 total, 3 running, 169 sleeping, 0 stopped, 0 zombie
%Cpu(s): 24.6 us, 6.2 sy, 0.0 ni, 67.2 id, 2.0 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem: 2037264 total, 1727636 used, 309628 free, 11328 buffers
KiB Swap: 2083836 total, 347224 used, 1736612 free. 408928 cached Mem
Unknown command - try 'h' for help [OK - that was me making a mistake- ignore this line]
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2785 joseph 20 0 2548164 627020 108628 R 28.9 30.8 9:19.81 Web Content
2735 joseph 20 0 2791908 410960 67640 S 9.3 20.2 7:44.41 firefox
1892 joseph 20 0 1416492 140828 34184 R 8.0 6.9 8:07.78 cinnamon
1207 root 20 0 394772 40984 34632 S 5.6 2.0 2:18.03 Xorg
3080 joseph 20 0 1249916 64512 24560 S 4.6 3.2 1:39.89 pithos
1663 joseph 9 -11 361680 5300 3988 S 2.7 0.3 0:41.65 pulseaudio
3995 joseph 20 0 529144 26052 20444 S 1.3 1.3 0:00.62 gnome-term+
7 root 20 0 0 0 0 S 0.3 0.0 0:04.36 rcu_sched
894 mongodb 20 0 360572 18096 17748 S 0.3 0.9 0:16.08 mongod
1407 root 20 0 160464 6788 4160 S 0.3 0.3 0:03.89 wicd
2707 root 20 0 0 0 0 S 0.3 0.0 0:00.21 kworker/u4+
4020 joseph 20 0 24960 2740 2252 R 0.3 0.1 0:00.03 top
1 root 20 0 33912 2776 1900 S 0.0 0.1 0:03.56 init
2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd
3 root 20 0 0 0 0 S 0.0 0.0 0:00.33 ksoftirqd/0
5 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/0:+
8 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcu_bh
joseph@SurfersMintu1 ~ $

SurferJoe46
19-06-2018, 06:26 AM
Here's the 'free' command......................


joseph@SurfersMintu1 ~ $ free
total used free shared buffers cached
Mem: 2037264 1881016 156248 234556 16028 464264
-/+ buffers/cache: 1400724 636540
Swap: 2083836 324540 1759296
joseph@SurfersMintu1 ~ $

SurferJoe46
19-06-2018, 06:40 AM
I personally don't see a problem here - does anyone?


joseph@SurfersMintu1 ~ $ egrep --color 'Mem|Cache|Swap' /proc/meminfo
MemTotal: 2037264 kB
MemFree: 126628 kB
MemAvailable: 258108 kB
Cached: 472248 kB
SwapCached: 51236 kB
SwapTotal: 2083836 kB
SwapFree: 1759704 kB
joseph@SurfersMintu1 ~ $


Well.... I AM a tiny bit short on available memory.

piroska
19-06-2018, 09:00 AM
I just run Sys Monitor (GUI), so much easier to read.

But it's not showing anything there. Sluggish in what way? The O/S itself or the net?

Kame
19-06-2018, 12:59 PM
The lack of available RAM.

Your computer is now at the stage that to be able to continue working, it must use your hard drive to swap between (huge bottleneck).

Did you find an 80 wire/40 pin e-ide cable, the speed boost be a little help, but the best thing you could do to improve this, is add more RAM.

If you have enough RAM that the hard drive's swap never gets touched, you'll experience a smoother ride and may never experience dramatic slow downs.

KarameaDave
19-06-2018, 01:05 PM
Yes, using any swap at all is sub-par on a Linux machine, time to invest in more memory.

Rod J
29-06-2018, 06:17 PM
Hi Joe, sorry I'm a bit late seeing your post as I have been busy setting up my new system (Kubuntu 18.04 LTS). I think the following might help your situation.

Swappiness is the kernel parameter that defines how much (and how often) your Linux kernel will copy RAM contents to swap. This parameter's default value is “60” and it can take anything from “0” to “100”. The higher the value of the swappiness parameter, the more aggressively your kernel will swap.

The idea is that you can set a smaller value of swappiness which means the OS will be less inclined to use swap (which can be a real bottleneck on some systems).

I found a discussion on "Swappiness" on the Mint forum: https://forums.linuxmint.com/viewtopic.php?t=266441

And you can try reducing the swappiness value as explained here: https://sites.google.com/site/easylinuxtipsproject/3#TOC-Improve-usage-of-the-system-memory-RAM-

SurferJoe46
01-07-2018, 05:00 PM
Hi Joe, sorry I'm a bit late seeing your post as I have been busy setting up my new system (Kubuntu 18.04 LTS). I think the following might help your situation.

Swappiness is the kernel parameter that defines how much (and how often) your Linux kernel will copy RAM contents to swap. This parameter's default value is “60” and it can take anything from “0” to “100”. The higher the value of the swappiness parameter, the more aggressively your kernel will swap.

The idea is that you can set a smaller value of swappiness which means the OS will be less inclined to use swap (which can be a real bottleneck on some systems).

I found a discussion on "Swappiness" on the Mint forum: https://forums.linuxmint.com/viewtopic.php?t=266441

And you can try reducing the swappiness value as explained here: https://sites.google.com/site/easylinuxtipsproject/3#TOC-Improve-usage-of-the-system-memory-RAM-

I'm gonna read that one ---- word ---- at ----- a ---- time until I understand it.

Seriously.

I've opened them both in other tabs so I can lock them for perusal tonight. It's Saturday late evening and I've got nothing to do until the sun comes up anyway.

Let me start up a Moody Blues album and get right on it.

BB Monday - or so.

But one more question before I go......................

Should I get rid of Firefox and just run Chromium? (Not Chrome - which is another thing entirely I think).

SurferJoe46
01-07-2018, 05:45 PM
Well ---- this is a new fly in the oatmeal --- I did the following as dictated and C/P'd according to the distructions:


Now the how-to.

a. First check your current swappiness value. Type in the terminal (use copy/paste):

cat /proc/sys/vm/swappiness

Press Enter.

The result will probably be 60.

b. To change the swappiness into a more sensible setting, type in the terminal (use copy/paste to avoid typo's):

xed admin:///etc/sysctl.conf (this might be a problem here ----!)

Press Enter. Note that you'll be asked twice for your password.

Now a text file opens. Scroll to the bottom of that text file and add your swappiness parameter to override the default. Copy/paste the following two green lines:

# Decrease swap usage to a more reasonable level
vm.swappiness=10 (the wheels fell off again here too. From this part onward - it's all an exercise in things futile)

c. Save and close the text file. Then reboot your computer.

d. After the reboot, check the new swappiness setting

..... and here's the actual TERMINAL Dialog I got:


joseph@SurfersMintu1 ~ $ cat /proc/sys/vm/swappiness
60
joseph@SurfersMintu1 ~ $ xed admin:///etc/sysctl.conf
No command 'xed' found, did you mean:
Command 'xwd' from package 'x11-apps' (main)
Command 'xd' from package 'xd' (universe)
Command 'xjed' from package 'xjed' (universe)
Command 'xxd' from package 'vim-common' (main)
Command 'red' from package 'ed' (main)
Command 'sed' from package 'sed' (main)
Command 'xev' from package 'x11-utils' (main)
Command 'ed' from package 'ed' (main)
Command 'xsd' from package 'mono-devel' (main)
Command 'xep' from package 'pvm-examples' (universe)
Command 'xfd' from package 'x11-utils' (main)
Command 'med' from package 'ncl-ncarg' (universe)
Command 'xen' from package 'xen-utils-common' (universe)
Command 'jed' from package 'jed' (universe)
xed: command not found
joseph@SurfersMintu1 ~ $ # Decrease swap usage to a more reasonable level
joseph@SurfersMintu1 ~ $ vm.swappiness=10
vm.swappiness=10: command not found
joseph@SurfersMintu1 ~ $


I think the problem is that I am maybe NOT running Xfcd. Right?

SurferJoe46
01-07-2018, 05:57 PM
I have forgotten (if I ever really knew in the first place) how to detect the desktop environ I have running.

Here's what I attempted - and I bet none of it's useful - right?


joseph@SurfersMintu1 ~ $ uname -a
Linux SurfersMintu1 4.4.0-121-generic #145~14.04.1-Ubuntu SMP Mon Apr 16 18:40:43 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
joseph@SurfersMintu1 ~ $ lsb_release -a
No LSB modules are available.
Distributor ID: LinuxMint
Description: Linux Mint 17.3 Rosa
Release: 17.3
Codename: rosa
joseph@SurfersMintu1 ~ $ ls /usr/share/xsessions/
cinnamon2d.desktop cinnamon.desktop
joseph@SurfersMintu1 ~ $ echo $XDG_CURRENT_DESKTOP
X-Cinnamon
joseph@SurfersMintu1 ~ $

SurferJoe46
01-07-2018, 06:05 PM
Right now I've restarted Firefox with all the add-ons shut off just to see if FF is the bollix-master.

I also shut off Java Runtime in Libre Office just for kicks and giggles.

Rod J
02-07-2018, 12:42 AM
Yep, sorry about that ... my bad.

The tutorial was written for Mint Cinnamon 19 which has Xed as it's default text editor apparently. It's not available (or at least not easily installable) for your version of Mint unfortunately. But no problem, just use gedit instead. So the command line to edit that file would now be:

gedit admin:///etc/sysctl.conf

I can't vouch for the "admin:///..." bit because it doesn't work here in Kubuntu. I think it's another way of editing root owned files without hassles. Here in Kubuntu 18.04 you can just edit the file as normal and when you want to save it you get a password prompt to allow you to save the root owned file ... easy, peasy.

BTW, as far as setting the swappiness value to 10 ... that may be too low. I've read about it more and it seems the sweet spot may be between 10 and 30. You might need to experiment a bit with it. It's probably not going to make a huge difference in performance but it may be worth a try.

You probably won't see much difference in memory use and performance between Firefox, Chromium or Chrome. In fact Firefox may use less memory overall than Chrome (which I am using here). Chromium is good but you can't play DRM content video with it ... that's one of the things Google adds to Chromium to make Chrome (did you know Google takes Chromium and adds bits to it to make Chrome?).