How to optimize a web page for faster and better experience

You may have noticed that most my webpage are loading bit faster. Here is what I did:


a) CSS code moved to its own file and included CSS at the top

b) Removed unnecessary (read as fancy web 2.0 stupid stuff) external javascript snippets

c) I’ve moved external javascript to bottom of page/template engine. For example google analytics JS code moved to bottom of webpage.

d) Turn on Apache gzip/mod_deflate compression

e) Turn on WordPress caching

f) Turn on php script caching (I’m using eAccelerator)

g) Tweak MySQL for optimization. Turn on query cache and other settings.

h) If possible switch to lighttpd or use squid / lighttpd as caching server for old good Apache.

If you have tons of cash to burn (assuming that your web app demands performance):

  • Consider using CDN (Content Delivery Network) such as Akamai or SAVVIS.
  • Server load balancing

However there are some external JS script snippets such as Google Adsense which slows down loading of a webpage. In few months I may roll out a new template and I will try to fix this issue 🙂

I’m interested to know what other people’s experiences with web page optimization. Feel free to share your tips.

🥺 Was this helpful? Please add a comment to show your appreciation or feedback.

nixCrat Tux Pixel Penguin
Hi! 🤠
I'm Vivek Gite, and I write about Linux, macOS, Unix, IT, programming, infosec, and open source. Subscribe to my RSS feed or email newsletter for updates.

3 comments… add one
  • Joao Inacio Mar 30, 2007 @ 21:28

    d, e, f, g, h are not exactly “web page” related, but still good tips.

    i would perhaps add:
    – tweak apache for the expected load/number of concurrent views.
    – tweak the Database (not MySQL)
    and last but not least – tweak the php code 8)

  • Nilesh Jan 14, 2008 @ 1:57

    Use the minimum of Server Side Language for displaying HTML. Using Templating engine like PSP for Python and Smarty for PHP helps somewhat. Server Side Language must be strictly used only for queries with the db. Unnecessary usage like displaying HTML from db, etc. should be avoided.

  • brian Apr 25, 2008 @ 0:21

    Put the slow loading javascript in an iframe and your page will load and the slow javascript can catch up later. 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre> for code samples. Your comment will appear only after approval by the site admin.