Hoher Speicherverbrauch VServer

phpman

Registered User
Hallo zusammen,

vorab sollte ich den falschen Bereich (VServer) erwischt haben bitte verschieben ! (Mod dann sorry!)

ich hab hier einen VServer (Vanager) mit 192MB RAM auf welchem

Debian 4 (Etch)
Apache
Postfix
IMAP
Postgrey
Amavis-new
Spamassassin
Confixx 3.3.1

laufen.

Seit ca. 2 Wochen steigt Postfix aus, da Ihm der Speicher fehlt sprich die 192MB (bzw. max zugesichert sind 512) nicht ausreichen.

Auszug aus top:

Code:
 7410 clamav    18   0 34092  30m  672 S    0  4.4   0:02.36 clamd
15801 root      16   0 31656  27m 2976 S    0  3.9   0:01.29 spamd
15802 root      16   0 31260  26m 2972 S    0  3.9   0:00.18 spamd
15743 root      16   0 27132  24m 2212 S    0  3.5   0:00.94 spamd
16069 amavis    16   0 28320  21m 2376 S    0  3.1   0:00.09 amavisd-new
 7379 amavis    16   0 27420  21m 2248 S    0  3.0   0:00.17 amavisd-new
27824 amavis    18   0 28188  20m 1756 S    0  3.0   0:00.00 amavisd-new
 9824 root      16   0 26964  10m 5976 S    0  1.5   0:00.22 apache2
 9873 www-data  15   0 27372 9412 4236 S    0  1.3   0:11.66 apache2
 7617 mysql     16   0 36376 9388 4532 S    0  1.3   0:03.61 mysqld
22044 www-data  16   0 27316 9344 4224 S    0  1.3   0:19.08 apache2
 9875 www-data  16   0 27296 9316 4216 S    0  1.3   0:12.82 apache2
30317 www-data  15   0 27288 9192 4100 S    0  1.3   0:05.90 apache2
 9874 www-data  16   0 27280 9176 4092 S    0  1.3   0:11.62 apache2
30261 www-data  17   0 27280 9164 4104 S    0  1.3   0:05.67 apache2
14291 www-data  16   0 27288 9160 4104 S    0  1.3   0:16.63 apache2
16017 postgrey  18   0 10456 7764 2384 S    0  1.1   0:00.01 postgrey
32267 postfix   16   0  6096 2492 2044 S    0  0.3   0:00.03 smtpd
 5508 root      16   0  7792 2344 1896 S    0  0.3   0:00.18 sshd
 5133 postfix   16   0  4756 1900 1576 S    0  0.3   0:00.00 trivial-rewrite
15780 postfix   15   0  4780 1720 1372 S    0  0.2   0:00.22 qmgr
 7392 root      16   0  4796 1708 1316 S    0  0.2   0:00.06 bash
25997 postfix   16   0  4744 1608 1300 S    0  0.2   0:00.01 pickup
28458 postfix   15   0  4744 1604 1292 S    0  0.2   0:00.00 anvil
15773 root      15   0  4736 1600 1288 S    0  0.2   0:00.57 master
11380 web3p2    15   0  4252 1484 1220 S    0  0.2   0:00.23 imapd
 9827 root      16   0  3200 1436 1180 S    0  0.2   0:00.05 pipelog.pl
 7569 root      20   0  2592 1312 1064 S    0  0.2   0:00.01 mysqld_safe
 7504 clamav    16   0  2916 1248 1004 S    0  0.2   0:00.11 freshclam
 5794 root      20   0  4408 1136  976 S    0  0.2   0:00.00 sh
27810 root      16   0  2160 1104  856 R    0  0.2   0:00.79 top
 8009 root      15   0  4848 1100  772 S    0  0.2   0:00.00 sshd
 7852 root      16   0  6212  988  688 S    0  0.1   0:00.00 saslauthd
 9777 root      16   0  3432  932  720 S    0  0.1   0:00.01 vsftpd
 5788 root      18   0  2468  872  664 S    0  0.1   0:00.00 cron
 9785 root      16   0  2128  868  688 S    0  0.1   0:00.01 cron
 7539 root      15   0  2064  660  492 S    0  0.1   0:00.01 authdaemond
 7540 root      15   0  2064  660  492 S    0  0.1   0:00.04 authdaemond
 7541 root      16   0  2064  660  492 S    0  0.1   0:00.04 authdaemond
    1 root      16   0  1864  636  540 S    0  0.1   0:00.05 init
 7513 root      16   0  1856  588  472 S    0  0.1   0:00.00 authdaemond
 7527 root      15   0  1772  576  492 S    0  0.1   0:00.02 couriertcpd
 7261 root      16   0  1552  556  456 S    0  0.1   0:00.80 syslogd
 7532 root      16   0  1772  520  436 S    0  0.1   0:00.03 couriertcpd
 7618 root      15   0  1476  496  432 S    0  0.1   0:00.00 logger
 7535 root      15   0  1664  468  396 S    0  0.1   0:00.04 courierlogger
 5801 root      18   0  3524  460  404 S    0  0.1   0:00.00 sleep
 7526 root      15   0  1668  396  320 S    0  0.1   0:00.02 courierlogger
 7512 root      15   0  1664  392  320 S    0  0.1   0:00.00 courierlogger
 7267 root      24   0  1496  376  308 S    0  0.1   0:00.00 klogd

komisch ist das zuvor alles einwandfrei gelaufen ist und es wurden auch keine zusatz Dienste mit installiert.

Kann ich irgwelche Dienste Optimieren damit Sie nicht soviel Speicher verbrauchen (Amavis / Spamd?)

Denn auch eine Testweise erhöhung auf 256MB / 768 zugesichert bläst sich schon auf 200MB Ram verbrauch auf.

Auf einem anderen Server wo Debian 3.1 drauf ist laufen die selben Dienste und es gibt keine Probleme.

Hoffe Ihr könnt mir weiterhelfen.

Vielen Dank im voraus.

Gruß, PHPman
 
Hallo,

das zeigt folgendes: (hab den server aber eben neu rebooten müssen)

Aktuelle Speichernutzung:
Momentan genutzt: 164.754 MB
Zugesichert: 256 MB
Maximal nutzbar: 768 MB

Code:
neptun:~# cat /proc/user_beancounters
Version: 2.5
       uid  resource           held    maxheld    barrier      limit    failcnt
       734: kmemsize        5463737    5746517   10288551   11317406       8640
            lockedpages           0          0        662        662          0
            privvmpages       42087      42247     178734     196608          0
            shmpages            782        782      70000      70000          0
            dummy                 0          0          0          0          0
            numproc              53         57        330        330          0
            physpages         30674      30795          0 2147483647          0
            vmguarpages           0          0      65536 2147483647          0
            oomguarpages      30674      30795      65536 2147483647          0
            numtcpsock           13         14        330        330          0
            numflock             15         15        528        580          0
            numpty                1          1         33         33          0
            numsiginfo            0          1       1024       1024          0
            tcpsndbuf        136020     144964    3171767    4523447          0
            tcprcvbuf        212992     229376    3171767    4523447          0
            othersockbuf     177992     178880    1585883    2937563          0
            dgramrcvbuf           0          0    1585883    1585883          0
            numothersock        121        121        330        330          0
            dcachesize       683784     693797    3041280    3132518          0
            numfile            2348       2432       5280       5280       5974
            dummy                 0          0          0          0          0
            dummy                 0          0          0          0          0
            dummy                 0          0          0          0          0
            numiptent            14         14         45         45          0

Hoffe Du kannst helfen!

Danke!

Gruß, PHPman
 
Bestätigt zumindest schon mal die Aussage von Postfix. Die Übertretungen halten sich aber für mein dafürhalten noch stark in Grenzen. Meine liegen irgendwo bei 25 Millionen und der Server läuft trotzdem rund *G*

[man]lsof[/man] könnte Dir gute Dienste erweisen bei der Identifikation der Speicherfressenden Dienste.
 
Prüfen ob Du wirklich ClamAV und Spamassassin brauchst, dann vielleicht noch die Authdaemons auf 3 runtersetzen. Je nach Zugriffen vl. auch die Apache Prozesse etwas zurückschrauben, zumindest bis alles rennt.

SpamD´s kannst Du per Configfile auch auf maxchild = 1 oder 2 setzen.

lg
Basti
 
Hallo,

ansich schon, da ich meine Emails mit Spamassassin filtern und mit clam av auf viren checken wollte.

(@huschi hab mich an dein howto gehalten was mach ich falsch ?)

Nur wie ich eben feststelle macht amavis nicht was es soll:

Code:
Nov  2 21:12:42 amavis[8046]: OS_Fingerprint code  NOT loaded
Nov  2 21:12:42 amavis[8046]: ANTI-VIRUS code      NOT loaded
Nov  2 21:12:42 amavis[8046]: ANTI-SPAM code       NOT loaded
Nov  2 21:12:42 amavis[8046]: ANTI-SPAM-SA code    NOT loaded
Nov  2 21:12:42 amavis[8046]: Unpackers code       loaded

die config in /etc/amavis/conf.d/15-av_scanners habe ich angepasst:

Code:
use strict;

##
## AV Scanners (Debian version)
##

@av_scanners = (

 ### http://www.clamav.net/
 ['ClamAV-clamd',
   \&ask_daemon, ["CONTSCAN {}\n", "/var/run/clamav/clamd.ctl"],
   qr/\bOK$/, qr/\bFOUND$/,
   qr/^.*?: (?!Infected Archive)(.*) FOUND$/ ],
 # NOTE: remember to add the clamav user to the amavis group, and
 # to properly set clamd to init supplementary groups
 # When running chrooted one may prefer: ["CONTSCAN {}\n","$MYHOME/clamd"],

 ### http://www.clamav.net/ and CPAN  (memory-hungry! clamd is preferred)
 ['Mail::ClamAV', \&ask_clamav, "*", [0], [1], qr/^INFECTED: (.+)/],

);


@av_scanners_backup = (

  ### http://www.clamav.net/   - backs up clamd or Mail::ClamAV
  ['ClamAV-clamscan', 'clamscan',
    "--stdout --disable-summary -r --tempdir=$TEMPBASE {}",
    [0], qr/:.*\sFOUND$/, qr/^.*?: (?!Infected Archive)(.*) FOUND$/ ],

  ### http://www.f-prot.com/   - backs up F-Prot Daemon
  ['FRISK F-Prot Antivirus', ['f-prot','f-prot.sh'],
    '-dumb -archive -packed {}', [0,8], [3,6],
    qr/Infection: (.+)/ ],

  ### http://www.trendmicro.com/   - backs up Trophie
  ['Trend Micro FileScanner', ['/etc/iscan/vscan','vscan'],
    '-za -a {}', [0], qr/Found virus/, qr/Found virus (.+) in/ ],

  ### http://www.sald.com/, http://drweb.imshop.de/   - backs up DrWebD
  ['drweb - DrWeb Antivirus',
    ['/usr/local/drweb/drweb', '/opt/drweb/drweb', 'drweb'],
    '-path={} -al -go -ot -cn -upn -ok-',
    [0,32], [1,9,33], qr' infected (?:with|by)(?: virus)? (.*)$'],

  ['KasperskyLab kavscanner', ['/opt/kav/bin/kavscanner','kavscanner'],
    '-i1 -xp {}', [0,10,15], [5,20,21,25],
    qr/(?:CURED|INFECTED|CUREFAILED|WARNING|SUSPICION) (.*)/ ,
    sub {chdir('/opt/kav/bin') or die "Can't chdir to kav: $!"},
    sub {chdir($TEMPBASE) or die "Can't chdir back to $TEMPBASE $!"},
  ],

nur scant er die Mails wohl nicht. Könnte hier auch das problem mit liegen wieso soviel Speicher weg geht?


Gruß, PHPman
 
Last edited by a moderator:
Nachtrag:

ich hab nun amavis-new gegen clamsmtp ersetzt, da ich davon ausgegangen bin, das dieser weniger Speicher verbraucht (beim start ca. 2MB) nun habe ich jedoch das phänomän, das sich der ClamAV Daemin (clamd bis auf 100MB Speicher verbrauch aufbläst nach ca. 1ner Stunde) und zum anderen das Clamsmtp von 2MB auf knapp bis zu 60MB aufblasen kann).

Beim Start des Systems sieht es so aus:

Code:
 8144 clamav    18   0 34064  30m  904 S  0.0  0.4   0:02.80 clamd
 9769 root      18   0 27928  24m 2044 S  0.0  0.3   0:00.44 spamd
 9792 root      18   0 27928  23m  620 S  0.0  0.3   0:00.00 spamd
 9798 root      16   0 19884 8144 5052 S  0.0  0.1   0:00.24 apache2
 8108 postgrey  18   0 10216 7396 2196 S  0.0  0.1   0:00.00 postgrey
 9810 www-data  16   0 19896 5316 2156 S  0.0  0.1   0:00.00 apache2
 9274 mysql     15   0 22416 4940 3020 S  0.0  0.1   0:00.14 mysqld
 9813 www-data  16   0 19884 4104 1000 S  0.0  0.0   0:00.00 apache2
 9814 www-data  20   0 19884 4088  984 S  0.0  0.0   0:00.00 apache2
13532 postfix   15   0  7016 2732 2212 S  0.0  0.0   0:00.03 smtpd
24394 root      16   0 16704 1968 1560 S  0.0  0.0   0:00.02 sshd
29942 root      16   0  2676 1436 1128 S  0.0  0.0   0:00.01 bash
 9799 root      18   0  3208 1320 1104 S  0.0  0.0   0:00.00 pipelog.pl
 8180 root      20   0  2596 1256 1036 S  0.0  0.0   0:00.01 mysqld_safe
 9445 root      16   0  3112 1232 1020 S  0.0  0.0   0:00.00 master
31938 postfix   17   0  3120 1224 1008 S  0.0  0.0   0:00.00 showq
 9451 postfix   18   0  3152 1208 1000 S  0.0  0.0   0:00.00 qmgr
 9778 nobody    15   0  4216 1188  568 S  0.0  0.0   0:00.00 proftpd
 9450 postfix   16   0  3120 1176  984 S  0.0  0.0   0:00.00 pickup
 3904 root      16   0  2164 1056  848 R  0.3  0.0   0:00.04 top
24417 root      19   0  2336  984  848 S  0.0  0.0   0:00.00 sh
 9475 root      18   0  6736  980  660 S  0.0  0.0   0:00.00 saslauthd
 9757 root      16   0  3664  972  696 S  0.0  0.0   0:00.00 sshd
 9786 root      16   0  1908  852  688 S  0.0  0.0   0:00.00 cron
24413 root      19   0  2200  816  636 S  0.0  0.0   0:00.00 cron
 8080 root      16   0  1672  584  484 S  0.0  0.0   0:00.00 syslogd
    1 root      16   0  1612  556  488 S  0.0  0.0   0:00.00 init
 8161 root      16   0  1652  540  468 S  0.0  0.0   0:00.00 inetd
24418 root      18   0  1884  528  440 S  0.0  0.0   0:00.00 sleep
 9275 root      16   0  1596  524  456 S  0.0  0.0   0:00.00 logger
 8155 clamsmtp  22   0  1936  412  304 S  0.0  0.0   0:00.00 clamsmtpd
 9781 daemon    23   0  1820  408  308 S  0.0  0.0   0:00.00 atd
 8086 root      23   0  1616  396  328 S  0.0  0.0   0:00.00 klogd

VPS Speichernutzung:
Momentan genutzt: 118.816 MB
Zugesichert: 196 MB
Maximal nutzbar: 588 MB

Kann ich irgendwie ClamAV einen max Speicher zuweisen oder dessen verbrauch beeinflussen? Und od. Kann ich evtl. den clamd / clamsmtpd in einem zyklus per cron neu starten um dessen verbrauch zu senken ?

Hoffe Ihr könnt mir hier ein paar tips geben.

Gruß, PHPman

P.S. Was setzt Ihr ein um die Mails zu scannen kein ClamAV was ist alternativ (free) und resourcen schonender?
 
Back
Top