swappiness in Ubuntu: April 2010 Archives

Ubuntu 10.04 swap update: It's not an Xorg bug but too much 'swappiness' — and it's easily fixed

| | Comments (6) |

First things first: My particular Ubuntu 10.04 LTS installation is not suffering from the Xorg memory leak.

I added mesa-utils so I could run:

glxinfo | grep "GLX version"

My output is:

GLX version: 1.2

If it was version 1.4, I'd have the newer, leaky Xorg, but the machine is properly reverted back to 1.2.

So what's my increased use of swap all about? I don't know if it's beneficial or not to have so much swapping going on, but a couple of readers have told me that Ubuntu's "swappiness" is set to a level of 60, which is optimal for servers. Desktops run better with lower "swappiness," and 10 is the suggested level.

All of this "swappiness" information is available in the Ubuntu community's Swap FAQ, which offers the following:

--------------- begin quoted material ----------------

What is swappiness and how do I change it?

The swappiness parameter controls the tendency of the kernel to move processes out of physical memory and onto the swap disk. Because disks are much slower than RAM, this can lead to slower response times for system and applications if processes are too aggressively moved out of memory.

* swappiness can have a value of between 0 and 100
* swappiness=0 tells the kernel to avoid swapping processes out of physical memory for as long as possible
* swappiness=100 tells the kernel to aggressively swap processes out of physical memory and move them to swap cache

The default setting in Ubuntu is swappiness=60. Reducing the default value of swappiness will probably improve overall performance for a typical Ubuntu desktop installation. A value of swappiness=10 is recommended, but feel free to experiment. Note: Ubuntu server installations have different performance requirements to desktop systems, and the default value of 60 is likely more suitable.

To check the swappiness value

cat /proc/sys/vm/swappiness

To change the swappiness value A temporary change (lost on reboot) with a swappiness value of 10 can be made with

sudo sysctl vm.swappiness=10

To make a change permanent, edit the configuration file with your favorite editor:

gksudo gedit /etc/sysctl.conf

Search for vm.swappiness and change its value as desired. If vm.swappiness does not exist, add it to the end of the file like so:

vm.swappiness=10

Save the file and reboot.

--------------- end quoted material ----------------

At first I changed my swappiness temporarily. But now I'm ready make the fix permanent. Thanks for the tip, readers ctk and Mike. And thanks to the Ubuntu community for this nice little bit of how-to documentation on swap, plus the rest of the community documentation, all searchable, too.

A new way to sudo: I've never heard of gksudo before, but this FAQ recommend using it, and it worked perfectly. From the man page for gksudo:

gksu is a frontend to su and gksudo is a frontend to sudo. Their primary purpose is to run graphical commands that need root without the need to run an X terminal emulator and using su directly.

Works for me.

How other distros set their "swappiness": I've done a bit of checking, and it seems that most Linux distros, including Fedora, Debian, PCLinuxOS and Suse, also set their default swappiness at 60. Most of what I found about swappiness is in agreement with the Ubuntu FAQ, with desktop users setting swappiness to 10. I saw a few posts about MySQL servers that recommended setting swappiness to 0; I couldn't tell you anything about that.

What I will be doing is running with swappiness at 10. Whether or not I see or feel any change, I'll write again with an update.

Swappiness caveat: Virtual Dave only recommends changing swappiness from 60 to 10 if you have at least 1 GB of RAM.

Think about this: Sure, changing the swappiness from 60 to 10 is going to reduce what I saw as excessive swapping in Ubuntu. Will performance on the desktop really improve? And if swappiness has been at 60 in most distros for a long while, why am I suddenly seeing a problem in Ubuntu 10.04 that I never saw previously.

More to think about: The Linux kernel tends to take memory and hold onto it for what is presumably the greater good. As I understand it, the system isn't so much using all the memory you see it taking while monitoring a utility such at top. That memory will be used when the system needs it.

I don't begin to understand the gritty details of all this, nor of swap and swappiness, and I'm just comparing my experience now with that of running Linux distributions and BSD projects in the recent past.

Update, 3 p.m.: It's been a few hours since I made this change, and so far the system is using no swap and is running as well as or better than it did before.

Tech Talk column

Steven Rosenberg's weekly Tech Talk column, which appeared Saturdays in the Los Angeles Daily News through about October 2009, is available on the Daily News Technology page.

About this blog






Steven Rosenberg aims to learn what he does not know. He writes about it here.



About this Archive

This page is a archive of entries in the swappiness in Ubuntu category from April 2010.

Find recent content on the main index or look in the archives to find all content.

Recent Comments

Steven Rosenberg on Running OpenBSD in a live environment with MarBSD-X : Jggimi has images for OpenBSD 5.0: http://jggimi.homeip.net/ ...

Monstra on CMS and blog software without databases: Monstra CMS is the best flatfile CMS ever! (!) Easy to install, upgr ...

Chris on Running OpenBSD in a live environment with MarBSD-X : Jggimi isn't developing his images anymore. If you want an updated Ope ...

Peter Ljung on Review: DragonFlyBSD 3.0.1 -- the longest DragonFlyBSD review ever -- Part 5: Comparison to OpenBSD 5.0 and closing comments: I have also been fascinated by the Hammer file system and think it wou ...

Anonymous on Review: DragonFlyBSD 3.0.1 -- the longest DragonFlyBSD review ever -- Part 2: My BSDistory: Can you just get to the actual review? ...

Bill Callahan on SugarSync is working on a Linux client, but I'm not unhappy at all with Dropbox: I've been very happy with SpiderOak. It has a native Linux client as w ...

AJ on Debian Stable -- set it and forget it -- spoils me for fresh Linux Mint 12 on some very nice ZaReason hardware: Gnome 2 is still standard in the upcoming SolusOS (Currently at RC 2). ...

Niki Kovacs on Debian Stable -- set it and forget it -- spoils me for fresh Linux Mint 12 on some very nice ZaReason hardware: Since I've moved to Debian stable - with a few tweaks - I've not only ...

Earl on Debian Stable -- set it and forget it -- spoils me for fresh Linux Mint 12 on some very nice ZaReason hardware: I use Mint 12 and LMDE based on Debian testing. Both are plagued by G ...

Alan Rochester on Debian Stable -- set it and forget it -- spoils me for fresh Linux Mint 12 on some very nice ZaReason hardware: "mint does have a separate xfce edition afaik.." The Debian version o ...

swappiness in Ubuntu: April 2010: Monthly Archives

Powered by Movable Type 4.25

Search this blog

Loading

LXer

Links

Life, the Universe and Debian
Simplify
Daily News technology
LXer
Distrowatch
Linus' Blog
David Pogue
BoingBoing
Linux Today
TuxRadar
Linux.com
Linux Planet
The Open Road
Linux Outlaws podcast
Dan Lynch
Fabian Scherschel
The VAR Guy
Larry the Free Software Guy
Chess Griffin
Linux Reality podcast
Desktop Linux
Practical Technology
Linux Devices
ZDNet
ZDNet's Storage Bits
ZDNet U.K.
iTWire
CNet News
Webware
Beyond Binary
TechCrunch
The Register
Ars Technica
Reg Developer
Computerworld
Computerworld blogs
Steven J. Vaughan-Nichols at Computerworld
Debian
Planet Debian
Debian Forums
Debian News
debianHELP
debiantutorials.org
The Debian User
Wolfgang Lonien
Debian-News.net
Debian Administration
Debian Admin
Debian Weather
Aaron Toponce
Ubuntu
Xubuntu
Kubuntu
Edubuntu
Planet Ubuntu
Ubuntu Forums
Ubuntu Geek
Works With U
OMG! Ubuntu!
I' Been to Ubuntu
Tanner Helland
Dustin Kirkland
Ubuntu UK Podcast
Ubuntu Linux Help
Popey
Linux Mint
CrunchBang Linux
OpenBSD
OpenBSD Journal
OpenBSD Ports
OpenBSD 101
Planet.OpenBSD.nu
jggimi's OpenBSD live CD
DaemonForums
BSDanywhere
Marc Balmer
Denny's OpenBSD blog
Polarwave's OpenBSD Tips and Tricks
Binary Updates for OpenBSD
Puppy Linux
Damn Small Linux
Tiny Core Linux
Lucky 13's Linux blog (lots of Tiny Core)
Lucky 13's BSD blog
PCLinuxOS
Mandriva
Red Hat
Red Hat News
Red Hat Blogs
Red Hat: Truth Happens
Red Hat Magazine
CentOS
Planet CentOS
Fedora
Planet Fedora
Fedora Forums
Fedora Docs
Join Fedora
Paul Frields
Slackware
Slackbuilds
Robby's Slackware Packages
Slackblogs
dropline GNOME for Slackware
GNOME Slackbuild
GWARE - GNOME for Slackware
Wolvix
Zenwalk Linux
Vector Linux
Slax
Splack Linux — Slackware for Sparc
Nonux
How to Forge
marc.info BSD and Linux mailing list archive
FreeBSD
FreeBSD, the Unknown Giant
A Year in the Life of a BSD Guru
NetBSD
hubertf's NetBSD Blog
PC-BSD
Daemon Forums
FreeBSD Forums
Planet FreeBSD
Evilcoder.org
miwi's Privat Blog
DragonFlyBSD
DragonFlyBSD Digest
DesktopBSD
BSD Talk podcast
BSD Magazine
Rhyous
OpenSolaris
MilaX
BeleniX
DeLi Linux
Linux Loop
Electronista
The Tech Report
Engadget
Gizmodo
Phoronix
xkcd – A webcomic of romance, sarcasm, math and language
Nixie Pixel
Technology for Mortals
Thoughts on Technology
ZaReason
System 76
Tiger Direct
NewEgg
DealExtreme

Advertisement