Massive memory usage

Discussion in 'General' started by voltron81, Jul 14, 2010.

  1. voltron81

    voltron81 New Member

    Hi to everybody.
    I'm running 2 mailservers with ISPConfig 3.0.1.6, master-master replicated (master-master replication of mysql and /var/vmail with glusterfs).
    Yesterday one of the server crashed, without giving me even the possibility to enter in ssh. Luckly my server farm gave me the opportunity to enter with serial, and I saw some segmentation fault for clamd, but I was able to see just that error, because the server was not responding to commands.
    I'm checking the memory to see if it was an hardware fault.
    The other server is up and running. It is less powerfull that the other one (just 1 gb of ram). I can see that I've a massive usage of memory... and I'm just scare that probably the other server crashed for the same reason...
    From the server that is now running, I've this usage of memory:
    Code:
       PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
    2578 clamav    20   0  295m 168m 5596 S    0 17.3   0:16.85 clamd
    31677 amavis    20   0  202m  85m 4244 S    0  8.8   0:04.68 amavisd-new
    31743 amavis    20   0  200m  83m 4296 S    0  8.6   0:04.34 amavisd-new
     2144 amavis    20   0  196m  79m 2736 S    0  8.1   0:01.64 amavisd-new
     2204 mysql     20   0  230m  45m 6104 S    0  4.7   1:12.65 mysqld
     2272 root      20   0  103m  42m 2664 S    0  4.4   0:06.72 spamd
     2576 root      20   0  103m  40m  588 S    0  4.2   0:00.02 spamd
     2577 root      20   0  103m  40m  588 S    0  4.2   0:00.04 spamd
     9667 www-data  20   0  239m  20m 4800 S    0  2.2   0:00.48 apache2
    26938 www-data  20   0  239m  20m 4788 S    0  2.1   0:00.30 apache2
    27851 www-data  20   0  238m  20m 4816 S    0  2.1   0:01.06 apache2
     9665 www-data  20   0  236m  20m 4316 S    0  2.1   0:00.46 apache2
     9664 www-data  20   0  236m  19m 4272 S    0  2.0   0:00.26 apache2
    27855 www-data  20   0  236m  19m 4252 S    0  2.0   0:00.26 apache2
    27852 www-data  20   0  234m  17m 4072 S    0  1.8   0:00.24 apache2
     4339 root      20   0  227m  15m 7696 S    0  1.6   0:01.12 apache2
    27854 www-data  20   0  228m  12m 3640 S    0  1.3   0:00.14 apache2
     9663 www-data  20   0  227m  10m 2500 S    0  1.1   0:00.06 apache2
    31093 www-data  20   0  227m 9476 1444 S    0  1.0   0:00.00 apache2
     1825 root      20   0  179m 9236 1232 S    0  0.9  16:11.01 glusterfs
     9662 www-data  20   0  155m 7452  456 S    0  0.7   0:00.08 apache2
     9661 root      20   0 39092 6892 2740 S    0  0.7   0:00.20 vlogger
     3007 root      20   0 73356 6224 1984 S    0  0.6   0:10.83 fail2ban-server
    31613 postfix   20   0  103m 6024 4468 S    0  0.6   0:00.16 smtpd
    31598 postfix   20   0  103m 5816 4292 S    0  0.6   0:00.12 smtpd
    31629 postfix   20   0  103m 5812 4296 S    0  0.6   0:00.12 smtpd
     2749 root      20   0  184m 4584 1084 S    0  0.5  24:50.60 glusterfsd
     2684 clamav    20   0 42776 3884 2644 S    0  0.4   0:00.74 freshclam
    31910 postfix   20   0 56504 3456 2672 S    0  0.3   0:00.02 cleanup
    31904 postfix   20   0 52268 3224 2432 S    0  0.3   0:00.06 proxymap
    31903 postfix   20   0 52152 3204 2460 S    0  0.3   0:00.02 trivial-rewrite
     2969 postfix   20   0 41404 3180 2248 S    0  0.3   0:00.12 tlsmgr
     3183 root      20   0 66072 3144 2484 S    0  0.3   0:01.94 sshd
    31253 root      20   0 66068 3108 2468 S    0  0.3   0:00.32 sshd
    31915 postfix   20   0 56408 3044 2332 S    0  0.3   0:00.02 smtp
     2871 postfix   20   0 52056 2948 2272 S    0  0.3   0:00.92 qmgr
    31751 root      20   0 10828 2416 1052 T    0  0.2   0:00.00 nano
    31767 root      20   0 10828 2396 1036 T    0  0.2   0:00.00 nano
     2844 root      20   0 36840 2304 1804 S    1  0.2   0:06.36 master
     2970 postfix   20   0 38900 2288 1772 S    0  0.2   0:01.00 anvil
    31679 postfix   20   0 38900 2272 1788 S    0  0.2   0:00.00 pickup
    31999 postfix   20   0 38900 2264 1772 S    0  0.2   0:00.00 showq
     3112 vmail     20   0 22920 2060 1316 S    0  0.2   0:18.38 imapd
    
    As you can see, clamd is taking 17% of memory, even without usage of CPU.
    also Amavis is using quite a lot of memory. Is it normal that amavis is using 3 daemons?
    I saw before that the free memory is jumping from 10MB to 300MB...

    Is it normal?

    Michele
     
  2. damir

    damir New Member

    It's a little higher than mines. Do you have any heavy rules or lists that you have added lately?
     
  3. voltron81

    voltron81 New Member

    No, nothing
     
  4. damir

    damir New Member

    Maybe your traffic has increased, that can affect load. Have you seen any spikes in your graphs? Anything strange in log files?
     
  5. voltron81

    voltron81 New Member

    Well, the traffic is increased a lot because before all the traffic was shared between the 2 servers... yesterday one of the servers went down and now all the emails are managed from just one server.
    Anyway still sound strange to me that clamd is reserving all this memory...

    thanks
    Michele
     
  6. till

    till Super Moderator Howtoforge Staff

    In general, 1 GB of ram is very low for todays hardware. Especiall when you take in account that a GB of ram costs just a few euros. You should increase ram to 2 or 4 GB on that server.

    You should stop spamd daemon. Spamd is not used by ispconfig as the mail scanning is done with amavisd.

    Yes. You can set the number of daemons in the amavisd configuration file.
     
  7. damir

    damir New Member

    From my own experiences adding more memory will help the increased traffic. Monitor your traffic and try to fine tune your filter and rules.
     
  8. voltron81

    voltron81 New Member

    It was a kind of backup server... the other one, that now is crashed and it's under investigation, has got 2 gb.
    That is strange, because I was following the perfect server debian how-to... so I don't know then why spamd is up and running.


    Thanks
    Michele
     
  9. damir

    damir New Member

    In tutorial there is line with following packages
    Code:
    apt-get install amavisd-new [B]spamassassin[/B] clamav clamav-daemon zoo unzip bzip2 arj nomarch lzop cabextract apt-listchanges libnet-ldap-perl libauthen-sasl-perl clamav-docs daemon libio-string-perl libio-socket-ssl-perl libnet-ident-perl zip libnet-dns-perl
    As you see spamassassin is installed and run script starts spamd daemon.
     
  10. voltron81

    voltron81 New Member

    So why it's in the how-to if at the end ispconfig is not using it?
    Can I even remove it?

    Anyway the other server is up and running again... and also him have a very strange usage of memory...
    have a look here:
    Than few minutes later, the memory free was jumping to 1626024k free...

    Thanks
    Michele
     
    Last edited: Jul 14, 2010
  11. damir

    damir New Member

    I'm not sure if it safe to remove it, but to stop it should be safe. I let Till or someone else answer if it's safe to remove it.
     
  12. till

    till Super Moderator Howtoforge Staff

    If you would remove it then you would remove amavisd with it and if it would not be needed then it would not have been part of the perfect setup tutorial. So what I told you above is to stop it and not to remove it.
     
  13. voltron81

    voltron81 New Member

    So Till you mean just kill the PID related with spamd?
    Any idea why the free memory is jumping too much?
    Could it be the cause of the crash of yesterday in one of the server? (they was online working perfectly for like 8 months)

    Thanks
    Michele
     
  14. till

    till Super Moderator Howtoforge Staff

    No. On linux you stop software by using the start /stop script in /etc/init.d/
     
  15. voltron81

    voltron81 New Member

    ah ok so I'll use
    Code:
     /etc/init.d/spamassassin stop
    Let's see then if I've benefit on the RAM usage...
    Thanks
    Michele
     
  16. voltron81

    voltron81 New Member

    Hello,
    unfortunately also without the spamd process, the usage of memory is jumping, in both servers, really a lot.
    For example srv1 (4GB ram) is jumping from 1.8GB free to 30MB free... srv2 (1GB ram) is jumping from 500MB free to 20MB free...

    Any suggestion?

    Thanks
    Michele
     
  17. till

    till Super Moderator Howtoforge Staff

    Thats ok. The Linux kernel uses all free ram to cache harddisk requests. As long as your swap dont get filles 100%, then this is the normal and intended behaviour of the Linux kernel.
     
  18. voltron81

    voltron81 New Member

    Hi Till,
    thanks for your answer.

    I'm really happy to know that it's a normal behaviuor... :)

    Anyway I still don't know how was possible the crash of srv1 2 days ago... it was something related with the segmentation fault... I've run a test of the RAM, but it was fine, so it was not an hardware fault...
    :confused:
     
  19. damir

    damir New Member

    Do you have logs when the system crashed? They are usually zipped.
     
  20. voltron81

    voltron81 New Member

    yes, I saved all the /var/log folder... I'm having a look on it, but I can not find any error on it...
     

Share This Page