It goes without saying that a large part of website and application hosting is kept on the cloud rather than physical hardware. The architecture of the internet is becoming, quite literally, more virtual. Why Virtual Hosting? Quite simply, virtual hosting is easier, more scalable, and generally more cost efficient. Since virtual servers are maintained by… Continue reading 7 Questions about Cloud Hosting vs. VPS
It goes without saying that a large part of website and application hosting is kept on the cloud rather than physical hardware. The architecture of the internet is becoming, quite literally, more virtual.
Why Virtual Hosting?
Quite simply, virtual hosting is easier, more scalable, and generally more cost efficient. Since virtual servers are maintained by the company that hosts them, there is no need for a dedicated server maintenance team saving time as well as money.
When dealing with scaling, it’s much easier to spin up a new server instance, than installing a brand new bare metal server. Additionally, that makes it much more dynamic as that extra server instance can be spun down once it is no longer needed while returning the new server may prove more challenging.
Not to mention security. Cloud providers have entire teams dedicated to keeping their and, by extension your, servers safe from hackers.
All this adds up to saving money.
The biggest advantage bare metal servers have over their virtual offspring is raw CPU power. Due to the process of virtualized server hosting, there is a drop in performance. In other words, 1 CPU on a virtual instance does not necessarily equal 1 CPU on a physical laptop.
That drop has to do with how the core of each processor is divided and how the logic was written to handle incoming sets of instructions.
But First… What’s a CPU?
Before digging too deep in the circuitry, let’s examine what a CPU is in the first place. Feel free to skip ahead if this is information you already know.
CPU stands for "central processing unit". As the name infers, it is a computer component that manages the interpretation and execution of most of the commands from the computer’s other hardware and software. Also referred to as a processor, it can be considered as the "brains" of the operation.
Each CPU is divided into cores. Each core can separately receive instructions which outline how to perform calculations or actions. A set of instructions can allow a software program to perform a specific function. Logically, the more cores a CPU has the more set of instructions it can run at the same time. This is also known as multi-threading in programming parlance. [source]
How do Hosting Providers Work?
Hosting providers have regional databases with stacks of physical servers inside them which run a hypervisor.
The hypervisor is a program that enables a single piece of hardware to run several different virtual machines.
Each one of these virtual machines or operating systems will be able to run its own programs, as it will appear that the system has the host hardware’s processor, memory and resources. In reality, however, it is actually the hypervisor that is allocating those resources to the virtual machines.
In effect, a hypervisor allows you to have several virtual machines all working optimally on a single piece of computer hardware. [source]
Cloud providers use a type of hypervisor known as a type I hypervisor. This means the hypervisor is installed directly on the hardware, allowing for the control of the hardware itself along with the virtual machines that they are running. Thus, type I is also known as a "bare metal hypervisor".
Specifically, Google and AWS run the open source KVM while Azure runs Hyper-V.
What Happens When I Create a Virtual Server to Host my Application?
The specifics depend upon your hosting provider, but essentially you will create a virtual machine connected to your account. Google refers to theirs as Custom Machines, AWS is EC2 Instance and Aure is a Windows Virtual Machine. Regardless, each virtual machine instance will have a certain amount of memory (RAM) and vCPUs depending upon the instance type that is chosen.
So a vCPU is…?
A virtual CPU. Through the process of Hyper-Threading, two virtual processing cores are created for each physical core present in a CPU.
The physical core powers the virtual cores, which then share the responsibility of task processing. Each virtual core is identical to the other, and though neither is as powerful as the physical core, together they far exceed the physical core’s power[source]
Thus, physical cores will beat out a single virtual core, but multiple vCPUs will be able to process more than a single physical CPU core (assuming that core is non-hyperthreaded). In other words, a hyperthreaded CPU with 2 cores (2 CPU) behaves as if it had 4 cores (4 vCPU). However, 4 physical cores will outperform a system with 4 virtual cores.
Does That Mean I Shouldn’t Host My App on the Cloud?
Not at all. In most applications, the ease and cost savings of virtual server hosting will heavily outweigh the extra performance from bare metal servers.
Take Red5 Pro for example. We recommend a system with at least 2 CPU. Since we conduct our testing on virtual server instances, all our benchmarks are based on systems running 2 vCPU. Thus, all but the smallest virtual instances (the ones with only 1 CPU) will provide enough processing power for media streaming.
Of course, we made Red5 Pro as flexible as possible so we also support hosting on your own bare metal servers. You don’t have to use a Cloud provider, it’s just another option.
Beyond that, Red5 Pro has implemented an autoscaling solution which scales your application up or down depending upon the current load. As such, your server fleet automatically expands and contracts as traffic increases and decreases over time.
For further ease of use, we added a scheduling API. This enables provisioning the instances you need, for the very moment that you need them. Additionally, in some event based use cases, you can turn off the entire rig when it’s not in use (auctions, live trivia games, concerts, etc. ) thus saving money that would otherwise go towards keeping bare metal servers running in a data center.