Results 1 to 14 of 14
  1. #1
    Join Date
    Sep 2005
    Posts
    480

    SPeeding up page loads - apache tweaks

    What sort of values inside http.conf can one change to speed up page loads. Tweaked something a while back and it helped a lot. Cannot remember for this new server. Any tips?

  2. #2
    Join Date
    Jun 2004
    Location
    Northwest Colorado
    Posts
    4,630
    I recommend the O'Reilly title, "Web Caching" as a must-have. Caching is the best thing you can do to speed up load times. It is also imperative to set a Content-Length header, otherwise HTTP servers use "chunked" Transfer-Coding, which defeats HTTP pipelining. Without pipelining, each element of the page loads one at a time. With pipelining, elements load simultaneously, in parallel. There are many other issues, i.e. the quality of the HTML code, which affect user-perceived performance. But even the best-designed HTML pages will have lousy performance when chunked, or if the data has to come from an origin server instead of the nearest shared cache.
    Eric J. Bowman, principal
    Bison Systems Corporation coming soon: a new sig!
    I'm just a poor, unfrozen caveman Webmaster. Your new 'standards' frighten, and confuse me...

  3. #3
    Join Date
    Sep 2005
    Posts
    480
    We run eaccelerator, is that good enough for caching? And how do we check if we have Content-Length header setup? More importantly, how do we set that up?

  4. #4
    Join Date
    May 2008
    Location
    Tampa, Florida
    Posts
    181
    this has my attention as i have been wondering the same thing actually
    Hostcrate.com - Shoutcast Streams & Web Hosting
    █ Custom Streams Available - Contact me - We're in Second Life Too!
    Real Quality - Real Support - Real Affordable since 2008!

  5. #5
    Join Date
    Jul 2005
    Location
    New Jersey, US
    Posts
    1,507
    There's several things that can be done to optimize apache, but you have to first analyze your traffic and set a realistic goal.

    Traffic varies and so does the optimization that is needed. There is no such thing as a one size fits all optimization. Whether you have large downloads, streaming, small graphics, big graphics, etc., will all determine what needs to be done.

    Also, disabling any unnecessary modules helps too. Modules like modsecurity or modevasive can be quite resource intensive under high traffic, even though they are good for security.

    You also have to set a realistic goal. If you have a p3 with 10million php/mysql hits per day, there is no optimization that will make it fly like a dualxeon. You should expect about 15% to 30% improvement on "average" for optimization. So for example, if your load is over 100 right now, it's unlikely that optimization will bring it down to 1.
    PlatinumServerManagement (also known as PSM)
    The OLDEST and LARGEST and MOST TRUSTED server management provider in the USA, with 15+ employees and growing!
    Providing quality support for OVER 18 years! Currently supporting over 3,000+ servers monthly!

    www.PlatinumServerManagement.com Proud member of the NJ BBB & Chamber of Commerce & Authorized cPanel Partner.

  6. #6
    Join Date
    Aug 2001
    Location
    Orange County, CA
    Posts
    532
    If you're hosting PHP files you could also enable the APC extension. It'll save a bit of work by caching the opcodes in memory from compiling the scripts. You can also enable it on a per-site basis if memory is an issue.
    Jeff Standen, Chief of R&D, WebGroup Media LLC. - LinkedIn
    Cerb is a fast and flexible web-based platform for business collaboration and automation. http://www.cerbweb.com/

  7. #7
    Join Date
    Jun 2004
    Location
    Northwest Colorado
    Posts
    4,630
    Quote Originally Posted by mealto View Post
    We run eaccelerator, is that good enough for caching? And how do we check if we have Content-Length header setup? More importantly, how do we set that up?
    That's a totally different type of caching -- eaccelerator and other alternatives cache compiled scripts, sessions and such. While these are a good idea, I was talking about HTTP caching. With eaccelerator, the compiled script is cached, but it still must execute on each request.

    Some PHP accelerators just save script output to disk as .html files and have Apache serve those like any other static file, others do both. Some people run squid cache in front of their PHP server as an application accelerator.

    If your application supports it, and you are sending Content-Length instead of using chunked encoding, then a certain percentage of requests for your content never reach your origin server -- no bandwidth or CPU resources required to serve those requests for you, less latency and better performance for your users.

    You need to be able to view HTTP headers from your web browser. Firefox has a Web Developer Toolbar. There are also plenty of products out there, ranging from free to something like www.httpwatch.com (which I use and recommend). There are plenty of other HTTP headers involved in caching, but before those mean anything you need to clear "chunked" from your response headers.

    http://www.mnot.net/cache_docs/

    I can't help you with setup, as it's been a long time since I've used Apache, sorry. But, that is why I recommended the book...

  8. #8
    Join Date
    Aug 2002
    Location
    Bharat
    Posts
    4,722
    You may also use http compression, mod_gzip or mod_deflate depending on the version of Apache you are using.
    Vinsar.Net - Quality Web Hosting at Economical Price on USA & European Servers
    Offering domains, shared, reseller & VPS hosting.
    Reliable Domain Reseller Account Resell Domains with Confidence

  9. #9
    I know you didn't ask for this but I will just add that if you want responsive page-loads you can maybe do much more with what and how is your "page" made at the core than settings on server level..

    Considering everywhere repeated YSlow and now even Google PageSpeed and common sense can bring you quite far..
    http://developer.yahoo.com/yslow/
    http://code.google.com/speed/

    The most important rule:
    Respond requests as fast as you can,
    Make as little requests as possible ( merge and mimify css, js , even smaller images if you go to extreme )

    One interesting note I need to reconfirm some day,.. few years ago at some project when we gzipped js as most recommend page became notably less responsive, just mimifying gave the best results.

  10. #10
    Join Date
    Jun 2004
    Location
    Northwest Colorado
    Posts
    4,630
    As to compressing output, if you're "chunked" then you'll be compressing each response on-the-fly, and this will consume quite a bit of resources while slowing things down. If you have caching set up, then go ahead and compress output, the theory being that bandwidth costs more $ than CPU. Since compression doesn't have to occur with every request, only the initial request is affected, and not by much with modern cpus.

  11. #11
    Join Date
    Apr 2005
    Posts
    1,711
    For database intensive pages, you could use Memcache/memcached, trading CPU/RAM for speed. Also, to speed along repititious requests, you could make use of mod_expires.
    Zach E. - Kualowww.kualo.com
    Shared Web Hosting, Reseller Hosting, Cloud VPS & Dedicated Servers
    UK: 0800 138 3235 ❘ USA: 1-800-995-8256

  12. #12
    BigBison: This info on chunked data is very interesting. I wasn't aware of this.

  13. #13
    Join Date
    May 2006
    Posts
    130
    Eaccelerator is not bad, gives a noticeable speed up on PHP script execution, Memcache is fantastic as a MySQL cache as well for repeat queries/slow queries.

    To work out what will really speed things up you need to analyse your application and see what is causing it to run slow. If your using OO PHP write a simple singleton/static logger class which records events + microtime throughout your app and outputs it at the end, this way you can quite accurately record time taken for queries/php code execution/template generation etc.

  14. #14
    Join Date
    Jun 2004
    Location
    Northwest Colorado
    Posts
    4,630
    You can also spend a bit of money for something like Resin Pro, which is a Java Servlet Container httpd with a native, threaded PHP implementation. The first time a script is called, it's compiled into a Java class, and executed as a threaded process which doesn't stop until the server is stopped. Unlike other solutions, this means multiple requests for the same script are handled by different threads of the same process, instead of each request being its own process that ends when the request is served. Makes a big difference on modern multi-core CPUs, as PHP isn't otherwise threaded.

    Resin Pro also integrates an HTTP cache. Instead of writing output to disk, all content is cached as HTTP output streams. You can fit an awful lot of website into a couple gigs of RAM, so why not just generate new content or updates once, and hold them in RAM? Makes for one helluva fast website, no Java knowledge required, but you can also call Java classes from PHP and vice-versa.

    You only need to cache MySQL output or compiled PHP scripts, if you need to lauch a new script process which hits MySQL for every request. Running PHP as a threaded process and using HTTP caching eliminates the need for memcached, eaccelerator, Zend and the rest, entirely. Anyway, Resin Pro is my recommended way of dealing with PHP these days, if nobody just guessed that.

Similar Threads

  1. Long Page Loads
    By kau_ in forum Hosting Security and Technology
    Replies: 1
    Last Post: 10-10-2007, 02:20 PM
  2. Apache Tweaks
    By priceww in forum Hosting Security and Technology
    Replies: 4
    Last Post: 01-16-2007, 12:40 AM
  3. What causes slow page loads?
    By PBFerrigan in forum Web Hosting
    Replies: 12
    Last Post: 11-14-2005, 03:32 AM
  4. Speeding up apache?
    By DeltaAnime in forum Dedicated Server
    Replies: 23
    Last Post: 08-22-2004, 02:53 AM
  5. php code for page loads
    By Ivan23 in forum Programming Discussion
    Replies: 3
    Last Post: 02-14-2003, 01:01 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •