Running Unikernels from Existing Linux Applications with OPS

Unikernels are an emerging deployment pattern that engineers are choosing over Linux and Docker because of their performance, security and size. Researchers from NEC are reporting boot times in 5ms while other users talk about how small their VMs can get – in the kilobyte range if you’re using c. Still others like OSv have measured up to a 20% performance advantage in popular databases. However they have remained out of a lot of developers reach because of their low level nature.

That is until we decided to open source a tool called ops.city (OPS). OPS is a new free open source tool that allows anyone, including non-developers to instantly build and run unikernels on linux or mac from their existing software. There is no complicated re-compilation. There is no LDFLAG twiddling or random patching of various libraries you’d never patch yourself. OPS goal is to democratize access to unikernels.

Ok – enough of that – let’s build some unikernels.

First thing you’ll want to do is download ops itself:

curl https://ops.city/get.sh -sSfL | sh

Let’s start with a short example:

Let’s create a working directory:

mkdir p

Now put this into test.php:

<?php

echo ‘test\n’;

?>

From a fresh install you’ll see that there are several pre-made packages available:

Running Unikernels from Existing Linux Applications with OPS 1

Let’s go ahead and download the php package. The package contains everything that you’ll need to build and run php unikernels but absolutely nothing more. The idea is not to strip things out that aren’t necessary – it’s more of only putting things in to make it work. You’ll notice if you get into the tarball you’ll find an ELF file along with some libraries. This was built for linux but your application won’t actually run on linux. Linux is now 28 years old and predates both commercialized virtualization and what has become known as “the cloud” – namely Amazon Web Services and Google Cloud – both of which heavily use virtualization underneath.

Running Unikernels from Existing Linux Applications with OPS 2

Now if you run the example you’ll see that we boot up our php application and run the code but if you are paying attention you’ll see that this not like Linux where it starts hundreds of programs before it runs yours. Again this is more than just replacing the init manager and applying seccomp. We’ve tailored your application to become it’s own little operating system – how cool is that?

Let’s try another one – put this into test.js :

console.log(“we are all crazy programmers!”);

This time we’ll try out node.js:

Running Unikernels from Existing Linux Applications with OPS 3

It’s important to note that we’ve only showed some basic examples here. OPS is actually capable of loading and running arbitrary ELF binaries.

If you are using docker or kubernetes now you’ll definitely want to pay attention and get involved early in the unikernel ecosystem. If you are a microservices aficionado or serverless fan you should also be paying attention as a lot of people are predicting this to be the underlying infrastructure for these paradigm changing technology growths.

So what are you going to build? Go check out https://github.com/nanovms/ops – fork/star the repo and let us know!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.