clamv eat memory

Discussion in 'Server Operation' started by minttux, Mar 12, 2016.

  1. minttux

    minttux Member

    it's my memory on vps:
    Code:
    # free -m
                 total       used       free     shared    buffers     cached
    Mem:           987        829        158         12          3         76
    -/+ buffers/cache:        749        237
    Swap:         2859          4       2855
    
    and when i see in htop it shows:
    [​IMG]
    When i stop clamv and amavis then my memory comes to:
    Code:
    # free -m
                 total       used       free     shared    buffers     cached
    Mem:           987        390        597         12          4         83
    -/+ buffers/cache:        302        685
    Swap:         2859          4       2855
    
    is there any solution to optimize clamv?
    and why it runs two process (two 32%)
     
  2. ztk.me

    ztk.me Well-Known Member HowtoForge Supporter

    Do you by chance have many mails beeing processed? check your /var/log/mail.info or /var/log/maillog
    And indeed clamav can eat up lots of resources.

    You can decrease available clamav instances and decrease max attachment sizes and many other things BUT it's usually better to check what it is doing / why. If this is an unusual high resource usage, there could be something bad happening right now.
     
  3. minttux

    minttux Member

    Hi
    i check both log and it seems normal and one more thing and this is free -m now that most of it is cache:
    Code:
    # free -m
                 total       used       free     shared    buffers     cached
    Mem:           987        963         24          6          9        407
    -/+ buffers/cache:        546        441
    Swap:         2859        181       2678
    
    but clamv take two 32% of ram too:
    [​IMG]
     
  4. ztk.me

    ztk.me Well-Known Member HowtoForge Supporter

    Hmm for some reasone I've read high CPU usage aswell - probably it was a bit too late to operate for me :D
    However, clamav does need certain amount of memory and if you're limited to 1GB I assume you're on a small VPS - which often does not work very well together, especially under load.

    I don't think you could lower memory resource usage as it is now much but you can adjust your /etc/clamav/clamd.conf and disable sthings as you like which make clamav on your system kinda pointless.
    There's also a workaround out there to ulimit clamavs memory usage which will make clamav swap > low performance, but you want some free real memory?

    I'd suggest removing clamav from that installation, this machine seems not to be suitable for this task with ither proceses loaded,

    By the way: assuming it's a VPS and you have the option to upgrade memory, you have to check if you're in an OpenVZ containter and your /proc/user_beancounters are limiting your shared memory too much - it could kill your apps.
     

Share This Page