Page 1 of 1

Website speed optimization techniques

Posted: Wed Aug 18, 2004 11:36 pm
by voltrader
What are the main ways to speed up a website?

I'm on a shared server and I notice it slowing to a crawl tonight. I don't have that much traffic as the site is not public, but each page is roughly 100k in size.

Would moving to a dedicated box be the #1 speed improvement option?

Any other techniques I should try?

Posted: Wed Aug 18, 2004 11:57 pm
by feyd
with that size pages.. it'd be best to have a dedicated server.. although working as hard as possible to shave down that size to.. 40K or better yet, 15K, would also help heaps.

Posted: Thu Aug 19, 2004 6:24 am
by Buddha443556
Going dedicated will help if your on a typical shared host. On a dedicated server there are a number of things you can do to improve preformance too. Most shared hosts are still using MySQL 3.x if you install MySQL 4.01 or better you can use the query caching feature. You will also be able to install a PHP byte code cache like APC. These should help.

Check out some of the slide show here (ONLY visit with Mozilla they don't like IE) http://talks.php.net/index.php/PHP .

However, if you follow Feyd's advice you may not even need a dedicated server.

Posted: Thu Aug 19, 2004 10:49 am
by voltrader
Thanks for suggestions. Much appreciated.

Posted: Thu Aug 19, 2004 2:22 pm
by voltrader
As a first step, I eliminated superfluous comments and whitespace in header, home and footer html and that reduced load times by 20%!

The downside is that the script is now illegible, so I'll have to remember to keep a copy for editing.

I'm sure most of you have used this before, but the web page analyzer at http://www.websiteoptimization.com is quite useful.

Posted: Thu Aug 19, 2004 2:32 pm
by feyd
the size of the script shouldn't matter as much as the html it's generating.. so I'm hoping that's what you meant.. :) Unless your script includes hundreds of files, the script itself shouldn't take long to run.. it'd be more with the server having a coffee stiring straw for bandwidth... of course, if the script is running lots of repeated operations, then that could use some optimization as well. :)

Posted: Thu Aug 19, 2004 2:44 pm
by voltrader
IC... perhaps the figures indicating improvement are a mirage :(

This seems to be one of the slowest algorithms in my script. It's called the great circle calculation, which I use to find zipcodes within a circumference. Has anyone used a faster method?

My query is as follows:

їcode]
" $earthmiles * ATAN(SQRT(1-POW((sin($radlat1)*sin(latitude/$radfactor) + (cos($radlat1)*cos(latitude/$radfactor)*cos((longitude/$radfactor)-$radlong1))) , 2))/
(sin($radlat1)*sin(latitude/$radfactor) + (cos($radlat1)*cos(latitude/$radfactor)*cos((longitude/$radfactor)-$radlong1)))) ";ї/code]

where
їcode]
$radfactor=180/pi;

$earthmiles=3963;

$radlat1=$latitude/$radfactor;

$radlong1=$longitude/$radfactor;ї/code]