SitePoint Sponsor

User Tag List

Results 1 to 12 of 12
  1. #1
    SitePoint Addict Adam A Flynn's Avatar
    Join Date
    Jul 2004
    Location
    Canada
    Posts
    251
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Increasing Preformance

    Hi,

    I'm curious about how to increase Apache's preformance. I've got a few sites that I'm working on that are starting to get bigger, and, as they grow, they're also slowing down. What would you guys suggest to push every little bit out of Apache so that it can handle the sites without >1 minute page load times (PHP's only taking 0.1 seconds, and there's <100k in images)?

    My sites are on a dedicated server with a fair bit of RAM and a good proc. While I know they'll get slower as they grow, I really don't think they should be *this* slow.

    Thanks.

  2. #2
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,644
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    Adam,

    Your question is without necessary details so I must guess that you've got deeply nested subdirectories each with its own lengthy .htaccess ruleset. Since a simple request will not otherwise bother Apache, and this will (each request will require multiple reads and evaluations by Apache before it will serve a file), that "has" to be the first place to look for your slowdown.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  3. #3
    SitePoint Addict Adam A Flynn's Avatar
    Join Date
    Jul 2004
    Location
    Canada
    Posts
    251
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I do have a few sites with deep directory trees, however, most of my sites work off of a tree that only goes 1-2 directories deep, with no complex .htaccess files.

  4. #4
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,644
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    Adam,

    I think my first test would then be to turn off the images (in my browser) and try to download the same page. Compare the difference between the page with images and no images (some webmasters like to serve large images but constrain their display size but I don't think that's your problem from your description). I suspect it's either the images (are they protected against hotlinks?) or a bandwidth problem with your server.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  5. #5
    SitePoint Addict Adam A Flynn's Avatar
    Join Date
    Jul 2004
    Location
    Canada
    Posts
    251
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That didn't make a very big difference. I think the issue is with Apache delaying in serving the pages.

    What do you think?

  6. #6
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,644
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    Adam,

    I think something's causing an unreasonable delay but don't have a clue what it could be.

    Have you contacted your hosting company about that?

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  7. #7
    SitePoint Addict Adam A Flynn's Avatar
    Join Date
    Jul 2004
    Location
    Canada
    Posts
    251
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In general though, what kinds of things would you suggest for tweaking a server's configuration to handle larger loads of users? (I'm not so much trying to solve 1 specific problem as I am trying to better understand what kinds of things one should do to deal with servers that are getting overloaded and crashing.)

  8. #8
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,644
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    Adam,

    I'm much more of a coder than a server administrator so that's where I'd look (i.e., as much from ignorance as anything else).

    That said, there are sites I've created for clients using PHP that don't need to be dynamic. Those small sites get a script written for them to read the PHP-generated page and save as pure HTML - saving the server load of constantly regenerating static pages.

    If you're using a database, look at your querys as they might be loading the whole db with each script (hopefully, not more than once) while only a small portion of the db is required.

    Of course, there are still those who fill tables with transparent images - and suffer the consequences of long load times.

    Lastly, I do have my sites suffer a slightly longer load time on the first page to download the nav (js) and css files which are stored in cache - to be retrieved locally rather than downloaded in subsequent page requests.

    On the server side, I'd already mentioned the nesting .htaccess files in subdirectories (a no-no - unless absolutely necessary) so I won't repeat that.

    With that, I'm fresh outta the "top-of-the-head" ideas for you.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  9. #9
    SitePoint Addict Adam A Flynn's Avatar
    Join Date
    Jul 2004
    Location
    Canada
    Posts
    251
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Any idea who the apache gurus are on SitePoint?

  10. #10
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,644
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    Adam,

    pippo, the Administrator for this forum, is the guru I'm aware of (although others have shown MUCH knowledge with their posts). He's always ready with a complete answer - when he gets the time to stop in here. Have patience...

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  11. #11
    SitePoint Member
    Join Date
    Apr 2005
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by dklynn
    On the server side, I'd already mentioned the nesting .htaccess files in subdirectories (a no-no - unless absolutely necessary) so I won't repeat that.
    Can I just check what you mean by this? I have a directory like /htdocs/ which has an .HTACCESS file in. I also have a directory like /htdocs/myforum/ with another .HTACCESS file in - the content of which is different from the first.

    Are you saying that you don't need more than one .HTACCESS file and that all the 'coding' for all the files should be in the first and only file in /htdocs/?

  12. #12
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,644
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    tim,

    Well, almost. .htaccess (note the leading dot and lower case) files are like CASCADING Style Sheets as they are ALL checked by Apache as Apache goes through successive directories enroute to serving the requested file.

    My point was that you do NOT need to repeat code as you delve through the path. The root's .htaccess will ALWAYS be looked at, the first subdirectory's .htaccess is next and so on through your directory structure.

    That said, put ONLY sitewide directives in your root directory and be more specific as you delve deeper. That way, Apache won't have to evaluate all requests against, say, the list HTTP_REFERERs (hotlinks) you're banning from your images directory against the javascript requests in your scripts directory, css files in your css directory, etc.

    Does that clarify for you?

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator


Bookmarks

Posting Permissions

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