Πώς αυξήθηκα από την ταχύτητα φορτίων των blog κατά 50% χρησιμοποιώντας YSlow

Ταχυδρομημένος στις 10 Αυγούστου 2007 στις 12:57 μ.μ.

Σιγουρευτείτε για να διαβάσετε άλλες θέσεις από τη σειρά FireFox YSlow!

  1. Χρήση YSlow Firefox πρόσθετο για να αναλύσει την απόδοση του ιστοχώρου σας
  2. Πώς αυξήθηκα από την ταχύτητα φορτίων των blog κατά 50% χρησιμοποιώντας YSlow

YSlow είναι ένα μεγάλο συντονίζοντας εργαλείο απόδοσης περιοχών που κάθε ιδιοκτήτης blogger και περιοχών πρέπει να χρησιμοποιήσει! Χρησιμοποιώντας YSlow, ήμουν σε θέση να έχω blog το φορτίο WordPress μου σχεδόν δύο φορές γρηγορότερα από πριν με την αλλαγή μερικών απλών πραγμάτων. Το WordPress μπορεί να μην έχει το βελτιστοποιημένο κώδικα στον κόσμο, αλλά οι περισσότεροι blogs τρέχουν αργό λόγω της έλλειψης κατανόησής τους αυτού που παίρνει για να κάνει ένα φορτίο ιστοχώρων γρήγορα.

Η απλή ουσία

Αρκετά κατά τρόπο ενδιαφέροντα, ήμουν σε θέση να δω το α βελτίωση 25% στο χρόνο φορτίων με να κάνει τα ακόλουθα πράγματα:

1. Αφαίρεση των στοιχείων πλαϊνών μπαρών - Η αφαίρεση blog των συνδέσμων καταλόγου από την πλαϊνή μπάρα μου και ο καθαρισμός του επάνω έτσι ώστε περιέχει μόνο ένα RSS προσυπογράφουν, σελίδες, κατηγορίες, αρχεία, και δύο συνδέσεις τρίτων, μια σε Technorati και μια για Spotplex. Πιό πρώτος είχα BlogTopList, BlogTopArea, και μερικών άλλο blog που ταξινομεί τα chicklets στην πλαϊνή μπάρα μου που προκαλούσαν σχεδόν 10 DNS ματιές κάθε φορά που φόρτωσε η πρώτη σελίδα.

Απομάκρυνα επίσης όλους τους ιχνηλάτες JavaScript όπως MyBlogLog, εκτός από Google Analytics. Δεν υπάρχει πραγματικά καμία ανάγκη χρησιμοποιώντας 5 διαφορετικές ακολουθώντας περιοχές, προκαλεί μόνο περισσότερες DNS ματιές. Όταν τρέχετε YSlow, ελέγξτε #9 για να δείτε πόσες DNS ματιές έχετε αυτήν την περίοδο.

2. Διαγράψτε άχρηστο Plugins - Απενεργοποιημένα άχρηστα plugins που πρόσθεταν μόνο περισσότερο κώδικα στη σελίδα ή την όχι πολύ χρήσιμη από άποψη παίρνοντας κυκλοφορία μου ή βοηθούσαν έναν αναγνώστη ενώ σε μια σελίδα. Παραδείγματος χάριν, χρησιμοποιούσα τον κώδικα FeedSmith FeedBurner για να προσθέσω ένα ηλεκτρονικό ταχυδρομείο αυτό, Digg αυτό, κ.λπ. στις θέσεις μου, αλλά έχω ήδη ShareThis που εγκαθίστανται και μερικές άλλες κοινωνικές bookmarking συνδέσεις στην κορυφή της σελίδας μου.

Επίσης, εγκατήστησα περισσότερη από μια επικόλληση plugin, που δεν βοηθούσε με κάθε τρόπο, το μείωσε έτσι κάτω απλά στις ετικέττες Technorati. Ένα άλλο πράγμα που έκανα που φάνηκε να βοηθά ήταν ΝΑ ΔΙΑΓΡΑΦΕΙ πραγματικά απενεργοποιημένη plugins από τον κατάλογο WP-περιεχομένου \ plugin. Δεν είμαι βέβαιος γιατί, αλλά αυτό βοήθησε κάπως επίσης!

Πιό ενδιαφέρουσα ουσία

Τα προαναφερθε'ντα βήματα είναι εύκολα και ένας πολύ γρήγορος τρόπος να χαμηλωθεί ο χρόνος φορτίων για ιστοσελίδας σας, αλλά υπάρχουν μερικά περισσότερα πράγματα ότι ήμουν σε θέση να κάνω αυτού που ενισχύθηκε ακόμα περισσότερους!

#6 on YSlow says that you should move scripts down to the bottom of a page rather than at the top because it holds up the rendering of the web page if they are in the HEAD section. I had no clue about this and had about 6 scripts that were in the head section. Moving the scripts down was not as simple as the other steps because you have to edit some of your plugins to have them write the “<script type=”text/javascript” src=…” in the footer section.

As a note, though, you will not have able to move ALL of your scripts down to the bottom because some will simply not work! Google Analytics, for example, will have to remain and I left my Subscribe Me in the HEAD also otherwise when you scroll over my Subscribe button instead of a list coming down, nothing would happen.

However, I was able to move my ShareThis, Subscribe Remind, and AJAX Edit Comments scripts to the bottom without any problems. Here’s how you can try moving your scripts to the footer:

1. Firstly, backup the original code or file for the plugin! If you mess it up, you’ll need to go back to the original!

2. Go to your Admin panel and click on Plugins. Find the plugin that YSlow is listing as an offender. Here is an example of mine currently:

3. Click on Edit to modify the plugin code. Now do a search in your browser for the phrase “wp_head“. wp_head is a hook that plugins can use to dump stuff into the HEAD section. Change wp_head to ‘wp_footer’ with the single quotes. Now your script code will be moved to the bottom. Sometimes you’ll see more than one wp_head in your plugin file, one for CSS and one for JS. Only change the JS line!

4. Save your file and test out what changes were made on the site. A few minor things changed on mine with the AJAX Edit Comments, but it was nothing major, just a smaller text box.

Shrink, Zip and Cache

Ok, so there are two more things that I did to get me to the 50% reduction in load time: got gzip to work with wp-cache and used JSMin to shrink the prototype.js file.

Getting gzip to work with WP-cache plugin takes a little more editing of your files, so again please make sure to backup everything in case it doesn’t work. Anyway, here’s the method I followed to update my wp-cache files. Remember, you should still keep gzip disabled in WordPress. Editing the wp-cache code makes the PLUGIN compress the JavaScript files, not WordPress. So keep gzip disabled in WordPress in order for it to work.

Lastly, point number 10 in YSlow is to have your JavaScript files Minified. This will basically remove all comments and extra line breaks, etc from the code making it much smaller, but impossible to read. To use JSMin, download it and copy it to the root of your C drive.

Copy down the JavaScript file you want to shrink and place it in the same directory as the JSMin executable. Go into DOS and CD into the directory with the files. Type jsmin <originalfilename.js >newfilename.js to convert the file.

Once the file is generated, copy it somewhere else, rename it to the original file name and replace it on your server. I was able to reduce my prototype.js file from 74KB to 54Kb using JSMin. Unfortunately, I’m still not sure how to move prototype.js to the bottom or if it’s even possible, but if you know, post a comment.

Conclusion

Even though my site has only a 62 when I run YSlow on it now, it’s far better than the 40 I was getting before I used it! If your WordPress blog or web site is running slow, get to working understanding the various issues involved in increasing site performance. Doing a few of these things might save you cash if you think you need a new host or dedicated hosting.

Now it’s time for me to figure out the expires header and etags, since I got F’s on both of those!

Technorati Tags: , , , , , ,

If you enjoyed this post, make sure you subscribe to my RSS feed!

» Filed Under Web Site Tips

Related Posts

2 Responses to “How I increased by blog’s load speed by 50% using YSlow”

    Pingbacks
  1. Wordpress Performance verbessern - Tipps und Tricks Says:

    […] Online-Tech-Tips […]

  2. Pingbacks
  3. 7 free SEO tools to analyze and optimize your website for speed and compatibility Says:

    […] to ensure the highest possible grade. I wrote two articles on YSlow, one about how it helped me reduce the load time of my site by 50% and another on how to setup YSlow. Make sure to read them and install Firefox just for this […]

Please post your comments/suggestions!