Reason for either

  • Traditional way business operates is by running applications on servers
  • 1 application on 1 server
  • OS did not have the capability to run multiple applications securely on a single server
  • Buy a new server for each new application
    • Application cannot take full advantage of server’s capability
    • Running 1 application on one server is a waste of money

Virtual Machines

  • Allow multiple applications to run on a single server
  • Simulates hardware and software
    • Runs the OS and the application such as databases, web servers and emails

Structure

  1. Server/hardware
  2. Hypervisor
    1. Allows 1 machine to run multiple virtual machines
    2. Allocates and controls the sharing of a machine’s hardware
    3. VMware ESXi, Microsoft Hyper-V
  3. Virtual machines
    1. Each has its own OS
  4. Application on top of each VM

Drawbacks

  • VMs consume a lot of disk space
  • Each VM has its own dedicated OS
  • Consume lots of RAM and CPU power from the server that could be used for other processors
  • Slow to start up because OS needs to boot up
  • Require license for OS of each VM which costs money

Containers

  • Similar to VMs
  • Only contains an application VS simulating an entire machine
  • Application that is packaged with files, configurations and dependencies necessary for it to run
  • EG website is bundled with libraries, HTML, scripts, web images and software
    • Image is then distributed and can be hosted on any computer without adding software or configuration
    • Has everything it needs to run a website
  • Usually Docker is used to create, manage and run containers
  • Can run on Linux and Windows machines

Structure

  1. Server/Hardware
  2. Operating system
  3. Container engine: unpacks the container files and hands it to the core of the operating system (kernel)
  4. Containers: share the underlying OS that is on the server, only contains application, making file size smaller (lightweight) and fast, consumes less RAM and CPU power from the server

Disadvantage

  • Containers must be packaged to work with the same OS of the server (container files must be Linux if the OS is Linux) VS where VM can run any OS
  • If server OS crashes, all containers will go down

Remarks

  • Both are portable, but container files are smaller
  • Some companies run VM and containers on the same machine
    • Inside each VM are containers
  • Docker’s size, portability and speed is the main advantage