When it’s time to choose a hosting company and a hosting package do you consider the specs of the server? How do you decide how many GHz of clock speed in a CPU is enough and how do you choose much RAM you need. What should you look for when it comes to server disk space?
Last week I picked up on an on-going series I began last year about website performance and I said this part of the series will focus on the third step in the critical path, server resources.
Today I want to walk through some of the basic hardware of every computer, include web servers. I want to talk about CPUs, RAM, and reading from and writing to storage (I/O) as each relates to the performance of your website.
As I said last week, you’ll generally get better and more performant hardware, the more you’re able and willing to spend, but odds are how much you can spend is the fixed constraint. Hopefully, this post will help you decide how to get the most for your money or at least help you to understand what you might upgrade first if your server isn’t performing as well as you’d like.
A Few General Thoughts About Hardware
More is generally better and faster, but only to a point, beyond which you probably won’t see any gains. That point will be different for different sites based on existing needs, the type of site, how much traffic the site regularly receives and how much it receives during traffic spikes. It also depends on what hardware your server currently uses.
With some hosting packages you won’t have much choice in hardware. You get whatever the company uses for its shared hosting plans, for example. However with a VPS or dedicated server, you’ll be able to choose plans based on how much hardware you want. What should you look for?
The three main things you want to consider are the CPU, RAM, and I/O specs.
- Central Processing Unit (CPU)—executes instructions.
- Random Access Memory (RAM)—is a controller between CPU and I/O.
- Storage Input/Output (I/O)—is the speed at which data can be read from and written to long term storage.
Once you have a hosting account, you should be able to login and find out how much CPU, RAM, and storage your site uses and adjust your plan accordingly, though keep in mind your average use may not come close to the resources you need during spikes in traffic.
Central Processing Unit (CPU)
The central processing unit (CPU) is the brains of your server. It interprets and executes instructions. It runs database queries and processes the data. It performs tasks and executes programming commands.
Serving a static site isn’t CPU intensive since there’s not much to interpret and execute. If your site doesn’t use a content management system and serves static HTML pages, you probably don’t need to be concerned with how much CPU you get. However, the more your site needs to function as an application, whether it’s because you run a CMS or custom backend code, the more important your CPU becomes to how well your site performs.
A faster clock speed (more GHz) means more instructions can be executed each second. More instructions per second, means more performance. The more you need to interact with both database and visitor, and the more the site needs to execute instructions, the more CPU you want to purchase.
The more processors you have, the faster and more efficient the server is capable of running. Multiple processors means more instructions can be executed concurrently so the CPU can do more in the same amount of time.
A processor with multiple cores or the ability to handle multiple threads at once also allows for more instructions to be executed over the same amount of time.
With multiple cores, instructions can be run on a second core when the first is busy, however, don’t expect four cores to be four times as fast or as efficient as a single core. You’ll see an improvement, but less than a fourfold increase.
Multithreading allows multiple threads of code, or multiple parts of a process to be executed simultaneously.
If there’s a theme running through all these series, it’s that taking advantage of caching is generally good for performance and your server’s CPU is no different.
Cache memory is temporary memory the CPU can use to store program instructions that are referenced often. The cache might be integrated directly into the CPU chip or placed on its own chip with direct access to the CPU. Either way it helps the CPU perform faster.
More is better here if you have the choice. More cache means more data and instructions can be stored temporarily for quicker access.
Random Access Memory (RAM)
RAM is short term memory. It’s the resource that stores data and execution instructions temporarily so they can be more quickly passed to the CPU. It’s similar to the CPU cache memory I just mentioned, but it’ll be a different chip and usually offer much more storage. It’s slower for the CPU to access, but we’re talking nano-time, so slow is only in comparison to something extremely fast.
The amount of RAM your server has controls how many processes the CPU can handle at any given time. RAM is referred to as “working memory” for this reason. More RAM means more data and instructions that can be accessed directly by the CPU. If something isn’t stored in RAM, it first has to be located and transferred to RAM before the CPU can do anything with it.
You’ll generally see significant performance gains with more RAM so you probably want to buy as much RAM as you can. How much is hard to say as it depends on the specifics of your site(s).
As with CPU, static sites shouldn’t have to worry too much about RAM, because there’s not a lot of data and programming instructions to store.
Assuming you run a dynamic site (the topic for a future mini-series), you’ll probably see the most performance gains by upping the RAM on your server, especially if you cache page content and are thus less dependent on I/O speed. Information stored in RAM is quicker for the CPU to access than it is for the CPU to read from and write to storage.
If you have a static site, you probably want to think more about RAM than CPU, though odds are however much RAM you have will be more than enough for a static site. It’s less that static sites need more RAM than that they generally need even less CPU.
However, once you get above 4–6GB of RAM, your CPU will probably be the limiting factor in how performant the server is. So while increasing RAM is good, you don’t need to overdo it.
Look for both the speed and latency of the RAM too, if that information is available. You want faster (more MHz), though you probably don’t need more than say 1600 MHz. You want to look for less latency too. LC8 is better than LC9 is better than LC10, which is probably the acceptable limit.
Storage and the Speed of Input/Output (I/O)
How much storage you need depends on the specific needs of your site now and in the future. How quickly that data can be read and how quickly new data can be written to disk is your main concern with performance and I/O. Ideally look for storage that is SSD (solid state drive). The lack of mechanical parts makes SSD drives much faster than hard disk drives (HHDs).
Aside: A few years ago I purchased a MacBook Air. It was the first computer I used with an SSD and despite the specs of the Air being not much better than the MacBook Pro it replaced, the speed of the SSD made up for everything else and it was noticeably faster from the moment I started using it.
If your site presents a lot of video and/or audio streaming it will require faster I/O speeds as it will need to transfer large files from storage. Dynamic sites also use a lot of I/O to move data to and from a database.
All Together Now
As I’ve said a few times, what hardware you ultimately decide to get will depend on the specifics of your site and, in general, more server (better specs) will likely lead to a more performant server that can more quickly respond to requests.
That said here are a few things to consider.
- If you run a static site, little of this is likely to be an issue.
- On the other hand, dynamic sites will need quick I/O to read and write data and they will usually need a better CPU to process it all. RAM is also important here, especially if you take advantage of page caching.
- Sites heavy on backend programming, probably need more RAM so instructions can be more quickly accessed by the CPU, but only to a point beyond which you’ll want to upgrade your CPU.
- If your site displays a lot of video and audio stored on your server, then I/O increases in importance.
The information needed to build and display the pages of your website are stored on disk. How fast the data can be read and written (I/O) determines how quickly it can be moved to and from RAM.
How much RAM you have determines how much can be sent to the CPU at any time. More RAM means the CPU has more to do. Ultimately, how fast the CPU is determines how much processing and calculating it can do.
Depending on what type of hosting package you purchase, you may or may not have any say in the specs of your server. If you choose a VPS or dedicated server, you definitely will have the option to buy better specs.
For most sites on servers with minimal specs, RAM will probably be your best purchase, unless your site makes heavy use of audio and video. Once you reach 4–6GB of RAM though, look more toward CPU upgrades.
In a few weeks I’ll pick up these series again and talk about different server software (Apache, NGINX, IIS, and LiteSpeed) and discuss the performance advantages and disadvantages of each. First I want to spend a couple of weeks talking about my recent return to managing my productivity.
Download a free sample from my book, Design Fundamentals.