Monday, 08 June 2015 22:48

Tightening the screws: is your site fast enough?

Written by 
Tightening the screws: is your site fast enough?

Building optimized sites has always been a major part of our strategy: they are easier to maintain, easier to upgrade, and they load more quickly.  I have never built a site using only Flash, and have always built sites using HTML-and-CSS based navigation menus.  They are search engine friendly and easy to expand or rearrange.

With that in mind, I have recently come up with a few other ways to speed things up.  A faster site will generally rank better in the search engines, plus it will have less people abandoning the site while waiting for it to load.

If you’d like me to review your website and test it using Google’s PageSpeed tool, just drop me an email.

 

a.  Compressed files (style sheets, scripts, images)

I recently found this nifty tool from Google called Pagespeed Insights - link:
https://developers.google.com/speed/pagespeed/insights/

This is a free tool that helps you with diagnosing slowly-loading pages.  If you’ve got images that need optimizing, it will tell you.  If your hosting server isn’t responding quickly, it will tell you.  If various settings like caching are not being utilized, it will tell you.  

One of the best things I’ve seen it do is it will generate a ZIP file containing your site’s images, CSS style sheets, and JavaScript files after Google automatically compresses them.

 

b.  HTACCESS & Caching

After going through Google’s suggestions for optimizing my site, it still didn’t seem fast enough.  My site doesn’t get hundreds of visitors per day, so I kept searching.  I found the following .htaccess file snippet on the Joomla Magazine website.  I did some quick before & after testing using Google’s Pagespeed Insights tool after adding this code to my site and my score went up by 10 points.  This code made my site seem snappy.  Win!

########## Begin - ETag Optimization
## This rule will create an ETag for files based only on the modification
## timestamp and their size. This works wonders if you are using rsync'ed
## servers, where the inode number of identical files differs.
## Note: It may cause problems on your server and you may need to remove it
FileETag MTime Size
########## End - ETag Optimization


########## Begin - Automatic compression of resources
# Compress text, html, javascript, css, xml, kudos to Komra.de
# May kill access to your site for old versions of Internet Explorer
# The server needs to be compiled with mod_deflate otherwise it will send HTTP 500 Error.
# mod_deflate is not available on Apache 1.x series. Can only be used with Apache 2.x server.
# AddOutputFilterByType is now deprecated by Apache. Use mod_filter in the future.
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript
########## Begin - Optimal default expiration time
## Note: this might cause problems and you might have to comment it out by
## placing a hash in front of this section's lines
<IfModule mod_expires.c>
# Enable expiration control
ExpiresActive On
 
# Default expiration: 1 hour after request
ExpiresDefault "now plus 1 hour"
 
# CSS and JS expiration: 1 week after request
ExpiresByType text/css "now plus 1 week"
ExpiresByType application/javascript "now plus 1 week"
ExpiresByType application/x-javascript "now plus 1 week"
 
# Image files expiration: 1 month after request
ExpiresByType image/bmp "now plus 1 month"
ExpiresByType image/gif "now plus 1 month"
ExpiresByType image/jpeg "now plus 1 month"
ExpiresByType image/jp2 "now plus 1 month"
ExpiresByType image/pipeg "now plus 1 month"
ExpiresByType image/png "now plus 1 month"
ExpiresByType image/svg+xml "now plus 1 month"
ExpiresByType image/tiff "now plus 1 month"
ExpiresByType image/vnd.microsoft.icon "now plus 1 month"
ExpiresByType image/x-icon "now plus 1 month"
ExpiresByType image/ico "now plus 1 month"
ExpiresByType image/icon "now plus 1 month"
ExpiresByType text/ico "now plus 1 month"
ExpiresByType application/ico "now plus 1 month"
ExpiresByType image/vnd.wap.wbmp "now plus 1 month"
ExpiresByType application/vnd.wap.wbxml "now plus 1 month"
ExpiresByType application/smil "now plus 1 month"
 
# Audio files expiration: 1 month after request
ExpiresByType audio/basic "now plus 1 month"
ExpiresByType audio/mid "now plus 1 month"
ExpiresByType audio/midi "now plus 1 month"
ExpiresByType audio/mpeg "now plus 1 month"
ExpiresByType audio/x-aiff "now plus 1 month"
ExpiresByType audio/x-mpegurl "now plus 1 month"
ExpiresByType audio/x-pn-realaudio "now plus 1 month"
ExpiresByType audio/x-wav "now plus 1 month"
 
# Movie files expiration: 1 month after request
ExpiresByType application/x-shockwave-flash "now plus 1 month"
ExpiresByType x-world/x-vrml "now plus 1 month"
ExpiresByType video/x-msvideo "now plus 1 month"
ExpiresByType video/mpeg "now plus 1 month"
ExpiresByType video/mp4 "now plus 1 month"
ExpiresByType video/quicktime "now plus 1 month"
ExpiresByType video/x-la-asf "now plus 1 month"
ExpiresByType video/x-ms-asf "now plus 1 month"
</IfModule>
########## End - Optimal expiration time

########## End - Automatic compression of resources

 

c.  VPS / Dedicated Hosting

The above points are all achievable using standard, inexpensive, “shared” hosting plans.  They are suitable for low traffic sites.  They could even allow your low-to-medium traffic site to remain on a shared hosting plan, meaning you don’t need to upgrade to a VPS or dedicated server.  In the event that your site does have a high amount of traffic, or if the above steps aren’t sufficient in speeding up your site, an upgrade to a beefier hosting plan may be in order.  My suggestion is to try accessing your site from a variety of locations (e.g. your neighbor’s house, the coffee shop in town, etc) before upgrading, this way you’re certain that it’s not a connection issue that needs to be addressed between your home or office and your ISP (e.g. Comcast, Verizon, Time Warner, Google Fiber).

 

Read 4580 times Last modified on Tuesday, 10 July 2018 15:11

2 comments

  • Comment Link Nate Monday, 23 November 2015 14:36 posted by Nate

    I'm using InMotion Hosting. There is a(n affiliate) link in the footer of this site to them.

  • Comment Link Branden Thursday, 19 November 2015 12:17 posted by Branden

    Howdy would you mind letting me know which web host you're using?

    I've loaded your blog in 3 completely different browsers and I must say this blog loads a lot faster then most.

    Can you suggest a good hosting provider at a reasonable price?
    Thanks a lot, I appreciate it!

Leave a comment

Make sure you enter all the required information, indicated by an asterisk (*). HTML code is not allowed.