You are not logged in.

#1 2011-03-08 14:44:58

karabaja4
Member
From: Croatia
Registered: 2008-09-14
Posts: 1,000
Website

My system drags on high ram usage

Hi,

I have 1gb of ram on my system, and when ram usage goes to ~600-700mb I start to experience extreme system slowness. It's not regular swap-and-back slowness, it's becomes almost unusable. I.e. I open up a VM, do some file copying inside, when I try to go back to my host browser, VM screen needs like 10 seconds to minimize it self (I can see it dissapearing from top to bottom through like 5 seconds), then I try to click the panel to bring up a browser window, it doesn't respond. Mouse cursor is also extremely laggy. After 10 seconds on clicking on unresponsive panel it brings up the window and then needs like 1 minute until I can refresh a website normally and such. It's similar with heavy duty compressing tasks (such as LZMA), or when large number applications is open.

Is there a way to speed these situations short of buying more ram? I have no special swap settings in /etc/sysctl.conf, would they help? I figured this is somehow kernel related, but it's the same on few different kernels I tried...

Offline

#2 2011-03-08 15:23:46

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: My system drags on high ram usage

1 GR RAM is not much, but maybe your cpu is at fault - both VMs and LZMA are very cpu-intensive tasks. Do you have a swap partition on your HD? How frequently is your system using it?
I suggest you open htop in your terminal and keep an eye on it.

RAM is really cheap these days (DDR2 and DDR3 at least, older types are expensive).

Offline

#3 2011-03-08 16:28:13

karabaja4
Member
From: Croatia
Registered: 2008-09-14
Posts: 1,000
Website

Re: My system drags on high ram usage

karol wrote:

1 GR RAM is not much, but maybe your cpu is at fault - both VMs and LZMA are very cpu-intensive tasks. Do you have a swap partition on your HD? How frequently is your system using it?
I suggest you open htop in your terminal and keep an eye on it.

RAM is really cheap these days (DDR2 and DDR3 at least, older types are expensive).

Yes, I have a 1gb swap partition. I have no idea how apps use the swap, because I'm not really good at reading those values from top.

For example, at the moment chromium is using:
VIRT: 324mb
RES: 28mb
SHR: 14mb

(no other info about mem usage except %MEM)

Where is used swap exactly in these? I figured RES was the approximate true value of ram the application is using...

Buying more ram is a last resort because it's a DDR1 board and I really don't wish to invest money in an old machine...

Offline

#4 2011-03-08 16:41:54

bohoomil
Member
Registered: 2010-09-04
Posts: 2,376
Website

Re: My system drags on high ram usage

You may try to tweak your swappiness (an article covering the subject can be found here: http://rudd-o.com/en/linux-and-free-sof … o-fix-that ). It's not a golden solution for every performance case, but you can try it and see how it works for you.

BTW: Were I you, I'd consider using less RAM hungry apps, if (and where) possible. Chrome(ium) for that matter isn't very RAM friendly...


:: Registered Linux User No. 223384

:: github
:: infinality-bundle+fonts: good looking fonts made easy

Offline

#5 2011-03-08 16:41:54

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: My system drags on high ram usage

Use htop, the default setup shows in the top left side 3 important meters: CPU, MEM & Swap - check those.or

[karol@black ~]$ free -m
             total       used       free     shared    buffers     cached
Mem:           490        447         43          0         18        178
-/+ buffers/cache:        251        239
Swap:          258          0        258

I have 256 MB swap and at the moment I use 0 MB.


Edit: I have 2 machines with DDR1 RAM - one has 1 GB (I played the demo of Starcraft 2 on it ;P) and the other one has 512 MB. Both are fast enough for my needs although I don't use lzma for any big files, a couple MB big at most (before sending as an attachment in the e-mail). I don't use VMs at all and I have a pretty light setup - I use dwm as my WM.

Last edited by karol (2011-03-08 16:45:42)

Offline

#6 2011-03-08 21:38:19

karabaja4
Member
From: Croatia
Registered: 2008-09-14
Posts: 1,000
Website

Re: My system drags on high ram usage

I just did some testing... swap stays around ~200mb no matter how much load I put on. I guess the rest gets swapped with ram.. anyway I'll try to play with swappiness settings and see what comes up.

Offline

#7 2011-03-08 23:09:08

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: My system drags on high ram usage

karabaja4 wrote:

I just did some testing... swap stays around ~200mb no matter how much load I put on. I guess the rest gets swapped with ram.. anyway I'll try to play with swappiness settings and see what comes up.

The swap better stay at 0 ...

Run this

while read command percent rss; do if [[ "${command}" != "COMMAND" ]]; then rss="$(bc <<< "scale=2;${rss}/1024")"; fi; printf "%-26s%-8s%s\n" "${command}" "${percent}" "${rss}"; done < <(ps -A --sort -rss -o comm,pmem,rss | head -n 11)

to get the ten most memory-hungry apps (processes?). See if you need them open all at the same time and/or search for some lighter alternatives.

I use

sudo swapoff -a && sleep 2 && sudo swapon -a

to put the things from swap back to RAM - use it only if you have enough free RAM e.g. you need at least 200MB RAM if you want to reset swap with 200MB of leftovers.

Offline

#8 2011-03-08 23:45:31

karabaja4
Member
From: Croatia
Registered: 2008-09-14
Posts: 1,000
Website

Re: My system drags on high ram usage

karol wrote:

The swap better stay at 0 ...

Run this
//cut
to get the ten most memory-hungry apps (processes?). See if you need them open all at the same time and/or search for some lighter alternatives.

I use
//cut
to put the things from swap back to RAM - use it only if you have enough free RAM e.g. you need at least 200MB RAM if you want to reset swap with 200MB of leftovers.

No surprises really in used applications, and no alternatives either, perhaps for Chromium but I don't know what other browser to use. I tried Midori before but it was memleaking like hell... P.S. I'm so gonna code my own webkit browser one day...

COMMAND                   %MEM    RSS
qtcreator                 11.3    113.22
chromium                  9.2     92.81
X                         5.7     57.92
chromium                  5.4     54.33
chromium                  4.2     42.73
chromium                  3.3     33.81
pidgin                    2.5     25.48
chromium                  2.1     21.48
chromium                  1.4     14.06
qbittorrent               1.3     13.58

thanks for the tip on how to clear the swap, I'll try it sometime and see how it behaves...

.

Last edited by karabaja4 (2011-03-08 23:49:15)

Offline

#9 2011-03-08 23:57:15

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: My system drags on high ram usage

I don't know why it uses swap, because %MEM says you're using about half of your RAM.

Offline

#10 2011-03-09 00:01:09

karabaja4
Member
From: Croatia
Registered: 2008-09-14
Posts: 1,000
Website

Re: My system drags on high ram usage

karol wrote:

I don't know why it uses swap, because %MEM says you're using about half of your RAM.

Yeah it's always at 500-600-700mb on regular usage, not more... but there's always about 100-200mb in swap.

Offline

#11 2011-03-09 06:01:23

thestinger
Package Maintainer (PM)
From: Toronto, Canada
Registered: 2010-01-23
Posts: 478

Re: My system drags on high ram usage

By default, the kernel will swap stuff out to avoid dropping caches.

If you don't want that behavior, set swappiness to 0, but keep in mind that the default setting has been chosen because it leads to the best behavior overall - some swapping in exchange for some caching leads to better responsiveness (at least according to the kernel devs).

http://kerneltrap.org/node/3000

Offline

#12 2011-03-13 00:05:36

karabaja4
Member
From: Croatia
Registered: 2008-09-14
Posts: 1,000
Website

Re: My system drags on high ram usage

Okay, did some more testing. The test was installing MATLAB in VM while surfing on host machine (which I needed to do anyway).

With swappines set to 0 host was completely unusable, even though ram stayed ~700mb (with 0 swap). Mouse lagging and freezing, windows not restoring, everything extremely unresponsive.
With swappines set to 100 it uses ~500mb ram and around 200-300mb swap and is more or less usable, not lag free but usable. I'm writing this post while installing MATLAB.

Still wondering why is it lagging with swappines 0 even though it's not using maximum amount of ram (not even close!)...

.

Last edited by karabaja4 (2011-03-13 00:10:29)

Offline

#13 2011-03-13 00:18:05

lagagnon
Member
From: an Island in the Pacific...
Registered: 2009-12-10
Posts: 1,087
Website

Re: My system drags on high ram usage

Honestly I think 1GB of RAM is insufficient for you to have a heavy desktop as well as a VM running, so no wonder you are having issues. You have also not yet shown us the output of "free" when you are experiencing these slowness issues.


Philosophy is looking for a black cat in a dark room. Metaphysics is looking for a black cat in a dark room that isn't there. Religion is looking for a black cat in a dark room that isn't there and shouting "I found it!". Science is looking for a black cat in a dark room with a flashlight.

Offline

Board footer

Powered by FluxBB