public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] Swap performance
@ 2011-05-25 14:20 Alex Schuster
  2011-05-25 15:31 ` Paul Hartman
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Alex Schuster @ 2011-05-25 14:20 UTC (permalink / raw
  To: gentoo-user

Hi there!

I still wonder why my KDE4 system starts swapping so early. Until a week 
ago, I had 6G of RAM, but after a day of being logged in, I usually had some 
swap usage. Sometimes this goes up to 1.5G, this is when the system becomes 
way too slow and I log out.

Normally I don't mind having swap, I always had. But to me it looks like
this is worse than it should be. From the point when swapping starts, it's 
nearly permanent, like, when switching applications and desktops. As if
important stuff were swapped out that will be needed again soon. While 
unimportant stuff stays in memory.

This was even worse when using the ati-drivers/fglrx, but at the moment
I'm using xf86-video-ati with xorg-server-1.10.1.901 and KMS.
echo 1 > /proc/sys/vm/drop_caches helps a little, but not much. And not
for long.

Sometimes I quit memory-hungry applications like Kontact, Amarok and TV
Browser and restart them immediately afterwards. Memory usage has
dropped, and desktop switching is fast again, once I went to every desktop 
so that stuff will be swapped in. BTW, vm.swappiness is set to 20.

Or I do a 'swapoff -a && swapon -a', this empties the swap and also
frees memory. But this takes _quite_ _a_ _while_. Once I measured 37 minutes 
to clear 1G of swap.
But I do not remember how much memory was being used then, so I tried 
again, after closing memory-intensive applications:

weird ~ # free -m
             total       used       free     shared    buffers     cached
Mem:          5721       4184       1536          0         34        111
-/+ buffers/cache:       4039       1682
Swap:         4093        885       3208

weird ~ # time swapoff -a

real    27m8.757s
user    2m12.284s
sys     21m37.089s

weird ~ # free -m
             total       used       free     shared    buffers     cached
Mem:          5721       4785        936          0         53        409
-/+ buffers/cache:       4322       1398
Swap:            0          0          0

So, 27 minutes to put 885MB of swap back into RAM, with the double amount of 
that being free RAM.  I monitored with iotop, and the transfer rate started 
around 60-100 K/s, later it went higher. But the average transfer rate is 
550K/s. Shouldn't swap be, like, a little faster?

My swap is on an LUKS-encrypted LVM volume, but I tried with a fresh new
LVM volume, and it was a little better only. The SATA drive gives 80-100 
MB/s according to hdparm -t. dd'ing /dev/zero directly to the swap volume 
gives around 100 MB/s.

I'm running ck-sources 2.6.38, but I experience this for a long time
now, and changed from tuxonice-sources (another thing that just doesn't
work well for me) to ck-sources, to try if this would improve things. I
even cloned a .config from some live cd, in case I had some stupid option
activated that slowed things down.

Lowering swappiness helped, as did more memory. With 3.7G of RAM, KDE4
was barely usable. But two years ago, when this PC was new, I ran KDE 4.2 on
x86, compiled all except OpenOffice in tmpfs, often had a virtual
machine running in VMplayer, and it was fine.

I sure run lots of applications (Kontact, Amarok, TV Browser which uses an 
incredible amount of RAM), some Dolphins, some Konsoles, a few Konquerors, 
about 15-26 Chromium tabs, KMyMoney, some editors, sometimes Qt Creator, and 
some Okulars. When I file some photos from my camera with Digikam, I 
normally do not close it afterwards, hoping that it gets swapped out if 
needed, and unless I start using it again this should not cost too much of 
my RAM. This has always been my style of working, I don't like to close an 
applications just after working with it. And it was fine in the past, with 
much less memory, and with a virtual machine running all of the time.

Now I got another 2G of RAM, and things are better. But still, I have 800M 
of swap right now, without using special applications or VMs. At this 
moment, it's not problem, there is no paging going on. A little while ago, 
it was quite noticeable. I was running rdiff-backup stuff at that moment, 
but so I am doing now. Weird.
Oh, even weirder: The phone just rang, and five minutes later, swap has gone 
to 860M. I was running rdiff-backup --list-increment-sizes, maybe this uses 
much memory, and caches the stuff. Now the command has finished, and paging 
has stopped. The rdiff-backup process itself does not use much memory.

BTW, does anyone else's kwin use 750M? That's pretty high, I think it used 
to be more like 300M.

	Wonko



^ permalink raw reply	[flat|nested] 15+ messages in thread
* Re: [gentoo-user] Swap performance
@ 2011-05-26 17:26 Alex Schuster
  0 siblings, 0 replies; 15+ messages in thread
From: Alex Schuster @ 2011-05-26 17:26 UTC (permalink / raw
  To: gentoo-user

Volker Armin Hemmann writes:

> On Thursday 26 May 2011 00:40:21 Alex Schuster wrote:
> > Paul Hartman writes:
> > > On Wed, May 25, 2011 at 9:20 AM, Alex Schuster <wonko@wonkology.org>
> > > wrote:

> > Maybe I should have bought 4G instead of 2G, so I'd have 10G, not 8G.
> > I'm not sure if this is recommended these days, to have one memory bank
> > with 4G and 3 others with 2G each.
> 
> It is very much not recommended nor wise.
> 
> Sometimes it works great, sometimes it just works, sometimes it burns
> down your village, rapes your cattle and steals your dad.

Ookay.


> > It's growing: 1405m VIRT, 851m RES, 6m SHR. Strange, I did not actually
> > use the desktop after I wrote the mail you replied to, currently I'm
> > logged in from remote.
> 
> and you know that those numbers are pretty much meaningless?

Are they? Well, apparently _something_ in kwin was using hundreds of 
megabytes. When I was back at the PC, I had to wait three minutes until he 
password dialog appeared so I could unlock the session. iotop showed the 
kwin process swapping, and no other activity.
Now kwin is at 37M, which is much lower than I thought... whoops, I made a 
mistake in my previous posting, I got the virtual memory column instead by 
misusing awk. I also confused kwin with plasma-desktop, which had been 
really high in the past.

> about swap:
> 
> 8gb ram, 24gb swap here. Swap so huge because of historical reasons
> (started with one disk with 8gb, now there are three...). But not so
> bad, considering all those tempfs mounts that can shoved in there.

Yikes. I'd rather use the space for other stuff... no matter how large hard 
drives are, mine tend to fill up so I am glad for every extra gigabyte I can 
find.

> Of course I am scared about the shitstorm if that ever happens.
> 
> I am using the standard scheduler, no fancy io-scheduling stuff, kernel
> 2.6.36.6 and can't complain.

I do, a lot. But it seems that the system performs okay now.

> Even after a week of uptime I only get 500mb swap. Some cruft still in
> memory for some i-dont-know-reasons shoved in the hellhole swap so it
> won't get in the way of the more important stuff. Like gwenview. Or vlc.

Yeah, that's how it should be. A little swap is okay. But in my case it felt 
like important stuff was swapped out.

	Wonko



^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2011-05-26 20:50 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-25 14:20 [gentoo-user] Swap performance Alex Schuster
2011-05-25 15:31 ` Paul Hartman
2011-05-25 16:58   ` Volker Armin Hemmann
2011-05-25 19:34     ` Paul Hartman
2011-05-25 20:03     ` Alan McKinnon
2011-05-25 20:38       ` Alex Schuster
2011-05-25 22:40   ` Alex Schuster
2011-05-26 16:30     ` Volker Armin Hemmann
2011-05-25 16:49 ` Alan McKinnon
2011-05-26 20:49   ` Mick
2011-05-25 16:53 ` Volker Armin Hemmann
2011-05-25 20:07   ` Alan McKinnon
2011-05-26 13:32     ` Sebastian Beßler
2011-05-25 22:18   ` Alex Schuster
  -- strict thread matches above, loose matches on Subject: below --
2011-05-26 17:26 Alex Schuster

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox