Knowledgebase

tune httpd ?

Posted by ttgt, 04-02-2012, 04:44 AM
Hi, under whm => Apache Configuration >> Global Configuration, there are many options,do you have any suggestion to modify them to get better performance ? thanx

Posted by madaboutlinux, 04-02-2012, 05:17 AM
It depends on what you are hosting, the traffic to them, the resources each request use and the server resources. Also one time changes in these configuration doesn't help, you need to tweak them as changes happen to your websites/application, traffic etc. Keep particular things in mind though, if RAM usage is high, better turn off KeepAlive, if RAM usage is less, turn it ON to put less pressure on CPU. For medium traffic sites, set StartServers to 5 (or less), larger the number, large amount of resources will be reserved before they are actually used. Set TimeOut value to around 30 or 60.

Posted by ttgt, 04-02-2012, 05:49 AM
Hi,about KeepAlive,does it mean when visitor try to browse another page,if the time difference is less than timeout,the page loading will be quicker ? or ? thanx

Posted by ArturasLIX, 04-03-2012, 04:23 AM
KeepAlive means that client can send several requests through one tcp connection. In most cases such behavior speeds up Web servers work and decreases the load. Also don't forget to tune KeepAliveTimeout directive.

Posted by ttgt, 04-03-2012, 05:02 AM
Hi,does "Max Keep-Alive Requests" mean how much "Requests" each one connection can request within "Keep-Alive Timeout"? if yes,how much the value will be better ? if one page have 10 picture,will it mean 10 Requests for the browse? thanx

Posted by ArturasLIX, 04-03-2012, 05:20 AM
Yep, something like that. Max Keep Alive Requests means how many requests will be served until tcp connection will be closed. Keep Alive Timeout specifies timeout for request until connection will be closed. Don't set it to a high value.

Posted by MikeZavatta, 04-03-2012, 04:44 PM
When your browser requests a webpage, it creates a connection to the server and grabs the HTML code. It then reads through the HTML code and creates a connection for each element on the page that it has to retrieve (i.e. images, external CSS and JavaScript files). With KeepAlive off, each connection creates a new Apache process. Each connection is referred to as a "hit". One "visit" to a page on a site usually results in multiple "hits" to the server. When the KeepAlive option is enabled, Apache keeps the original connection open and allows the visitor's browser to retrieve multiple items through that connection. There's a "KeepAliveTimeout" setting that tells Apache how long to keep that connection open for.

Posted by ttgt, 04-03-2012, 07:08 PM
Hi,do do you mean KeepAlive off,one hit=one Apache process=one connection ,multiple hit=multiple Apache process=multiple connection, and KeepAlive on,multiple hit=multiple Apache process=one connection,correct ? thanx

Posted by MikeZavatta, 04-03-2012, 07:35 PM
For example, if your home page and three images on it with KeepAlive disabled each image would open a new connection. With KeepAlive enabled the connection will stay open and no other connection will be opened for a browser to retrieve all the images for your home page. For a more technical description from Apache you can view this page.

Posted by killed, 04-03-2012, 11:12 PM
With KeepAlive turn On, recommended timeout from 1 to 2 seconds for best performance

Posted by ttgt, 04-04-2012, 01:53 AM
Hi, 1. if enable KeepAlive and within KeepAliveTimeout,if there are 3 images,it will only use one connection,but 3 hit and 3 Apache process,correct ? 2. is cloudlinux's "Concurrent Connections" value the same as Apache connection ? 3. does cloudlinux's "Concurrent Connections" value mean the total Connections from different users with different service(ex:apache,ftp,mail,...) ? thanx

Posted by ttgt, 04-04-2012, 01:54 AM
really ? will it have any effect ? because i think user may stay on a page to browse and click next page after some seconds later. thanx

Posted by ArturasLIX, 04-04-2012, 01:57 AM
Yes, it will have effect, otherwise, in some cases, it's possible that you reach clients or connections limits due to timeouts and unreasonable connections holding.

Posted by ttgt, 04-04-2012, 02:01 AM
sure ? but is any way to check if 2 second is enough ? because i think most people will click next one after more than 2 seconds.thanx

Posted by ArturasLIX, 04-04-2012, 02:07 AM
Yes, I'm sure. And it's from experience, the bigger timeout, the bigger probability of wasting resources for only to keep connection for idle clients. There are some cases in which bigger timeouts are better, but not for highly loaded websites. How to check it? Perhaps you must check Apache status page, and look at the processes amount and their states. Last edited by ArturasLIX; 04-04-2012 at 02:19 AM.

Posted by Sys_Admin, 04-04-2012, 06:06 AM
KeepAlive provides long-lived HTTP sessions which allow multiple requests to be sent over the same TCP connection. In some cases this has been shown to result in an almost 50% speedup in latency times for HTML documents with many images, but having keepalive on is also a resource intensive setting. Here comes the big question: To KeepAlive or not to KeepAlive? Well the opinions are mixed here, some say to KeepAlive some say not to. KeepAlive off If you want to hear my option I would say NOT to KeepAlive if you are running a shared hosting business or if you want to get the most out of your hardware. You should KeepAlive only if the loading time of your pages is the most important factor in your business and you have the money to invest in a more powerful hardware. If you decide to KeepAlive I suggest you set MaxKeepAliveRequest low to something like 2 seconds.

Posted by Sys_Admin, 04-04-2012, 06:09 AM
Timeout is the amount of time Apache will wait for three things: the total amount of time it takes to receive a GET request, The amount of time between receipt of TCP packets on a POST or PUT request, the amount of time between ACKs on transmissions of TCP packets in responses. The default value is 300. You should set time to something lower. A setting of 50-100 is probably ok. This will also help in case of small DOS attacks like to ones targeting some phpBB forums. Do NOT set it any lower then 10 as your users will start having timeout problems.

Posted by ArturasLIX, 04-04-2012, 06:25 AM
Good knowledge of manuals. As for Apache's Timeout directive, values like 50-100 won't save you from DOS attack, furthermore the bigger values means that your servers will wait for abusing idle clients, like attacks where abuser opens connection and disappears so you will waste you resources to just hold useless processes. That's my opinion.

Posted by ttgt, 04-04-2012, 07:57 AM
Hi,do you mean "Max Keep-Alive Requests" or "Keep-Alive Timeout" or "Timeout" ? thanx



Was this answer helpful?

Add to Favourites Add to Favourites

Print this Article Print this Article

Also Read


Language:

Client Login

Email

Password

Remember Me

Search