The HaLVM: A Simple Platform for Simple Platforms
Upcoming SlideShare
Loading in...5
×
 

The HaLVM: A Simple Platform for Simple Platforms

on

  • 2,782 views

Over the last six years, Galois has been developing the Haskell Lightweight Virtual Machine, or HaLVM, a lightweight virtual machine that runs directly on the Xen hypervisor. The HaLVM's design is ...

Over the last six years, Galois has been developing the Haskell Lightweight Virtual Machine, or HaLVM, a lightweight virtual machine that runs directly on the Xen hypervisor. The HaLVM's design is based on a notion of minimalism: Authors of HaLVM domains include only those libraries and features they require, allowing the HaLVM to have a very small initial resource footprint that scales in a very obvious fashion. In doing so, we hope to combine the minimalism and flexibility of a small kernel with an extended set of libraries with the simplicity and reliability of the strongly typed, high-level language Haskell.

While initially designed for running operating system design experiments, the HaLVM has grown over time to be a suitable platform for writing simple network appliances with a very narrow resource footprint. This work has been enabled by other Galois projects: a TCP-compliant network stack written in Haskell, and a fairly-complete file system written in Haskell. In the end, because we use Haskell and provide these libraries at the Haskell level, programmers can create complex software structures quickly, easily, and with the added assurance that the Haskell type system provides.

In this talk, we will provide an overview of the HaLVM and its design principles - pointing out where the HaLVM shines and where it is weak - and continue with some of our experiences using it over the last six years.

Statistics

Views

Total Views
2,782
Views on SlideShare
1,920
Embed Views
862

Actions

Likes
0
Downloads
16
Comments
0

9 Embeds 862

http://www.xen.org 302
https://galois.com 243
http://galois.com 166
http://xen.org 65
http://www-archive.xenproject.org 43
http://beta.galois.sysite.co 35
https://twitter.com 4
http://xen.xensource.com 3
http://www.google.es 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

The HaLVM: A Simple Platform for Simple Platforms The HaLVM: A Simple Platform for Simple Platforms Presentation Transcript

  • The HaLVMA Simple Platform for Simple Platforms Adam Wick | XenSummit | August 27th, 2012
  • The What?A port of the that runs Haskell directly atopprogramming the Xen language hypervisor HaLVM Haskell Virtual Machine Lightweight designed to run in minimal environments © 2012 Galois, Inc. All rights reserved.
  • Wait, what? top httpd haskell programnethack haskell program Linux HaLVM Xen © 2012 Galois, Inc. All rights reserved.
  • Why would you do such a thing?Strangely enough, we did this because we were doing designwork in microkernel-based operating systems. Typical component communication graphs for microkernel-based OSes look something like this. It is very easy to create designs that look good on a white board, but include issues that make the system impossible to boot. We designed the HaLVM as a quick way to show feasibility. © 2012 Galois, Inc. All rights reserved.
  • Simple Testing Apparatus Xenmain = do block <- openBlockDeviceChannel dev <- openOutputChannel crypto <- openCryptoDeviceChannel print “Encrypted Disk Booted!” © 2012 Galois, Inc. All rights reserved.
  • InterludeYou may be wondering why I’m talking about a tool for doing explorations of component breakdowns for microkernel- based operating systems during a workshop about developing cloud-based services based on Xen. OS Dev. Net Serv. Cloud Tool Tool Tool? © 2012 Galois, Inc. All rights reserved.
  • How does this happen? main = do Nifty, but only block <- openBlockDeviceChannel dev <- openOutputChannel checks that boot crypto <- openCryptoDeviceChannel works in our print “Encrypted Disk Booted!” imagined world.Fails if we forgot any prerequisites in our design, and low-level details of drivers and OS components are reallyeasy to forget. main = doSo we let each block <- openBlockDeviceChannelcomponent get dev <- openOutputChannelmore and more crypto <- openCryptoDevice startServiceLoop reqchan crypto blockdetailed … © 2012 Galois, Inc. All rights reserved.
  • Focus on Small (and Fast) We are not kidding on the size of the graphs we wanted to test with. One of our early projects involved 15+ domains. Space usage and load speed quickly became critical constraints. 15 domains * 10 second boot time = 2½ minutes to start 15 domains * 64MB footprint = 960MB basic req.Focus on quick and fast: → The HaLVM boots in milliseconds → The HaLVM uses as little as 4MBWe are typically limited by Xen, not by design. © 2012 Galois, Inc. All rights reserved.
  • Abstraction Makes The Heart Grow FonderWe designed the HaLVM to easily support this expansion bystarting with the smallest core implementation possible andthen providing the facilities for more complex behavior to beimplemented as (layered) libraries. Program Code Rendezvous Library Disk Driver NIC Driver TCP/IP XenBus Library Communications Library PCI Library HaLVM Core Library GC, Threading Layer, Etc. Low-level Xen Integration © 2012 Galois, Inc. All rights reserved.
  • Abstraction Makes The Heart Grow FonderThe nice thing about this methodology is that programs useonly the libraries they need, and thus only pay the space andinitialization cost of the libraries they need. Program Code Rendezvous Library Disk Driver NIC Driver TCP/IP XenBus Library Communications Library PCI Library HaLVM Core Library GC, Threading Layer, Etc. Low-level Xen Integration © 2012 Galois, Inc. All rights reserved.
  • Abstraction Makes The Heart Grow FonderThe nice thing about this methodology is that programs useonly the libraries they need, and thus only pay the space andinitialization cost of the libraries they need. Program Code Rendezvous Library Disk Driver NIC Driver TCP/IP XenBus Library Communications Library PCI Library HaLVM Core Library GC, Threading Layer, Etc. Low-level Xen Integration © 2012 Galois, Inc. All rights reserved.
  • Abstraction Makes The Heart Grow FonderThe nice thing about this methodology is that programs useonly the libraries they need, and thus only pay the space andinitialization cost of the libraries they need. Program Code Rendezvous Library Disk Driver NIC Driver TCP/IP XenBus Library Communications Library PCI Library HaLVM Core Library GC, Threading Layer, Etc. Low-level Xen Integration © 2012 Galois, Inc. All rights reserved.
  • Wait, What Did We Just Do?At some point it occurred to us that we had developedsomething that was actually useful on its own, rather than atool for OS design work. If you can speak Ethernet to a network and write blocks to a disk, then some interesting possibilities emerge for small software network devices: HaLVM random number generators, HaLVM trafficmonitors, HaLVM alert systems, HaLVM chat servers, HaLVM time servers, HaLVM encryption servers, HaLVM storage servers … © 2012 Galois, Inc. All rights reserved.
  • If only we had … If you can speak Ethernet to a network and write blocks to a disk, then someinteresting possibilities emerge for small software network devices … but blocks on a disk quickly becomes a burdensome interface; you really want a file system and Ethernet is a bit low level for most network programs; you really want a whole TCP/IP stack © 2012 Galois, Inc. All rights reserved.
  • We Really Like Haskellbut blocks on a disk quickly becomes aburdensome interface; you really want a filesystem Halfs: The Haskell File Systemand Ethernet is a bit low level for most networkprograms; you really want a whole TCP/IPstack HaNS: The Haskell Network Stack © 2012 Galois, Inc. All rights reserved.
  • Wait, what have we built?!Now armed with a file system and a network stack, we hadan interesting little platform for writing lightweight, single-purpose cloud services. … which works on Xen … which explains why I’m talking to you right now OS Dev. Net Serv. Cloud Tool Tool Tool! © 2012 Galois, Inc. All rights reserved.
  • … mostly Cloud This picture made a great little slide addition. Tool! CloudBut this picture is probably a bit more honest. Tool?The HaLVM is a work in progress. There are some roughedges – particularly around network stack and file systemintegration – but the basis is there. It will get better withtime, particularly if interested parties contribute. © 2012 Galois, Inc. All rights reserved.
  • So, A Cloud Service Framework Remember this picture? top httpd This picture also highlights when and why you would haskell choose to use a HaLVM, rather program than a more traditional, Linux-nethack based approach. haskell big small program Linux HaLVM Xen © 2012 Galois, Inc. All rights reserved.
  • Why and Why NotThe HaLVM offers a very lightweight platform for writing simplecloud services, at the cost of more limited functionality andless access to the very highest-speed utilities. top httpd Does your service need a high-speed database server hooked up to fast business logic with a low-latency web haskell program server?nethack haskell Does it need it right now? program Linux HaLVM © 2012 Galois, Inc. All rights reserved.
  • Why and Why Not Good for small, single-purpose haskell cloud services with limited program dependencies. HaLVM Saves money on cloud service costs via lowered memory and disk footprint. top httpd Good for more complicated systems with many system haskell program dependencies.nethack Larger selection of tools and frameworks for developing Linux your application. © 2012 Galois, Inc. All rights reserved.
  • That’s it …So that is the HaLVM. A nifty platform for developing simple cloud services. A nifty platform for creating critical, isolated services.Oh, and it’s free, and available on GitHub: Base HaLVM https://github.com/GaloisInc/HaLVMNetwork Stack https://github.com/GaloisInc/HaNS File System https://github.com/GaloisInc/Halfs © 2012 Galois, Inc. All rights reserved.
  • … I’m done. Questions, comments, or suggestions: now or at awick@galois.com Also see the HaLVM mailing list at http://community.galois.com/mailman/listinfo/halvm-devel Base HaLVM https://github.com/GaloisInc/HaLVMNetwork Stack https://github.com/GaloisInc/HaNS File System https://github.com/GaloisInc/Halfs © 2012 Galois, Inc. All rights reserved.