Webpage fast loading

We plan to create a new website. Our goal is to load web pages quickly. What are all the methods that we must follow.

Someone can give me good suggestions, links to forums or articles.

Our platform is PHP, MySQL, Javascript and AJAX.

+6
javascript ajax php mysql
source share
13 answers

One of the best guides to speed up loading your site:

http://developer.yahoo.com/performance/rules.html


Update: Google now has a great guide.

http://code.google.com/speed/page-speed/docs/rules_intro.html

Along with an even better addon for Firefox . In my testing so far, the Google Page Speed ​​addon is much higher than YSlow. It provides much more detailed analysis and more reasonable advice (instead of recommending CDN for small sites like YSlow)

+19
source share

One useful tool is YSlow , which is a Yahoo tool that helps identify web page performance issues. Also, good best practices to speed up your website .

However, see Jeff's blog entry. Problems with Yahoo are not your concerns for some perspective on this issue.

+15
source share

Caching Caching Caching.

memcached

APC

Choose one, use it. No need to retrieve everything from the database, which speeds up the work.

+5
source share
  • Use CSS sprites to save your HTTP request request.
  • Make sure all your images are a decent size.
  • Make sure you have a really good host with good upstream and downstream.
  • Make sure your server can execute your scripts well in advance; you can check this using the microtime function.
  • Make sure your code is optimized correctly.
+3
source share

1) mod_gzip / mod_deflate! This is such an easy solution. I am surprised that it is not enabled by default.

2) Play with tricks with your URL so you can convince browsers to cache your JS and CSS files forever. In other words, create a URL that looks like this:

http://www.yourdomain.com/js/mad_scriptz-v123.js 

Then use mod_rewrite and cross out "-v123":

 <IfModule mod_rewrite.c> # http://www.thinkvitamin.com/features/webapps/serving-javascript-fast RewriteEngine on RewriteRule ^/(.*)\-v[0-9.]+\.(css|js|gif|png|jpg|xap)$ /$1.$2 [L] </IfModule> 

Now apache will look for "/js/mad_scriptz.js" ... Each time you change static content, just increase the version number to force browsers to reload the content. Usually I have a template variable containing the global version number to which everything is bound. Not the most effective, but it works for my purposes. If you can link the version number to your build system or file hash, that would be really nice.

Get mod_expires, so all your static things expire in a few years:

 <IfModule mod_expires.c> ExpiresActive On # all in seconds... ExpiresByType image/x-icon A2592000 ExpiresByType image/gif A2592000 ExpiresByType image/jpeg A2592000 ExpiresByType image/png A2592000 ExpiresByType application/javascript A2592000 ExpiresByType application/x-javascript A2592000 ExpiresByType application/x-shockwave-flash A2592000 ExpiresByType application/pdf A2592000 ExpiresByType text/css A2592000 ExpiresByType application/rdf+xml A1800 </IfModule> 

Update: It has been noted that not all browsers or search engines like gzip'd. Do not blindly turn it on, as I suggest above. Make sure you don't download gzip antivirus browsers even if they accept it (some of them will get pissy with javascript compressed). The documentation for mod_gzip and mod_deflate both have examples that should work fine (I assume they do this, or people would email them with the changes :-).

I should also mention that my experience is that if you have a reverse proxy between Apache servers and mod_gzip'd servers, you need to follow. Squid 2.6 often tricks Apache, rather than gziping, when it should and worse, it caches uncompressed versions and passes them to browsers that can handle gzip'd content. Dunno, if 3.0 fixes this, and I don’t know, there is something wrong with my configuration (doubt it). Just watch out for :-)

That said. Turn it on. Seriously: -)

+3
source share

Write as little code as possible, but not too little.

Less code, less to compile, less to send, less to receive, less to process, less to display.

+2
source share

Use the profiler for PHP to make sure your code runs at a decent speed. Refactor (if possible) if performance can be improved.

+1
source share

Some random points.

Render gradually, and not build it in memory and send it at the end, gives a clear idea of ​​speed.

There are several advanced caching tricks that you can do, such as forwarded cache (this is what Akamai does on a large scale) and separation of static and dynamic content.

With PHP, especially, be careful when copying huge amounts of data. PHP 4 was known for “copying by default,” but it is still too easy to get a huge amount of data to work with PHP 5. In other words: do not copy (or do not create!) Strings, arrays, and objects are optional; work with them in place and pass links instead.

+1
source share

Compressing all your files, including css and js files also compresses your php files. Make as few database queries as possible, and as stated earlier, cache all returned data.

+1
source share

Yahoo: "Put styles at the top," "Put scripts at the bottom."

This has accelerated my recent site more than any other optimizations.

+1
source share

in addition to what was said:

  • obfuscate and compress your css
  • obfuscate and compress your javascript
  • fewer files == less http requests == fast site == puts all your css in one file, puts all your javascript in one file
0
source share

Here's one tip that I always find helpful: If you have a lot of tiny images, put them all in one tiled image. In your CSS declarations, control the viewport of the html element by controlling the x and y coordinates of the background:

 .icon { background-image:url(static/images/icons.png); height:36px; width:36px; } .food { background-position:-52px -8px; } .icon_default { background-position:-184px -96px; } 

A tile can be executed in a Python script or manually if you have a managed set.

Gmail does this as well. See: http://mail.google.com/mail/images/2/5/greensky/icons7.png

0
source share

A project that helps with a few points at Yahoo! ( http://developer.yahoo.com/performance/rules.html ) Minify that uses minimization, bundling, and conditional HTTP services in the same space, used with good design methods, can significantly reduce page load, especially user interface (which differs from the actual page load time).

0
source share

All Articles