Shared Hosting vs VPS Hosting
WHAT’S THE DIFFERENCE?
Tags: beginners, webdev
Published: 2019-11-22 03:27:15

Are you in the market for a website? Who isn’t these days?

If you want to start up a new site, then you’re probably shopping for a hosting plan too. You can’t have one without the other. The problem is there are many options. Today, we’ll learn about the two kinds of hosting plans.

Shared hosting and virtual private server (VPS) hosting are the most popular ways to host a site. Each comes with their strengths and weaknesses. Which approach is the _right_ one for you depends on what you or your *client* wants to do with the site.

Before we explore their differences, let’s review some basic hosting terminology.

<a name="server"></a>

## The Server [<a href="#server">#</a>]

The computer that runs your website is called a [web server](https://en.wikipedia.org/wiki/Web_server). We’ll say server for short. The server supplies three main things for a website to operate.

1. File storage (disk space for things we need later)
2. Central processing unit (CPU for making things go)
3. Memory (RAM for remembering what we are doing right now)

We can think of file storage as the server’s long-term memory, CPU as the engine that makes things go, and RAM as the short-term memory. Below is a simple diagram of a server.

![Shared vs VPS Hosting - Simple Diagram of a Web Server](https://thepracticaldev.s3.amazonaws.com/i/pl0vnr4brcjy9bhrdwyf.png)

<a name="hosting"></a>

## Hosting [<a href="#hosting">#</a>]

These web servers need a place to live. A host provider does just that. Host providers supply:

1. The servers (hardware and software)
2. A secure place for the servers to live.
3. All the support that servers need to run your website. E.g. power, cooling, engineers, software/hardware updates, internet connection.

Now that we’ve covered some definitions, let’s talk about shared hosting.

<a name="shared"></a>

## Shared Hosting [<a href="#hosting">#</a>]

### Affordable
Shared hosting is the most affordable way to get a website up and running. The cost is low because **one** web server can be used for **many** sites. This means fewer machines, fewer parts to buy/maintain, and less rental space needed to house the servers. These cost savings get passed onto the site owners. Which lowers the barrier to entry. I.e. more people can have their very own website.

> Shared hosting is perfect for beginner site owners/developers. Or, for the experienced developer that needs another site for a side project, testing, or staging.

### Limited Growth

Shared hosting is perfect for first-time site owners, hobbyists, and personal blogs. In some cases, shared hosting _can_ work well for small businesses. But, there’s a _catch_. Let’s say we have a web server with one website on it (bestwebsiteever.com). Then along comes Ani. Ani needs a web server for her site. We invite Ani to put her site on our server. Now, our server has:

• Double the files
• Our CPU engine is working twice as much
• We have half of the memory we used to have work with
• Potentially harmful programs, processes, and access

Because our server is working harder with less resources available, we notice that our _bestwebsiteever.com_ site begins to slow down and crashes occasionally. Can you imagine what happens if two more people (total of four) put their site on our machine?

![Shared Hosting - One Physical Server with Four Guests](https://thepracticaldev.s3.amazonaws.com/i/55ebw9oho2mnlpege45r.png)

Above is one shared server hosting four websites for four different customers. Each person gets about 1/4 of the total file space, CPU, and memory.

<a name="virtual"></a>

## Virtual Servers (Virtual Machines) [<a href="#virtual">#</a>]

Before diving into VPS hosting, we need to take a brief look at the tech behind a VPS. Virtual private servers couldn’t be possible without virtual machine (VM) technology. A VM behaves like our physical machine pictured above. A VM has file storage, CPU, and RAM like its physical cousin. But, a VM is **not** made up of a physical hard drive or circuits, unlike its cousin. 

Here’s how [one of the pioneers](https://www.vmware.com/topics/glossary/content/virtual-machine) of VMs defines a VM.

> Virtual machines are software computers that provide the same functionality as physical computers. ~VMware

<a name="vps"></a>

## VPS Hosting [<a href="#vps">#</a>]

Behind the scenes, a VPS (basically a VM) is a group of files. This may sound _trivial_ for most people. But in the digital universe, this is huge. So like regular files, we can put many VPSs on one physical computer without _stressing_ out the computer like in the shared hosting scenario. Each VPS is separate and enclosed in its own environment. Other VPSs cannot drain each other’s resources as we saw earlier for shared hosting. Because a VPS is a _set_ of files, they can be copied/moved/deleted easily like regular files. 

The important thing is that the file storage, CPU, and memory on your VPS belong only to you.

Below is a set of six virtual private servers hosted on one physical server.

![Shared vs VPS Hosting - Diagram of Virtual Machines deployed on a Server](https://thepracticaldev.s3.amazonaws.com/i/r2ov68eipb3bgaokz2f4.png)

<a name="comparison"></a>

## Comparison Chart [<a href="#comparison">#</a>]

![Shared vs VPS Hosting Comparison Chart](https://thepracticaldev.s3.amazonaws.com/i/knvn3p2u4xj7h2modurn.png)

<a name="conclusion"></a>

## Conclusion [<a href="#conclusion">#</a>]

Shared hosting makes it easier for _anyone_ to have a website. Shared hosting’s main selling point is its price. It’s the most affordable of all the hosting plans available. Shared hosting is the best choice for many new website owners and some small businesses.

When the time comes for your website to grow, VPS hosting is the perfect solution. VPS offers increased stability, speed, and room for growth. With all that added value, it only makes sense that VPS hosting will cost more than shared hosting. There are a wide-range VPS hosting plans which make VPS a good fit for almost everyone.

## Footnote

This is my first self-published article outside of Medium. I hope DEV works out to be a better alternative as I shop around for a new platform. 

My main motivations for publishing this piece here are 1) for new devs to learn and 2) for experienced devs to share with their non-techie clients.

Thanks for reading! :-)