Unikernels are specialised, single-address-space machine images constructed by using library operating systems. The concept of Unikernel is very old (Since 1980s in embeded system), but become more and more popular in this cloud computing age for its portability and security.
In recent days, I tested two famous unikernel production: Rumpkernel and OSv by running redis in them.
1. Run redis in Rumpkernel (KVM)
Firstly, build rumpkernel and its environment as “https://github.com/rumpkernel/wiki/wiki/Tutorial%3A-Serve-a-static-website-as-a-Unikernel”, then
git clone https://github.com/rumpkernel/rumprun-packages.git cd rumprun-packages/redis make # we get "bin/redis-server" now rumprun-bake hw_virtio ./redis.bin bin/redis-server # we get "redis.bin" now, so try to run it (make sure you have configured tap) rumprun kvm -i -M 4096 \ -I if,vioif,'-net tap,script=no,ifname=tap0'\ -W if,inet,static,10.0.120.101/24 \ -b images/data.iso,/data \ -- ./redis.bin /data/conf/redis.conf
2. Run redis in OSv (KVM)
Firsty, build OSv by the tutorial of “https://github.com/cloudius-systems/osv/”, and the virbr0 network (as qemu/kvm usually do), then
vim apps/redis-memonly/GET # change the redis version to 3.0.2 (as same as redis in rumpkernel) ./scripts/build image=redis-memonly -j20 # run it (use only one cpu core, as rumpkernel) sudo ./scripts/run.py -nv -c 1
3. Run redis on host (centos 7 on bare hardware)
wget "http://download.redis.io/releases/redis-3.0.2.tar.gz" tar xzf redis-3.0.2.tar.gz cd redis-3.0.2 ./configure make -j20 ./src/redis-server
4. Use benchmark tool to test it
I choose memtier_benchmark as the benchmark tool.
5. The test result
Request per second
Latency (unit for Y axle: micro second)
Looks the performance of OSv is better than Rumpkernel. But still, they all much slower than running on bare hardware. The bottle-neck in this test case is network, so may be we should find a way to bypass tap or bridge.