Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

My Ubuntu 12.04 x64 on Dell XPS 15 with 8GB of RAM has been really sluggish.

After some searching I came across post about swappiness. I noticed that swappiness on my system was reported as 0 which means swapping should only start when memory is all used and yet is was actually acting much the same as when swappiness is 60.

I set swappiness to 10 using:

echo 10 > /proc/sys/vm/swappiness

and update /etc/sysctl.conf with:

vm.swappiness = 10

After rebooting I notice that swappiness is reported as 0 again with same sluggish performance. I ran echo 10 > /proc/sys/vm/swappiness and the performance improved remarkably.

I rebooted again and check swappiness, it was reported as 0 again. I executed sudo sysctl -p and could see the values from sysctl.conf take effect.

It seems that the values from /etc/sysctl.conf is ignored on boot.

I have a notebook with Ubuntu 12.04 32 bit and I also applied the same configuration. On the notebook the changes do take effect as expected and remain after a reboot.

Has anyone come across this kind of problem?

share|improve this question
    
Is there a swap partition? Do you have reasons, other then the sluggishness, to believe that it's been running out of RAM? –  mikewhatever Jul 24 '12 at 22:12
    
There is a swap partition and the system just start using it long before running out of memory. The swappiness parameter configures how soon the kernel should do it. With a value of 100 it start swapping aggressively immediately. With a value of 0 it should only start swapping once all RAM is used. –  Corneil du Plessis Jul 25 '12 at 6:15
    
The real problem is that a change to the configuration is ignored when the system boots. The second problem is that a value of 0 for swappiness seems to have the opposite effect. –  Corneil du Plessis Jul 25 '12 at 6:16
add comment

2 Answers

Try this:

  1. Start a terminal emulator.
  2. cd /etc/sysctl.d/
  3. sudo echo "vm.swappiness = 10" > 60-memory-management.conf
  4. sudo chmod 644 60-memory-management.conf
  5. Reboot.

Check if the new values are in use with:

  1. cat /proc/sys/vm/swappiness
share|improve this answer
    
I tried this and still end up with swappiness = 0 after reboot. sudo sysctl -p is only way that set swappiness to the correct value. –  Corneil du Plessis Aug 27 '12 at 20:28
add comment

I just bung the following in my /etc/rc.local

sysctl -w vm.swappiness=1 #Discourage swapping.

Basically, you can run this command: sudo sysctl -w vm.swappiness=1 at any time to change the swappiness.. cat /proc/sys/vm/swappiness gives 1 after this.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.