Swappiness not optimal for desktops

Bug #977319 reported by Svein Tore
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
linux (Ubuntu)
Invalid
Medium
Unassigned

Bug Description

(Not sure what package to file this in, if it's wrong I apologize)

I recently doubled the amount of RAM in my laptop from 1GB to 2GB. While noticing a significant improvement, I still got bad response time in many programs when multitasking.

A typical use case:

- Running Opera, Spotify and Inkscape (all somewhat cache and memory hungry).
- 1 GB RAM used
- ~250MB in swap

Inkscape would for instance respond to commands with a slight delay for every action, even when drawing normal lines. Changing views in Spotify could be slow. Changing programs took from 0 to 2 seconds.

Since both CPU and MEM usage was low, I investigated using iotop and noticed high io usage everytime there was a delay. I looked up swap usage on the net and got introduced to swappiness. Changing it to 10 and running swapoff and swapon changed everything drastically. The delay when switching programs is gone. The delay in Inkscape actions and Spotify are gone. Overall the system feels MUCH more responsive.

To me having a system starting to swap when I have 1GB of available memory (half of my ram) is unreasonable. I can see the point of reserving a lot of space for heavy operations, like compiling etc, but these are not day to day tasks for most users and delays when swapping out is to be expected.

This is anecdotal evidence, but a search on the net shows quite a lot of similar cases with similar results.

What is the rationale for keeping it at 60 for desktops? It certainly does not work for me on 2GB of ram and I can only see it making even less sense for more RAM as is common nowadays.

UPDATE:

Just thought I should include what the Ubuntu Wiki says about swap for desktops:
"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."

Given the immense improvement I'm noticing I strongly feel for the users out there just thinking their systems are just slow like I was thinking for a long time.

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: ubuntu-desktop 1.264
ProcVersionSignature: Ubuntu 3.2.0-19.30-generic 3.2.11
Uname: Linux 3.2.0-19-generic i686
ApportVersion: 1.95-0ubuntu1
Architecture: i386
Date: Mon Apr 9 18:08:10 2012
InstallationMedia: Ubuntu 11.04 "Natty Narwhal" - Release i386 (20110427.1)
SourcePackage: ubuntu-meta
UpgradeStatus: Upgraded to precise on 2012-01-21 (79 days ago)

Revision history for this message
Svein Tore (sveint) wrote :
Svein Tore (sveint)
description: updated
Svein Tore (sveint)
tags: added: swap swappiness
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in ubuntu-meta (Ubuntu):
status: New → Confirmed
Colin Watson (cjwatson)
affects: ubuntu-meta (Ubuntu) → linux (Ubuntu)
Changed in linux (Ubuntu):
importance: Undecided → Medium
tags: added: kernel-da-key
Revision history for this message
Joseph Salisbury (jsalisbury) wrote :

The default value of 60 was chosen as a middle of the road between servers and desktops. There are some details here:
http://lwn.net/Articles/83588/

Changed in linux (Ubuntu):
status: Confirmed → Invalid
Revision history for this message
Joseph Salisbury (jsalisbury) wrote :

You could also open an upstream bug[0] at bugzilla.kernel.org to start a discussion there.

[0] https://wiki.ubuntu.com/Bugs/Upstream/kernel

Revision history for this message
Svein Tore (sveint) wrote :

Thanks for the feedback. It's been a while, but after some more testing, it wasn't all that good in the end. The reason is that when it does eventually hit the memory ceiling and has to swap, the machine locks up for a longer period as suddenly there's a lot of data needing swapping. But I feel that there is a lot of room for improvement from the default values.

Also I have a new laptop now, so further testing is not possible.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.