29 Ways To Speed Up Your Website
There are so many reasons to make your website faster: Higher conversion rates, lower bandwidth costs and yes, higher rankings in organic search.
Frankly, I’m stunned how often web teams resist doing it.
Here’s a list from easy to not-so-easy, of 29 ways you can get things running faster on your website:
- Put your images on a separate domain. Services like Amazon S3 make this very easy. Open an S3 account. Point a subdomain like ‘blah.yoursite.com’ at the S3 storage. Put your images there. Web browsers can load from multiple domains simultaneously, creating the impression that your site is faster. Plus, you’ll use less of your own server’s bandwidth and CPU. Every little bit helps.
- Or, just put your images on Flickr and use them as your separate domain.
- Compress images using the right file type. Use ‘lossy’ compression—JPEG—for photos and images with lots of colors. Use ‘lossless’ compression—PNG and GIF—for line art and images with only a few colors.
- Resize images before you upload them. Don’t resize images using height and width! Resize them using Photoshop, or Fireworks, or whatever. Forcing people to download a 1,000-pixel-wide image to fill a 150-pixel-wide thumbnail is just cruel.
- Learn to write decent code. The average enterprise content management system (CMS) or shopping cart spits out nasty HTML code. Clean it the heck up. You are in charge, not the server. Any server can generate clean code with a little tweaking. So tweak.
- Put your CSS in separate .css files, not embedded in each page.
- Split up your CSS. Create one stylesheet that holds only styles used on every page of your site. Then create separate stylesheets for each unique page layout: Your home page, a typical article page, a typical product page, etc. Load only what you need on each page.
- Learn to use CSS. If you can use <p> instead of <font color=”blue” style=”font-size:10pt;font-weight:bold;”>, you’ll end up saving a lot of space. And, people like me won’t laugh at you.
- Chuck the Flash. Just do it. There are plenty of other ways to animate elements on the page. If you must use Flash, then use it only in small nuggets on the page.
- Set up GZIP compression on your web server.
- Minimize redirects. The statement ‘301 redirects are good for SEO’ does not mean ‘5 consecutive 301 redirects are better than 1’. Don’t use 301 redirects unless you have to. Fix before you redirect.
- Fix canonicalization issues. ‘Fix’ does not mean ‘use rel=canonical’. It means ‘make sure every page on your site has a single address’. That will improve caching performance, reduce memory usage and speed things up.
- Invest in decent hosting. If you’re hosting at JimmyBob’s House of Hosting for $5/month, don’t expect to break any speed records. Unless you’re a serious geek, you’ll want to spend money on a decent hosting setup. I’ve seen great performance out of some shared hosting packages (multiple sites per server). But for the fastest possible setup, you’ll want one or more dedicated servers.
- Set up caching on your server. If you’re using WordPress, use a plugin like W3 Total Cache. If you’re using another tool, learn it and its caching capabilities. Your server does include caching, or can. Unless you bought it from pygmies who used to work at the chocolate factory down the road.
- Go static. If you’re building your site on PHP, ASP or another scripting language, chances are all of your site pages are in PHP, ASP or the relevant language. Some pages, though, like ‘About us’ and ‘Privacy’, change so rarely that you can likely make them totally ‘static’ .html pages. By doing that, you eliminate one set of calls to your server’s CPU. That’s a small but instant performance gain.
- If you’re working in .NET, learn to compress the VIEWSTATE variable. That sucker takes up a lot of room in your code. Even better, get rid of the VIEWSTATEW variable until you need it.
- Correctly configure your server’s memory management. I won’t try to explain this. If it doesn’t make sense, hire someone, or talk to someone, or at least write down “I didn’t configure my server’s memory management.” That way, when your server starts crashing every time traffic exceeds 200 visitors, you can save the poor schmoe elected to fix the problem a lot of time.
- Put your database on a separate server. If you’ve got a busy site, then you need to put your website on one server and your database on another. Database transactions eat up a lot of server oomph. You want that happening away from your web server. Otherwise, you end with the web and database software in a tug of war for server resources.
- Learn to use JOINs. Say you’re programming a database-driven site. You need to display, I dunno, all products in 3 categories. You can either: a) Write a snarl of nested loops, thereby driving your server into a state of hysteria and causing local authorities to dump seawater on your hosting location; or b) Learn to use a SQL JOIN statement, and avoid all that hassle. JOINs are faster. If you use them right. Please.
- Learn to use stored procedures. More database Kung-Fooery. Learn it if you don’t know it. Stored procedures are compiled by the database server and run a lot faster than plain old SQL scripts.
- Don’t use SSL unless you have to. I’ve argued myself hoarse on this one. If you want to have some fun, come up to me at a party and ask about it. Then watch all the veins in my forehead bulge as I launch into a spittle-infused diatribe about SSL, CPU cycles and other geekery.
- If you’re on Apache, load only the modules you need. I know. Duh. But most folks leave the defaults set, and that may include modules you don’t need.
- If you’re on Apache, learn to use AllowOverride, when you really need DNS lookup, and other tips like FastCGI. Read this to learn all the nerdy goodness. Your server will thank you.
- If you’re on Internet Information Server (IIS), learn performance logging. Then learn your way through the fun, fun, world of IIS tuning. Actually, it’s not that bad. You can start with this Technet page. Just remember to check which IIS version you’re using.
- Learn to use a server accelerator like Squid, or to use Apache or nginx as a caching proxy. Caching proxies and accelerators are designed to do nothing but store your web server’s dynamic pages and deliver them, really quickly, to the public. We’ve seen sites perform up to 3x faster with a Squid server in place.
The list goes on. A site is never ‘fast enough’. What’s important is that you continuously make it faster. You’ll see better returns, happier visitors and higher rankings.
Opinions expressed in this article are those of the guest author and not necessarily Search Engine Land. Staff authors are listed here.