1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

What Should i place in httpd.conf to optimize apache for my server

Discussion in 'Apache' started by usman1986200, Jan 2, 2010.

  1. #1
    My server is

    Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz
    Ram: 4 GB
    100mb uplink

    Please tell me what kind of code should i place in httpd.conf file to optimize my server also what should i place in mysql file for my server

    right now i am using this code in httpd.conf

    Timeout 30
    KeepAlive On
    MaxKeepAliveRequests 200
    KeepAliveTimeout 4
    MinSpareServers 15
    MaxSpareServers 40
    StartServers 15
    MaxClients 300
    MaxRequestsPerChild 1000
    Code (markup):
    I am experiencing slow site opening with these settings please help.
     
    usman1986200, Jan 2, 2010 IP
  2. Ladadadada

    Ladadadada Peon

    Messages:
    382
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    0
    #2
    It is very unlikely that these settings have anything at all to do with your site being slow.

    Without any more information, the first suspect I would check is slow MySQL queries. If you have a MySQL slow log, look in that using the mysqldumpslow utility. If you have lots of slow queries then it's time to learn how to optimise SQL queries. It's possible that your queries are all waiting for locks. If you see a lot of lock time waiting in your slow log, consider switching to InnoDB.
    If you don't have a MySQL slow log then you should put this in your /etc/my.cnf:
    
    [mysqld]
    set-variable=long_query_time=2
    log-slow-queries=/var/log/mysql/log-slow-queries.log
    
    Code (markup):
    One thing you might find in your Apache conf that can slow your site down is reverse DNS lookups. Apache can look up the domain name for each and every client that hits your site so it can put those domains in the logs. Turn this off if it's on.

    PHP can also do requests over the internet. If you write something like:
    include("http://www.google.com");
    Code (markup):
    then every page request will need to do a Google request first, which will take a second or two.

    Even something like
    include("http://www.mysite.com/includes/bootstrap.php");
    Code (markup):
    can still take several seconds. Even though it's a site that's on the same server as it's running on, it will still need to do a DNS lookup and may end up sending the request out to the internet before it comes back in and hits your server.

    Using
    include("/var/www/includes/bootstrap.php");
    Code (markup):
    will be much faster.
     
    Ladadadada, Jan 3, 2010 IP