swap usage - never seen


7 posts
by macey » Sat Aug 31, 2013 12:35 pm
Hello,
I have been using raspi's since they became available. My machines have quite heavy usage, running multiple MPD's and tvheadend, apache2, playlist compiler
scripts etc. In spite of this quite heavy demand, I have yet to see any usage of swap,
either with 'free':-
Code: Select all
richard@nyingma-linux:/etc$ sudo dphys-swapfile swapon
richard@nyingma-linux:/etc$ free
             total       used       free     shared    buffers     cached
Mem:        448776     432060      16716          0      42912     261704
-/+ buffers/cache:     127444     321332
Swap:       102396          0     102396


or 'top'
Am I missing something? :?:
Posts: 55
Joined: Thu May 24, 2012 6:05 pm
by macey » Sun Sep 01, 2013 9:58 am
macey wrote:...............am I missing something? :?:

bump... Can anyone here confirm that they actually ARE seeing swap usage please?
Posts: 55
Joined: Thu May 24, 2012 6:05 pm
by ShiftPlusOne » Sun Sep 01, 2013 10:11 am
You don't want swap usage on the pi... The only time you should use swap on the pi is when the memory is running dangerously low and you want to prevent the system from locking up completely. Even then, the linux kernel is smart enough to help prevent that even without swap. That's why the default 'swappiness' is set to be very low on raspbian.

https://en.wikipedia.org/wiki/Swappiness
Moderator
Moderator
Posts: 1199
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy
by dave j » Sun Sep 01, 2013 11:27 am
macey wrote:Am I missing something? :?:

Yes. The software you're running doesn't need as much memory as you think it does. Look how much is being used for buffers and cache - Linux will automatically use memory for buffers and cache if it's not needed for other purposes. Your performance might be limited because it's CPU or I/O bound but you've got plenty of memory to spare.
Posts: 43
Joined: Mon Mar 05, 2012 2:19 pm
by macey » Sun Sep 01, 2013 11:44 am
dave j wrote:
macey wrote:................. Your performance might be limited because it's CPU or I/O bound but you've got plenty of memory to spare.

My performancd is not "limited". My RasPi's run just fine :D
I am just curious. I have been running Ubuntu on a number of machines for years. It seems to use swap quite regularly, even on a lightly loaded machine
with 8gig of ram. Never, ever seen it used on any of my Pi's. Wondered if they are set up correctly.... :?:
Posts: 55
Joined: Thu May 24, 2012 6:05 pm
by macey » Sun Sep 01, 2013 11:50 am
macey wrote:
dave j wrote:
macey wrote:..................wondered if they are set up correctly.... :?:

Just answered my own question.
cat /proc/sys/vm/swappiness = 60 on Ubuntu
cat /proc/sys/vm/swappiness = 1 on Rasbian.

Thanks.
Posts: 55
Joined: Thu May 24, 2012 6:05 pm
by W. H. Heydt » Sun Sep 01, 2013 3:38 pm
macey wrote:
dave j wrote:
macey wrote:................. Your performance might be limited because it's CPU or I/O bound but you've got plenty of memory to spare.

My performancd is not "limited". My RasPi's run just fine :D
I am just curious. I have been running Ubuntu on a number of machines for years. It seems to use swap quite regularly, even on a lightly loaded machine
with 8gig of ram. Never, ever seen it used on any of my Pi's. Wondered if they are set up correctly.... :?:


I have a 10 year old system running SuSE 9.2 with 2 GB RAM and I don't think I don't know that I've ever seen it use any swap space. The swap partition--on a 36GB Raptor--is 1 GB.
Posts: 1372
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)