How can I optimize my website to download faster?

I am designing a website and some pages take way too long to load. Especially since I am expecting high traffic rates and I know that my website would slow to a crawl if it was getting a couple hundred hits a day.

I know about using CSS instead of HTML to load images, and I know about making CSS files as small as possible, but that hardly makes it faster.

Also, which is the fastest way to display identical content on several pages? IFRAME, or PHP Include statement?

klcargile2008-09-03T13:21:58Z

Favorite Answer

Exactly how to optimize your website depends largely on what it's doing, though there are some generally accepted guidelines. If you expect that only a few hundred hits a day will bring your site to its knees, you've got some work ahead of you.

Keep in mind that a website that contains dynamic content will always be slower than static HTML content. The difference is pretty trivial these days, though for a large, resource intensive application, it can become quickly noticeable.

That said, unless you're working with obscenely massive CSS files, you won't realize much difference by reducing their size. Also keep in mind that the main benefit to server-side-includes (PHP or otherwise) is reusability, not performance. I typically avoid the IFRAME construct, unless there is a highly compelling reason to use it (displaying external content that is unavailable via any other transport, for example).

So, what are your options? There are a few:

1. Choose your hosting provider wisely. This may seem like a no-brainer, but may people skimp here, which can only hurt you. That doesn't mean that you have to pay an arm and a leg for a shared hosting account, but the old adage of "you get what you pay for" still applies. A well designed, reliable hosting infrastructure can make all the difference in the world.

2. As previously mentioned, optimize images used on the site. Images used on a website should be 72dpi, and -- in most circumstances -- don't need to be maximum quality.

3. Limit the number of other large, binary resources displayed on each page. If you're loading several large images, Flash movies, etc,. it's going to have a negative impact for users on all but the fastest connections.

4. Implement caching for infrequently changing dynamic content and/or expensive resources. Say, for example, you have a web page that accesses a web service to display stock information to the user. Accessing an external web service is typically an "expensive" operation in terms of performance. And since most financial feeds are delayed by 15 minutes anyways, it doesn't make sense to query the service every time a user hits the page. Depending on your specific application, you may or may not be able to cache your data, but I have built applications that keep information cached in memory for a month or more.

5. Limit round trips to the database. Database access (and especially transactional writes) are one of the most expensive operations you can perform. Access your database only when absolutely necessary (see #4 above), Don't reload rows from the database on postback unless they've changed. When possible, spawn a separate worker thread or use AJAX to interact with the database so that the user is less aware of the latency.

6. Avoid direct file system access in your scripts. File system access is notoriously slow. Avoid interacting with the web server file system whenever you can, and when you can't, use worker threads, message queuing, AJAX, or other tricks to make such operations (appear) as asynchronous as possible.

Hope this helps, and good luck with your website!


||| Kristopher Cargile
||| www.bettersoftwarenow.com

?2015-01-04T20:50:33Z

Away from site optimization is definitely something that identifying along with fixing SEO position and indexing complications. CMS for the web-site, basic keyword investigate before writing written content, tags, meta tags and page brief description etc are done at this point. SEO web traffic has got seasoned staff who also excelled in these two levels of optimization plus design your site with an easily searchable method.

Anonymous2008-09-01T14:57:46Z

Use SSI (Server Side Includes) identical on every page. Especially if you plan to add/delete the content like nav links.

Optimize all images to web standards.

Don't use a lot of animation or sound files.

More tips:
http://www.rubyrobot.org/article/5-tips-for-faster-loading-web-sites

Ron

Jessica2015-01-03T12:39:37Z

You ought to consider some uncomplicated algorithms which, when observed and entirely commited in designing of any website with placement of various critical metatags that can surely acquire a high search engine existence and increase Online traffic to your website. Those metatag strategies work efficiently with published web sites at Google and Yahoo.

Trey2015-01-04T20:59:58Z

If this sounds a personal blog, We've never quite understood how ordinary people find a way to think that their weblog would be of interest into the worldwide Internet area for people to wish to search for it. It is only celebrity blogs which attract worldwide or even just national attention together with interest

Show more answers (3)