Case of the missing swap

From: Bruce Caldwell (caldwell_at_kenetinc.com)
Date: 10/27/03

  • Next message: r.polanskis_at_uws.edu.au: "Installing iPlanet on less than 1Gb system?"
    To: <sunmanagers@sunmanagers.org>
    Date: Mon, 27 Oct 2003 17:16:19 -0500
    
    

    Hi folks,

    I want to find out where my swap is going to. Top reports 8
    gig in use on its summary. But when I total the lines I get
    Less than 2 gig. Where is it all?? Top correlates with memps -p.
     
    ./totalswap.pl
    150 processes: 138 sleeping, 11 zombie, 1 on cpu
    Memory: 2048M real, 818M free, 8054M swap in use, 3579M swap free

    TOP: Total swap used is 1175 Meg
    memps output 1191.104M

    Machine is a Sun 280 running solaris 2.8.

    The zombies aren't supposed to take any resources
    (http://rsusu1.rnd.runnet.ru/solaris2.7/Solaris_System_Administration_Gu
    ide-stripped/ch01/025-027.html)

    caldwell@cruncher: /netapp/home/caldwell/bin/ > swap -s
    total: 8160984k bytes allocated + 85952k reserved = 8246936k used,
    3665192k available

    Perl script to grock top and memps:
    #!/usr/bin/perl -w

    # run top then add up total swap needed
    open (TOP, "top -b 10000|") || die "cannot run top $!\n" ;

    while (<TOP>) {
        print ;
        last if (/PID USERNAME/) ;
    }

    while (<TOP>) {
        @fields = split (/\s+/, $_) ;
        $size = $fields[6] ; # first char is a space
        $size =~ /(\d+)([KMG])/ ;
        $units = $2 ; $size = $1 ;
        if ($units =~ /M/) {
            $total += ($size * 1e6) ;
        } else {
            if ($units =~ /K/) {
                $total += ($size * 1e3) ;
            }
        }
    # print "$total $_" ;
    }

    printf "TOP: Total swap used is %d Meg\n", $total/1e6 ;

    open (MEMPS, "memps -p |") || die "cannot open memps : $!\n" ;
    while (<MEMPS>) {
        next if (/PID /) ;
        @fields = split (/\s+/, $_ ) ;
        $size = $fields[2] ;
        $size =~ s/k// ;
        $mempstotal += $size * 1000 ;
    # print "$mempstotal $_" ;
    }
    $mempstotal = $mempstotal/1e6 ;
    print "memps outpout $mempstotal\M \n";

    Thanks,
    Bruce Caldwell
    _______________________________________________
    sunmanagers mailing list
    sunmanagers@sunmanagers.org
    http://www.sunmanagers.org/mailman/listinfo/sunmanagers


  • Next message: r.polanskis_at_uws.edu.au: "Installing iPlanet on less than 1Gb system?"

    Relevant Pages

    • Swap Never Ever Used in 2.4.7-10smp kernel (RH 7.2)
      ... box has 3 gig of mameory and I set up the max amount of swap Red Hat ... I monitor memory and swap usage and I've ... PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME COMMAND ...
      (comp.os.linux.misc)
    • Re: vm_thread_new: kstack allocation failed with vm.kmem_size="1536M"
      ... I am certainly icreasing the limits not decreasing them, ... Note that these machines have no swap - but then since the system runs fine ... the machine was expanded to 8 gig of real memory it no longer needs the ...
      (freebsd-stable)
    • Re: How much drive space for Linux?
      ... It is generally recommended to have twice as much swap ... >> space as you have RAM. ... Sounds like 4 gig is not enough. ... >> make the attempt to install it and see whether it fits. ...
      (linux.redhat.install)
    • Re: Swap of 4 Gigs
      ... and all of you for your advices. ... Gig RAM and mantain the "rule" of having the swap doubles the RAM. ...
      (Ubuntu)
    • RE: swap byte size?!
      ... When I had 2 gig of swap for my 1 gig system, I hardly ever went to swap ... unsubscribe mailto:redhat-list-request@redhat.com?subject=unsubscribe ...
      (RedHat)