Hi, recently I noticed, that one of our webservers is using swap space, while there is plenty of physical ram available. free -m total used free shared buffers cached Mem: 8118 2014 6103 0 85 261 -/+ buffers/cache: 1667 6450 Swap: 8197 77 8119 It's not that much, but why? Any ideas how to debug that? Thanks for any hint and suggestion. /G?tz -- G?tz Reinicke IT-Koordinator Tel. +49 7141 969 82 420 E-Mail goetz.reinicke at filmakademie.de Filmakademie Baden-W?rttemberg GmbH Akademiehof 10 71638 Ludwigsburg www.filmakademie.de Eintragung Amtsgericht Stuttgart HRB 205016 Vorsitzender des Aufsichtsrats: J?rgen Walter MdL Staatssekret?r im Ministerium f?r Wissenschaft, Forschung und Kunst Baden-W?rttemberg Gesch?ftsf?hrer: Prof. Thomas Schadt
Hi G?tz, On Dec 10, 2013, at 15:01 , G?tz Reinicke - IT Koordinator <goetz.reinicke at filmakademie.de> wrote:> Hi, > > recently I noticed, that one of our webservers is using swap space, > while there is plenty of physical ram available. > > free -m > total used free shared buffers cached > Mem: 8118 2014 6103 0 85 261 > -/+ buffers/cache: 1667 6450 > Swap: 8197 77 8119 > > > It's not that much, but why?my first idea would be that RAM usage was higher temporarily, which led to some pages being swapped out, and those pages haven't been used since so they were never swapped in again.> Any ideas how to debug that? Thanks for any hint and suggestion./proc/*/smaps is a starting point. It's fairly easy to write a little script that adds the values in the Swap: lines for each process and calculates swap usage per process. Bests, Peter. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 203 bytes Desc: Message signed with OpenPGP using GPGMail URL: <http://lists.centos.org/pipermail/centos/attachments/20131210/af572354/attachment-0002.sig>
> recently I noticed, that one of our webservers is using swap space, > while there is plenty of physical ram available. > > free -m > total used free shared buffers > cached > Mem: 8118 2014 6103 0 85 > 261 > -/+ buffers/cache: 1667 6450 > Swap: 8197 77 8119 > > > It's not that much, but why? > > Any ideas how to debug that? Thanks for any hint and suggestion.#!/bin/bash # Get current swap usage for all running processes # Erik Ljungstrom 27/05/2011 # Modified by Mikko Rantalainen 2012-08-09 # Pipe the output to "sort -nk3" to get sorted output SUM=0 OVERALL=0 for DIR in `find /proc/ -maxdepth 1 -type d -regex "^/proc/[0-9]+"` do PID=`echo $DIR | cut -d / -f 3` PROGNAME=`ps -p $PID -o comm --no-headers` for SWAP in `grep Swap $DIR/smaps 2>/dev/null | awk '{ print $2 }'` do let SUM=$SUM+$SWAP done if (( $SUM > 0 )); then echo "PID=$PID swapped $SUM KB ($PROGNAME)" fi let OVERALL=$OVERALL+$SUM SUM=0 done echo "Overall swap used: $OVERALL KB"
On 12/10/2013 6:01 AM, G?tz Reinicke - IT Koordinator wrote:> recently I noticed, that one of our webservers is using swap space, > while there is plenty of physical ram available. > > free -m > total used free shared buffers cached > Mem: 8118 2014 6103 0 85 261 > -/+ buffers/cache: 1667 6450 > Swap: 8197 77 8119 > > > It's not that much, but why?during idle time, dirty pages will be written to swap so they can then be discarded if needed. ignore it, it means nothing -- john r pierce 37N 122W somewhere on the middle of the left coast