This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

[9.006-5] swap usage results

.
.
Script developed by Anonymous, automation by BAlfson:

How to grab theres stats very easy...Login as root and then copy and paste the following blocks of commands:

wget www.mediasoftusa.com/swapusage
md5sum swapusage

The result should be: 0ed29febd7d70393b43d7a86e92e257c

If that's correct, continue with:
mv swapusage swap-usage.pl
chmod u+x swap-usage.pl
./swap-usage.pl
free -m
uptime
version


#!/usr/bin/perl
use warnings;
use strict;

my $overall = 0;
my %out = ();

opendir(my $dh, '/proc/') || die "Can't open /proc: $!";
my @pids = grep { -d "/proc/".$_ && /^[0-9]+$/} readdir($dh);
closedir($dh);
foreach my $pid (@pids) {
    my $sum = 0;
    next unless -d "/proc/$pid";
    print ".";
    foreach my $swap ( `grep Swap /proc/$pid/smaps 2>/dev/null` ){
        next unless $swap;
        $swap = (split(/\s+/,$swap))[-2];
        $sum += $swap;
        $overall += $swap;
    }

    my $progname = `ps -p $pid  -o comm --no-headers`;
    chomp($progname);
    $sum = t($sum);
    $out{$pid} = [$progname,$sum] unless $sum == 0;
}
$overall = t($overall);
my $total = t(`grep SwapTotal /proc/meminfo`);
print "\nSwapTotal: $total MB\n";
print "SwapUsed:   $overall MB\n";
print "========================================\n";
print "MB\t%\tPID\tprocess\n";
foreach my $pid ( sort{ $out{$b}[1]  $out{$a}[1] } keys(%out) ) {
  print $out{$pid}[1]."\t".p($total,$out{$pid}[1])."\t".$pid."\t".$out{$pid}[0]."\n";
}

sub t {
    my $x = shift;
    $x = (split(/\s+/,$x))[-2] if $x =~ /\s/;
    sprintf("%.1f",$x/1024);
}

sub p {
    my $total = shift;
    my $x = shift;
    return sprintf("%.1f",100*$x/$total);
}


Here's my output:


SwapTotal: 1024.0 MB
SwapUsed:   358.6 MB
========================================
MB      %       PID     process
125.8   12.3    6813    snort_inline
52.3    5.1     5787    afcd
32.0    3.1     7548    snort_inline
23.8    2.3     3513    confd.plx
17.7    1.7     28339   index.plx
16.2    1.6     23224   confd.plx
15.5    1.5     16384   confd.plx
15.4    1.5     5659    screenmgr.plx
13.6    1.3     5711    httpproxy
11.8    1.2     3159    confd.plx
6.6     0.6     4060    mdw.plx
5.9     0.6     4135    selfmonng.plx
5.7     0.6     3286    aua.bin
3.7     0.4     3508    notifier.plx
2.7     0.3     4103    selfmonng.plx
1.8     0.2     3237    sysmond
1.3     0.1     3190    confd-qrunner.p
0.9     0.1     5377    named
0.7     0.1     3090    irqd
0.6     0.1     5724    ctasd
0.6     0.1     5709    ctipd.bin
0.3     0.0     6048    master
0.2     0.0     3550    rrdcached
0.2     0.0     2335    udevd
0.2     0.0     5435    sshd
0.2     0.0     31050   awed
0.2     0.0     1474    udevd
0.2     0.0     31027   awed
0.2     0.0     3054    hald-addon-inpu
0.2     0.0     3070    hald-addon-acpi
0.2     0.0     5719    ctasd
0.2     0.0     1473    udevd
0.1     0.0     2784    dbus-daemon
0.1     0.0     5693    frox
0.1     0.0     1       init
0.1     0.0     8730    smtpd.bin
0.1     0.0     3287    logger
0.1     0.0     5136    ipv6_watchdog
0.1     0.0     4130    mingetty
0.1     0.0     3032    hald
0.1     0.0     4129    mingetty
0.1     0.0     6811    argos
0.1     0.0     3104    lcm-162
0.1     0.0     3118    haveged
0.1     0.0     3579    atd
0.1     0.0     4131    mingetty
0.1     0.0     2768    acpid
0.1     0.0     4133    mingetty
0.1     0.0     4128    mingetty
0.1     0.0     4132    mingetty



 astaro:/tmp # free -m
             total       used       free     shared    buffers     cached
Mem:          7957       7711        246          0        249       4155
-/+ buffers/cache:       3307       4650
Swap:         1023        321        702



 astaro:/tmp # uptime
 15:02pm  up 12 days 12:58,  1 user,  load average: 3.11, 3.46, 3.31



 astaro:/tmp # version

Current software version...: 9.006005
Hardware type..............: 320C
Serial number..............:
Installation image.........: 9.004-33.1
Installation type..........: ssi
Installed pattern version..: 44684
Downloaded pattern version.: 44684
Up2Dates applied...........: 4 (see below)
                             sys-9.004-9.004-33.34.1.tgz (Jan 31 14:19)
                             sys-9.004-9.005-29.15.2.tgz (Feb 13 07:57)
                             sys-9.005-9.005-15.16.1.tgz (Mar  7 02:05)
                             sys-9.005-9.006-15.5.2.tgz (Apr  6 02:01)
Up2Dates available.........: 0
Factory resets.............: 0
Timewarps detected.........: 0


This thread was automatically locked due to age.
  • Up2Dating to V9.006 should have slowed the growth of the portion of swap "eaten" by httpproxy, but doesn't seem to affect that wasted by Snort.  Until this is resolved, the easiest thing is to reboot the Slave and then failover to it after SYNCING is complete and both are ACTIVE.  It's up to you if you then wait for both ACTIVE again to reboot the new Slave (old Master).

    Cheers - Bob
  • So, here is the next Cluster with this issue, but with the software version 9.005016.


    I've forgotten that the newest proxy is already installed.
    In agreement with the support - the only temporary solution is to configure a cronjob, to restart the http proxy every night.

    Sophos, please solve this issue!

    Nice greetings
  • ....
    Sophos, please solve this issue!

    Yes and it would be interesting to know how their QA testing machines are equipped. I guess they have more than 2gb of RAM, otherwise they should have easily found the swapping problem.
    My production machine has 16gb RAM and is up and running on 9.006-15 for nearly 15 days. Swapping is still zero, the average memory usage is about 25%.
  • running 9.1 on my machine and it's got 1.4 gigs cached and is now swapping at 10%..for some reason the kernel won't release file cache before swapping..[:(]
  • SwapTotal: 1024.0 MB
    SwapUsed:   103.9 MB
    ========================================
    MB      %       PID     process
    17.2    1.7     3113    confd.plx
    14.3    1.4     2981    confd.plx
    14.3    1.4     10850   confd.plx
    11.7    1.1     5141    snort_inline
    7.0     0.7     4166    mdw.plx
    6.1     0.6     3311    notifier.plx
    6.0     0.6     4228    selfmonng.plx
    5.5     0.5     4864    screenmgr.plx
    4.3     0.4     3096    aua.bin
    4.1     0.4     4210    selfmonng.plx
    2.3     0.2     4581    dns-resolver.pl
    2.1     0.2     3031    sysmond
    1.5     0.1     3012    confd-qrunner.p
    0.7     0.1     24680   acc-agent.plx
    0.4     0.0     3868    postgres
    0.3     0.0     2594    syslog-ng
    0.3     0.0     2181    udevd
    0.3     0.0     2595    syslog-ng
    0.3     0.0     6336    udevd
    0.3     0.0     2916    irqd
    0.2     0.0     4719    dhclient
    0.2     0.0     3866    postgres
    0.2     0.0     4778    sockd
    0.2     0.0     6335    udevd
    0.2     0.0     4480    DHCPC.sh
    0.2     0.0     2857    hald
    0.2     0.0     4777    sockd
    0.2     0.0     2879    hald-addon-inpu
    0.2     0.0     4779    sockd
    0.2     0.0     4773    sockd
    0.2     0.0     2897    hald-addon-acpi
    0.2     0.0     3355    rrdcached
    0.2     0.0     3869    postgres
    0.2     0.0     4776    sockd
    0.2     0.0     4780    sockd
    0.2     0.0     3870    postgres
    0.1     0.0     5173    postgres
    0.1     0.0     3863    postgres
    0.1     0.0     1       init
    0.1     0.0     11091   postgres
    0.1     0.0     4775    sockd
    0.1     0.0     3389    atd
    0.1     0.0     2936    haveged
    0.1     0.0     7772    postgres
    0.1     0.0     4252    mingetty
    0.1     0.0     4251    mingetty
    0.1     0.0     7771    postgres
    0.1     0.0     4920    postgres
    0.1     0.0     2626    dbus-daemon
    0.1     0.0     2858    hald-runner
    0.1     0.0     2611    acpid
    0.1     0.0     3865    postgres
    0.1     0.0     3867    postgres
    0.1     0.0     2895    hald-addon-stor
    0.1     0.0     4253    mingetty
    0.1     0.0     4254    mingetty
    0.1     0.0     3098    logger
  • running 9.1 on my machine and it's got 1.4 gigs cached and is now swapping at 10%..for some reason the kernel won't release file cache before swapping..[:(]


    Hey William,

    Cache represents data on disk that is currently in use by processes. If you're running IPS & local http cache easter egg, it wouldn't surprise me that your cache value is so high.

    Don't forget that Snort & http_proxy both have to query their respective DB's every time a connection is made through the UTM. So Linux, instead of reading from the disk everytime, is caching those signatures in memory so that access is faster. Whatever is less used is being pushed out to swap. So things like config info for DHCPd or dhclient (among others) that's less important get's pushed out.

    I'm not going to argue that high values of swap hurts performance, we both saw this in the 9.0 & 9.1 betas, but some swap is okay.


  • Hey William,

    Cache represents data on disk that is currently in use by processes. If you're running IPS & local http cache easter egg, it wouldn't surprise me that your cache value is so high.

    Don't forget that Snort & http_proxy both have to query their respective DB's every time a connection is made through the UTM. So Linux, instead of reading from the disk everytime, is caching those signatures in memory so that access is faster. Whatever is less used is being pushed out to swap. So things like config info for DHCPd or dhclient (among others) that's less important get's pushed out.

    I'm not going to argue that high values of swap hurts performance, we both saw this in the 9.0 & 9.1 betas, but some swap is okay.


    Well why have the issue is this is a machine with 5 users in four gigs RAM swapping 10 percent sure its minor but the swapping problems begin as minor and blew up I want about this before Aug v8.5 came out hey by said its minor it won't be a problem and it blew up in what is now exactly what I said it would do a machine with 1.5 gigs out of cash shouldn't be swapping at all there's no reason for it I run the machine was swap off for couple of days now with no ill effects is just Greeley hanging on to file CAS when should be given it up for next to 100 megs need to buy something else there's still a tuning problem grand I'm not a good will but I know enough to know when there's an issue or when its you its going to pop up a4 gig machine with 5 users should not swap at all which means for anybody running less RAM and or more users the swap issue is going to continue to be a problem
  • Hey William,

    Not to sound rude but could you reformat that last reply?[:S]
  • Hey William,

    Not to sound rude but could you reformat that last reply?[:S]


    No problem..voice dictation on phones isn't perfect will redo in a few
  • No problem..voice dictation on phones isn't perfect will redo in a few
    Ahhh.  I was wondering about that too.  Thx