Slow Apache2

Discussion in 'Server Operation' started by cpq, Jun 1, 2012.

  1. cpq

    cpq New Member

    Hi all.

    I have made myself a hosting setup following : http://www.howtoforge.com/multiserv...se-servers-on-debian-squeeze-with-ispconfig-3

    Now I have a problem with Apache2.

    After a restart of Apache2 everything runs fast and nice but a couple of hours later it soooo long time to respond to http requests, after browsing a few sites it runs fast…??

    Any ideas?
    I have not change anything in any config files regarding php or Apache2

    Maby i need a cache plugin?
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Check the global apache log for errors, especially vlogger errors.
     
  3. cpq

    cpq New Member

    Where is they stored?
    Just to me sure...
     
  4. cpq

    cpq New Member

    Got it...
    /var/log/apache2/error.log

    Nothing besides:

    [Thu May 31 12:14:11 2012] [error] [client 212.37.xxx.xxx] File does not exist: /var/www/favicon.ico
    sh: /usr/sbin/sendmail: not found
    [Thu May 31 21:19:10 2012] [error] [client 66.249.xx.xx] File does not exist: /var/www/robots.txt
    [Thu May 31 22:45:03 2012] [error] [client 204.68.xxx.xxx] File does not exist: /var/www/user
    [Fri Jun 01 00:41:21 2012] [warn] child process 28477 still did not exit, sending a SIGTERM
    [Fri Jun 01 00:41:21 2012] [warn] child process 31973 still did not exit, sending a SIGTERM
    [Fri Jun 01 00:41:21 2012] [warn] child process 32178 still did not exit, sending a SIGTERM
    [Fri Jun 01 00:41:22 2012] [notice] caught SIGTERM, shutting down
    [Fri Jun 01 00:41:25 2012] [warn] RSA server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
    [Fri Jun 01 00:41:25 2012] [notice] suEXEC mechanism enabled (wrapper: /usr/lib/apache2/suexec)
    [Fri Jun 01 00:41:26 2012] [notice] Digest: generating secret for digest authentication ...
    [Fri Jun 01 00:41:26 2012] [notice] Digest: done
    [Fri Jun 01 00:41:28 2012] [warn] RSA server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
    [Fri Jun 01 00:41:28 2012] [notice] Apache/2.2.16 (Debian) DAV/2 mod_fcgid/2.3.6 PHP/5.3.3-7+squeeze9 with Suhosin-Patch mod_ruby/1.2.6 Ruby/1.8.7(2010-08-16) mod_ssl/2.2.16 OpenSSL/0.9.8o configured -- resuming normal operations
     
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    Thats ok so far.

    You should consider to install munin on your server o monitor all parameters to get an idea what is causing the slowdown.
     
  6. cpq

    cpq New Member

    Could it be something with the MySQL? is on a other server?
     
  7. cpq

    cpq New Member

    munin is installed and running...
     
  8. cpq

    cpq New Member

    Funny thing....
    After i installed munin it runs nice....???!!!!???
     
  9. cpq

    cpq New Member

    Well, tha wass a short pleasure.... :-(

    It´s the same, after some houers it uses several sek to load a page the first time, then it speeds up.

    Is there a good cache funktion i can use?
     
  10. falko

    falko Super Moderator Howtoforge Staff

    Try to fine-tune Apache (for example, decrease KeepALiveTimeout to something between 2 and 5 seconds): http://www.howtoforge.com/configuring_apache_for_maximum_performance

    Also, please use a PHP opcode cacher like Xcache or APC.

    If you web app supports it, you can use memcached and/or tmpfs ( http://www.howtoforge.com/storing-files-directories-in-memory-with-tmpfs ) to reduce disk I/O.

    You should also check if you can fine-tune/optimize MySQL (for example, reading InnoDB tables is much slower than MyISAM).
     
  11. cpq

    cpq New Member

    Hi Faco.

    I´ll try that.

    Allready installed APC cache a couple of dayes ago, still som lagging after som houers without trafic at the sites.
     
  12. falko

    falko Super Moderator Howtoforge Staff

    From my experience, Xcache seems to be working better than APC, so you might want to give Xcache a try.
     
  13. cpq

    cpq New Member

    ok, i´ll give it a go :)

    Thanks :-D
     
  14. cpq

    cpq New Member

    Im a bit confused about what to edit here, i have a web serevr with 2 Cores 4 Gb. memory and could easy increase that, i jus want the web server to run fast.. :)
    Most of the site runs wordpress or joomla.

    # Timeout: The number of seconds before receives and sends time out.
    #
    Timeout 300

    #
    # KeepAlive: Whether or not to allow persistent connections (more than
    # one request per connection). Set to "Off" to deactivate.
    #
    KeepAlive On

    #
    # MaxKeepAliveRequests: The maximum number of requests to allow
    # during a persistent connection. Set to 0 to allow an unlimited amount.
    # We recommend you leave this number high, for maximum performance.
    #
    MaxKeepAliveRequests 100

    #
    # KeepAliveTimeout: Number of seconds to wait for the next request from the
    # same client on the same connection.
    #
    KeepAliveTimeout 3

    ##
    ## Server-Pool Size Regulation (MPM specific)
    ##

    # prefork MPM
    # StartServers: number of server processes to start
    # MinSpareServers: minimum number of server processes which are kept spare
    # MaxSpareServers: maximum number of server processes which are kept spare
    # MaxClients: maximum number of server processes allowed to start
    # MaxRequestsPerChild: maximum number of requests a server process serves
    <IfModule mpm_prefork_module>
    StartServers 5
    MinSpareServers 5
    MaxSpareServers 10
    MaxClients 150
    MaxRequestsPerChild 0
    </IfModule>

    # worker MPM
    # StartServers: initial number of server processes to start
    # MaxClients: maximum number of simultaneous client connections
    # MinSpareThreads: minimum number of worker threads which are kept spare
    # MaxSpareThreads: maximum number of worker threads which are kept spare
    # ThreadLimit: ThreadsPerChild can be changed to this maximum value during a
    # graceful restart. ThreadLimit can only be changed by stopping
    # and starting Apache.
    # ThreadsPerChild: constant number of worker threads in each server process
    # MaxRequestsPerChild: maximum number of requests a server process serves
    <IfModule mpm_worker_module>
    StartServers 2
    MinSpareThreads 25
    MaxSpareThreads 75
    ThreadLimit 64
    ThreadsPerChild 25
    MaxClients 150
    MaxRequestsPerChild 0
    </IfModule>

    # event MPM
    # StartServers: initial number of server processes to start
    # MaxClients: maximum number of simultaneous client connections
    # MinSpareThreads: minimum number of worker threads which are kept spare
    # MaxSpareThreads: maximum number of worker threads which are kept spare
    # ThreadsPerChild: constant number of worker threads in each server process
    # MaxRequestsPerChild: maximum number of requests a server process serves
    <IfModule mpm_event_module>
    StartServers 2
    MaxClients 150
    MinSpareThreads 25
    MaxSpareThreads 75
    ThreadLimit 64
    ThreadsPerChild 25
    MaxRequestsPerChild 0
    </IfModule>
     
    Last edited: Jun 18, 2012
  15. falko

    falko Super Moderator Howtoforge Staff

    Looks good. I think you can increase MaxKeepAliveRequests to something like 10000 or 100000.
     
  16. cpq

    cpq New Member

    i have changed that, i´ll get back on the effect tomorrow:)
     

Share This Page