Today, almost everybody has a website. Many are run on a Webserver called Apache. It’s an amazing piece of software that is ironically free and incredibly secure (when configured properly).
There are plenty of content management and publishing tools out there as well. WordPress (my personal favorite), Drupal, Movable Type just to name a few. The problem is when you start to get the traffic and the content starts to grow, you’ll watch your website get slower and slower over time. This post aims to help people fix these issues.
There are two types of fixes; Hardware fixes and Software fixes. It is very common for an IT person to simply say, “We need more hardware”, when the answer isn’t always going to be a bigger server. There are a variety of software tuning strategies one should try before assuming you need to get a bigger server. This post will address both of these issues, but my concentration on this post will be the software fixes.
For the technically challenged, most content management systems (CMS) have plugins that are available and most definitely, you’ll want to leverage this functionality.
So let’s talk about how to take care of some of these issues:
1. Implement a caching system. The single most important thing one person can do to make their website faster. If you’re using WordPress, there are plenty of caching plugins. Test a few of them out and determine which one suits your needs the best.no
2. If you’re using apache, it too has a built in caching module. If you’re lucky enough to have plenty of RAM, I would suggest caching some or all of your website in memory. This is done through apache configuration.
3. Increase the number of processes and child processes. If you do this in your apache configuration, you’ll see an incredible speed increase.
4. Tune your database and content management system to hit the database less. Again, this is done through Apache and in some cases, it can easily be done with a plugin on your CMS.
5. Tune your database configuration. Again, this is an important step. All databases have a caching mechanism. It’s up to you to tune it properly as well as threads and maximum concurrent queries. The better the tuning, the faster your site. Remember, CMS systems are database backed. You want to hit the database as few times as possible.
6. Make sure your domain has a good DNS server that is fast. If it doesn’t, consider outsourcing your DNS to a provider that has an excellent system.
7. Split content into different places. For example, you can use Amazon’s S3 to serve up your images on your website. They’ve got the speed, they’ve got the bandwidth, and they’ve got the network infrastructure to do it right.
8. If you’re one of those incredibly lucky souls to get so much traffic you don’t know what to do with it, you’re at a new level. I would consider using a content delivery networks (CDN). Think of a CDN as a cache that has multiple locations throughout the world. When a visitor comes to your site, they will be redirected to the CDN server that is closest to them. This lowers latency, load, and most importantly, increases the user experience. 99% of the people out there will never need a CDN. If you’re serving up lots of videos or audio, you should consider it, but beyond that, a CDN would be used by the likes of companies like CNN, the NY Times, etc. You get the idea.
9. Examine your graphics formats. Make them smaller or use formats that are more efficient if you can. Smaller graphics = faster website load times.
Now, let’s talk about the simple hardware fixes:
1. Increase the RAM on your server. The more RAM you have, the less you swap in and out of disk. This is going to give you a significant improvement over what you had, but it may not help you out much if your software isn’t configured properly (See above).
2. Implement RAID. Again, you’ll need to pick the right RAID setup, but faster disk access = better performance.
3. Change your hard drive. In an ideal world, you would have an SSD drive. They’re insanely fast. If you can’t afford an SSD, consider some of the Hybrid drives out there these days. They are definitely better than just a plain old hard drive. If a hybrid drive is out of your price range, just look for a hard drive with better specifications than what you’re currently running. What you need to look at is seek time and random read write performance. Also, more heads and platters = better performance. So do your research.
Hard drives are funny things. Almost ridiculous in the way they work. Basically, the platters spin under the heads while the heads will scan for the data. If it finds it, then it will then serve it up. Don’t get me wrong, there are indexes that tell the heads approximately where the chunks to your file are, but for the most part, it’s a hit and miss process. (Unfortunately, the hard drive will miss the data more of the time than it hits it). This is why rotational speed is so important. A 10,000 RPM hard drive is a lot faster than a 5400 RPM hard drive, but most people will buy by price without looking at specifications. This leads to lost performance. You can still get a good hard drive within your budget if you just simply do a bit of research.
So there you have it. The basics of how to get your website performance increases. I’ll be writing an updated technical how-to on the tuning of the website soon.
In the meantime, this should point you in the proper direction.
I’ve written a guide for both the novice and expert alike to help tune your mysql server.
If you’re not technical enough to implement any of these things or just need them done properly and in a hurry, consider hiring me. I can do it for you!
3 thoughts on “Is your website slow? Fix It.”
You’re speaking Greek. No comprende. Can you explain some of these things, like how to do it?
I am working on a document that will explain all of the simple details.
Document is done. At least for the MySQL portion. Sorry it took so long. I wanted it to be complete.