Optimize ISPC3 for low resource systems

Discussion in 'Installation/Configuration' started by schildhans, May 10, 2009.

  1. schildhans

    schildhans New Member

    Hi,

    I love your Software and it works great but now I have to optimize it
    for my low-resource VPS with 512MB Memory.
    I think for mySql I did the right thing with the following values:
    Code:
    #
    # * Fine Tuning
    #
    key_buffer = 1M
    max_allowed_packet = 8M
    thread_stack = 64K
    thread_cache_size = 8
    #max_connections = 100
    #table_cache = 64
    #thread_concurrency = 10
    #
    # * Query Cache Configuration
    #
    query_cache_limit = 1M
    query_cache_size = 8M
    
    i disabled also the myDNS and removed it from the startup scripts as I dont need it.
    With this modifications my system uses 360 MB memory (without apache started).
    When I start apache it uses 433 MB, which is also fine for me.
    But when I go to the loginpage of roundcube on my host it uses already 558MB, which is way to much for a single user accessing a single php script.
    When I log in it gets wors and the system uses 630MB Ram.
    How is this behaviour possible?
    The website in ISPC is set to use fast-cgi for php. I already
    tried to tweak apache2 to use less memory by setting
    Code:
    <IfModule mpm_prefork_module>
        StartServers         12
        MinSpareServers      12
        MaxSpareServers      24
        MaxClients          100
        MaxRequestsPerChild   0
    </IfModule>
    
    But I think there is something strange here.
    If I use apachebench to simulate 25 requests, I have to reboot the system because it can't allocate more memory. Even top on the shell gives a fork exception.
    The VPS is done with OpenVZ with 512Ram and 700 burstable, bt I can't use Swap space.

    Anybody an idea on how to configure apache so that it can handle actually more than one person?

    schildhans
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    First, this has nothing to do with ispconfig itself or that your system uses ispconfig.
    ISPConfig itself does not use any permanent resources on your system as it is no daemon.

    A VPS with only 512 MB RAM and without swap is a bit too low for a hosting and mail server.

    What <ou can try is to use this:

    <IfModule mpm_prefork_module>
    StartServers 5
    MinSpareServers 5
    MaxSpareServers 10
    MaxClients 100
    MaxRequestsPerChild 0
    </IfModule>

    and then remove all unneeded php modules and use mod_php instead of fcgi. You can also disable all apache modules that you dont then need like fcgi and suphp.
     
  3. schildhans

    schildhans New Member

    Hi,
    thanks for your reply. The settings for apache helped a little bit.
    Now I found out that amavis-new and spamd use much of my memory:
    Code:
    srv:~# python ps_mem.py 
     Private  +   Shared  =  RAM used	Program 
    
     84.0 KiB +  13.0 KiB =  97.0 KiB	logger
    128.0 KiB +  16.0 KiB = 144.0 KiB	portmap
    160.0 KiB +  37.0 KiB = 197.0 KiB	init
    228.0 KiB +  55.0 KiB = 283.0 KiB	cron
    376.0 KiB +  31.0 KiB = 407.0 KiB	famd
    388.0 KiB +  27.5 KiB = 415.5 KiB	pure-ftpd-mysql-virtualchroot
    336.0 KiB +  95.0 KiB = 431.0 KiB	pickup
    340.0 KiB +  94.0 KiB = 434.0 KiB	showq
    348.0 KiB + 100.0 KiB = 448.0 KiB	couriertcpd (4)
    396.0 KiB +  64.0 KiB = 460.0 KiB	courierlogger (5)
    380.0 KiB +  93.5 KiB = 473.5 KiB	master
    420.0 KiB +  83.5 KiB = 503.5 KiB	freshclam
    260.0 KiB + 247.5 KiB = 507.5 KiB	mysqld_safe
    500.0 KiB +  54.5 KiB = 554.5 KiB	ntpd
    556.0 KiB + 194.0 KiB = 750.0 KiB	qmgr
    552.0 KiB + 247.5 KiB = 799.5 KiB	bash
    748.0 KiB + 198.5 KiB = 946.5 KiB	tlsmgr
      1.1 MiB + 206.5 KiB =   1.3 MiB	vlogger
      1.2 MiB + 358.5 KiB =   1.5 MiB	sshd (2)
      1.5 MiB + 103.0 KiB =   1.6 MiB	proplay_resdaem
      1.3 MiB + 354.5 KiB =   1.7 MiB	smtpd
      1.7 MiB +  39.0 KiB =   1.7 MiB	syslog-ng
      1.5 MiB + 408.5 KiB =   1.9 MiB	saslauthd (5)
      1.4 MiB + 535.5 KiB =   1.9 MiB	authdaemond (6)
      2.1 MiB + 827.0 KiB =   2.9 MiB	imapd (10)
      2.7 MiB + 467.5 KiB =   3.2 MiB	fail2ban-server
      5.3 MiB + 839.0 KiB =   6.1 MiB	couriertls (10)
     19.2 MiB + 141.0 KiB =  19.4 MiB	mysqld
      4.9 MiB +  23.6 MiB =  28.5 MiB	spamd (3)
     54.5 MiB +   8.5 MiB =  63.1 MiB	apache2 (12)
    [B] 66.9 MiB +  79.0 KiB =  67.0 MiB	clamd
     64.9 MiB +  25.6 MiB =  90.6 MiB	amavisd-new (3)[/B]
    ---------------------------------
                            300.0 MiB
    =================================
    
     Private  +   Shared  =  RAM used	Program 
    
    
    After restarting amavisd freed about 40mb of my memory:
    Code:
    srv:~# python ps_mem.py 
     Private  +   Shared  =  RAM used	Program 
    
     84.0 KiB +  14.0 KiB =  98.0 KiB	logger
    128.0 KiB +  16.0 KiB = 144.0 KiB	portmap
    160.0 KiB +  37.0 KiB = 197.0 KiB	init
    228.0 KiB +  56.0 KiB = 284.0 KiB	cron
    256.0 KiB +  42.0 KiB = 298.0 KiB	freshclam
    376.0 KiB +  31.0 KiB = 407.0 KiB	famd
    388.0 KiB +  27.5 KiB = 415.5 KiB	pure-ftpd-mysql-virtualchroot
    336.0 KiB +  95.0 KiB = 431.0 KiB	pickup
    340.0 KiB +  94.0 KiB = 434.0 KiB	showq
    348.0 KiB + 100.0 KiB = 448.0 KiB	couriertcpd (4)
    396.0 KiB +  68.0 KiB = 464.0 KiB	courierlogger (5)
    380.0 KiB +  94.5 KiB = 474.5 KiB	master
    260.0 KiB + 247.5 KiB = 507.5 KiB	mysqld_safe
    500.0 KiB +  55.5 KiB = 555.5 KiB	ntpd
    556.0 KiB + 199.0 KiB = 755.0 KiB	qmgr
    560.0 KiB + 247.5 KiB = 807.5 KiB	bash
    752.0 KiB + 199.5 KiB = 951.5 KiB	tlsmgr
      1.1 MiB + 246.5 KiB =   1.3 MiB	vlogger
      1.2 MiB + 359.5 KiB =   1.5 MiB	sshd (2)
      1.5 MiB + 113.0 KiB =   1.6 MiB	proplay_resdaem
      1.3 MiB + 360.5 KiB =   1.7 MiB	smtpd
      1.7 MiB +  40.0 KiB =   1.7 MiB	syslog-ng
      1.5 MiB + 408.5 KiB =   1.9 MiB	saslauthd (5)
      1.4 MiB + 629.5 KiB =   2.0 MiB	authdaemond (6)
      2.1 MiB + 834.0 KiB =   2.9 MiB	imapd (10)
      2.7 MiB + 468.5 KiB =   3.2 MiB	fail2ban-server
      5.3 MiB + 839.0 KiB =   6.1 MiB	couriertls (10)
     19.2 MiB + 146.0 KiB =  19.4 MiB	mysqld
      4.9 MiB +  23.7 MiB =  28.7 MiB	spamd (3)
      8.1 MiB +  42.2 MiB =  50.3 MiB	amavisd-new (3)
     54.5 MiB +   8.6 MiB =  63.1 MiB	apache2 (12)
     66.2 MiB +  31.5 KiB =  66.2 MiB	clamd
    ---------------------------------
                            259.1 MiB
    =================================
    
     Private  +   Shared  =  RAM used	Program 
    
    Currently I have a cron running every day to restart amavis since searching the web I found out that amavisd seems to be known for its heavy memory usage and there is not much to tweak there.
    Is there a easy way to temporarly disable amavis & clam-av so that I can see how my mailsystem works without virus scanning. The only thing I need is spamassassin.
    Because for weeks now the clamav log did not show any viruses beeing catched.
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Spamassassin is part of amavisd, so if you disable amavisd you disable all spam and antivirus scanning.

    to disable amavisd, comment out the line:

    content_filter = amavis:[127.0.0.1]:10024

    in main.cf and then restart postfix.
     
  5. Sajid Unar

    Sajid Unar New Member

    Hello ,
    I have 2gb memory and followed perfect server tutorial , created 2 websites with no trafic but now server have only max 200 mb free of memory.
    Suggestions ?
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

Share This Page