0

Been going through this topic - https://askubuntu.com/questions/157793/why-is-swap-being-used-even-though-i-have-plenty-of-free-ram.

Turned down swappiness to 10 and then to 0 but my installation is never able to reach out into 70%+ of RAM before turning to the swap area. So I am wrestling my lunix system with the help of that script from the link above, but still no joy. I am getting:

kellogs@kellogs-K52Jc ~/workspace/xgate_git/tigase-server $ sudo unswap.sh
Free memory:    1525024 kB (1489 MB)
Used swap:      938196 kB (916 MB)
Freeing swap...
swapoff: /dev/sda4: swapoff failed: Cannot allocate memory

and even:

kellogs-K52Jc tigase-server # unswap.sh
Free memory:    1212956 kB (1184 MB)
Used swap:      478516 kB (467 MB)
Freeing swap...
swapoff: /dev/sda4: swapoff failed: Cannot allocate memory

It must be something keeping the OS from using the 30% remainder of RAM. But what ?

EDIT:

Original: vm.overcommit_memory = 0 vm.overcommit_ratio = 50

Set to vm.overcommit_memory = 2 vm.overcommit_ratio = 100

And RAM usage would stall at about 50%; After this programs would not launch any longer and complain about memory shortage. Swap remained at 0% usage.

Set to: vm.overcommit_memory = 1 vm.overcommit_ratio = 100

Managed to go to about 83% RAM and 22% swap usage. Then I have called that script for emptying swap-into-RAM and hell broke loose. libflash crashing, the rest of programs unresponsive and having gone into broken pipes and stuff like that.

  • Duplicate of serverfault.com/questions/420778/… – enedil Feb 14 '14 at 1:35
  • @enedil - It's OK to have duplicates across the SE sites. Just not within one site. I should qualify that these duplicates should be geared to the specific SE site that they're on, and they shouldn't be merely a cross-post by the OP. – slm Feb 14 '14 at 2:08
  • @enedil - you're welcome to take pieces from the answers to the SE sites and create an appropriate A on this site as well. – slm Feb 14 '14 at 2:08
  • This one on U&L seems like the duplicate: unix.stackexchange.com/questions/77939/…. It explains why you can't go < 30% as you're finding. – slm Feb 14 '14 at 2:11
  • 1
    Nothing in that answer says you can't go below 30% mem free. The only thing I can think of that would prevent you from using all RAM is setting vm.overcommit_ratio to less than 100. @kellogs, what is the result of sysctl -a | grep vm.overcommit? – Patrick Feb 14 '14 at 4:39
1

Why exactly are you worrying about swap? The most important rule when tuning for performance (or anything else, for that matter) is to check if performance is adequate, if not measure where the bottlenecks are, then work on them. Jon Bentley's "Writing efficient programs" (sadly out of print) should be required reading; but look for his "Programming pearls".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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