01

Why this matters

Different computing environments offer distinct trade-offs in performance, cost, security, and manageability. Understanding these environments helps in selecting the right one for specific system qualities.

Physical servers provide full hardware and software control. They are ideal for data-intensive workloads and environments with strict compliance needs.

Virtual machines emulate physical computers. They run on shared hardware with a hypervisor. VMs offer better cost and scalability than physical servers, but face shared resource issues and potential security gaps.

Containers are lightweight packages that include code, runtime, and dependencies. They run directly on the OS kernel. Containers are faster to start and more portable than VMs, but share the host OS, introducing security risks.

Serverless compute eliminates server management. Developers write and deploy code without provisioning infrastructure. It scales automatically and charges only for actual usage.

Each model has distinct advantages and limitations. The choice depends on workload type, performance needs, and operational constraints.


02

Physical servers

A physical server consists of hardware and a host operating system.

Applications run on top of the OS. One or more applications can be deployed on a single server.

Physical servers offer complete control over software stack and hardware resources.

They can have hundreds of CPU cores.

They are typically dedicated to a single customer.

Such servers are called bare metal servers.

Bare metal servers do not share resources with other tenants.

This eliminates the noisy neighbor phenomenon.

It ensures high security since no other user has access.

Drawbacks include high cost, difficulty in managing, scaling, and porting.

They are slow to provision and boot.

Physical servers are best for data-intensive workloads and compliance-heavy environments.


03

Virtual machines

A virtual machine emulates a physical computer.

Multiple VMs run on the same physical hardware.

Each VM runs a guest operating system.

Applications run within each VM.

A hypervisor, or virtual machine monitor, creates and runs VMs.

VMs are cheaper than physical servers because multiple VMs share one physical server.

They are easier to maintain, scale, and port.

VMs can be quickly re-provisioned after failure.

VMs face shared resource issues: CPU, memory, disk, and network IO.

This can lead to the noisy neighbor problem.

VMs are less secure than physical servers due to hypervisor vulnerabilities.

Modern VMs offer various sizes and costs.

They support general-purpose to high-performance configurations.

Google Cloud defines containers as a lightweight, standalone, executable package.

Containers include code, runtime, system tools, libraries, and settings.

Containers run on top of the host OS kernel.

They virtualize the operating system, not hardware.

A container engine is required to run containers.

Containers require fewer resources than VMs.

A single server can host many more containers than VMs.

Containers are more scalable and portable.

They are faster to start.

Containers are less secure than VMs because they share the host OS.

Malicious code can access host memory.

Containers depend on the host OS kernel.

They require the same OS as when created.

VMs are better for managing multiple operating systems.

Containers are suitable for any workload.

Google runs everything from Gmail to YouTube in containers.

Google starts over several billion containers weekly.


04

Serverless computing

Serverless compute services manage machine resource allocation.

Engineers write code and deploy it to the cloud.

Standard dependencies are provided by the cloud.

Only non-standard dependencies need to be included.

The biggest advantage is zero server management.

No provisioning, managing, or upgrading of servers.

Cost is based on actual usage.

No charge when functions are idle.

Serverless services automatically scale infrastructure based on load.

It increases delivery speed by reducing infrastructure overhead.

Technical limitations include cold starts, invocation duration, memory size, and ephemeral storage.

Cost can be high at scale.

When load is sustained, functions are never idle.

Such usage can exceed VM or container costs.

Serverless is ideal for small, event-driven tasks.

Use cases include API requests, real-time file processing, and string processing.

These tasks respond to events like file uploads, message delivery, or endpoint requests.

Questions

  • What are the main security differences between virtual machines and containers?
  • How does the noisy neighbor problem affect virtual machines?
  • Why are containers faster to start than virtual machines?
  • What event-driven tasks are best suited for serverless computing?
  • Why might sustained high load make serverless more expensive than VMs?
  • How do container dependencies limit flexibility?
  • What is the role of a hypervisor in virtual machines?
  • Why are bare metal servers expensive to manage?

Key takeaways

  • Physical servers offer full control and security but are expensive and slow to manage.
  • Virtual machines share hardware and have shared resource risks.
  • Containers are lightweight, fast, and portable but share the host OS.
  • Serverless eliminates server management and scales automatically.
  • Serverless has cost and performance limits under sustained load.
  • Each model suits different types of workloads and system requirements.