Fast, Specialized Unikernels the Easy Way
Total Page:16
File Type:pdf, Size:1020Kb
Unikraft: Fast, Specialized Unikernels the Easy Way Simon Kuenzer Vlad-Andrei Bădoiu Hugo Lefeuvre Sharan Santhanam Alexander Jung Gaulthier Gain Cyril Soldani Costin Lupu Stefan Teodorescu Costi Răducanu Cristian Banu Laurent Mathy Răzvan Deaconescu Costin Raiciu Felipe Huici Eurosys 2021, April 26th-28th Specialization = High Performance software hardware Unikernels = Specialized Virtual Machines • Easy to build and run GOALS • Easy or no app porting • Great performance Design Principles 1. Fully modular kernel 2. Provide high performance specialized APIs Design Principles 1. Fully modular kernel 2. Provide high performance specialized APIs Why not Linux? 207 13 111 15 164 30 151 13 311 101 551 6 24 117 15 locking 4 2 34 2 119 5 7 91 1 39 sched 3 720 2 36 ipc 8 4 5 60 Unikra-77 is built1 from scratch to be fully modular53 time 16 90 8 2 27 net 465 fs 11 107 17 2 mm 124 11 110 1 10 19 25 23 irq 7 122 3 security 6 36 46 10 67 block 14 28 22 226 2 37 6 68 95 277 213 With Unikraft Hello World 1 posix-layer boot 3 nolibc ukboot 1 argparse 6 1 ukargparse mm1 ukallocbuddy 3 ukalloc 20 security 1 9 10 6 1 1 posix-layer mm fs nginx 39 sched 3 1 1 2 2 time locking 2 net 7 1 ipc Doing it with existing unikernels? (1) Require significant expert work to build Unikraft(2) is Theybuiltare fromoften scratchnon-POSIX (with compliant borrowing) (3) The (uni)kernels are still monolithic Design Principles 1. Fully modular kernel 2. Provide high performance specialized APIs Specialized API Example application glibc POSIX sockets network stack UDP High-perf API application musl newlib LIBC LAYER syscall-shim posix-fdtab posix-process … pthread LAYER POSIX COMPAT COMPAT POSIX posix-socket vfscore uksched ukboot ukalloc ext4 lwip mtcp 9pfs ramfs FILESYSTEMS NW STACKS NW LAYER tlsf oscar ukcoop ukcoop OS PRIMITIVES mimalloc BOOTERS tinyualloc ukpreempt buddyalloc dynamicboot SCHEDULERS uknetdev ukblockdev ALLOC. MEM . virtio-net virtio-block netfront blockfront … KVM clock memregion XEN clock memregion LAYER PLATFORM • Easy to build and run GOALS • Easy or no app porting • Great performance • Easy to build and run GOALS • Easy or no app porting • Great performance Binary Compatibility? Auto-porting from Source statically link App native build compile .obj and .a (Unikraft build system) musl system files shim kernel syscall Unikraft Unikraft syscalls (POSIX) Compile Time What about syscall support? Syscall Support Eurosys 2016 146 syscalls currently supported Linux: ~350 syscalls System call support 100% 10% 20% 30% 40% 50% 60% 70% 80% 90% 0% Top 30 Debian Popcon Apps 30 Debian Popcon Top apache avahi bind9 If top 5 syscalls implemented Supported syscalls dovecot If remaining syscalls implemented If top 10 syscalls implemented 146 syscalls currently supported currently 146 syscalls exim firebird Syscall Support groonga h2o influxb knot lighttpd mariadb memcached mongodb mongoose mongrel mutt mysql nghttp nginx nullmailer openlitespeedweb opensmtpd postgresql redis sqlite3 tntnet webfs weborf whitedb If all Else Fails – Manual Porting What Unikraft Supports (sample) (ongoing) (ongoing) • Easy to build and run GOALS • Easy or no app por6ng • Great performance Does autoporting sacrifice performance? SQLite: Manual vs. Auto Port 1.153 1.083 1.065 1.121 1 AutoporAng doesn’t negaAvely affect performance Time (seconds) 0 Linux newlib musl musl (native)(baseline) (native)(manual) (native)(manual) (external)(autoport) time for 60K insertions Transparent Benefits – Boot, Memory, Size, Throughput cc Image Sizes vs. other Projects Image size 10MB 2MB 4MB 6MB 8MB 0B Unikraft 213.0KB 1.6MB 1.8MB Hermitux 1.6MB nginx hello 1.3MB Linux User 1.5MB 2.1MB 16.4KB 1.2MB 1.8MB 1.1MB sqlite redis Lupine 1.7MB 3.6MB 2.6MB 3.2MB Mirage 3.3MB OSv 4.5MB 5.4MB 8.1MB Rumprun 5.4MB 2.8MB 5.4MB 3.7MB 3.9MB Unikraft Boot Times VMM 102 Unikraft Guest 42.7ms 38.4ms 101 9.1ms 3.1ms 3.1ms Total Boot Time10 (ms) 0 0 QEMU QEMU Solo5 Firecracker QEMU (1NIC) (MicroVM) Minimum Memory Requirement 16MB 24MB 32MB 40MB 48MB Minimum Memory Requirements 8MB 0B Unikraft 2MB 5MB 7MB 4MB Docker nginx hello 6MB 7MB 7MB Rumprun 6MB 8MB 12MB 13MB Hermitux 10MB sqlite redis 11MB 13MB 10MB Lupine 20MB 21MB 21MB 21MB OSv 24MB 26MB 40MB 26MB MicroVM Linux 29MB 29MB 30MB 29MB Mirage Solo5Average Throughput (x1000 req/s) 100 150 200 250 300 350 50 0 Linux FC 25.9 Lupine FC 60.1 n ginx Throughput ginx Linux KVM 71.6 Rump KVM 104.5 Docker Native 152.6 Linux Native 160.3 Lupine KVM 175.6 OSv KVM 189.0 Unikraft KVM 232.7 291.8 Hermitux uHyve Aver. Throughput (Million req/s) 0.0 0.5 1.0 1.5 2.0 2.5 3.0 Linux FC 0.37 0.24 Redis Performance Lupine FC 1.14 GET 1.06 Rump KVM 1.26 0.93 Linux KVM 1.33 1.17 Lupine KVM SET 1.54 Docker Native 1.31 1.82 1.52 OSv KVM 1.95 1.68 Linux Native 1.98 1.54 Unikraft KVM 2.44 2.01 2.68 2.26 Boot Times - Different Allocators 3.5 virtio rootfs misc 3.07 vfscore pthreads lwip 3.0 ukbus plat alloc 2.5 2.0 1.5 0.94 0.87 Total Boot Time1.0 (ms) 0.51 0.49 0.5 0.0 Binary buddy Mimalloc Bootalloc tinyalloc TLSF Redis Throughput Different Allocators 3.0 GET SET 2.72 2.5 2.47 2.32 2.22 1.97 2.0 1.89 1.5 1.0 1.01 0.78 0.5 Aver. Throughput0.0 (Million req/s) Mimalloc TLSF Binary buddy tinyalloc Specialized APIs Specializa)on Benefits – Filesystem Performance Filesystem Specialization – SHFS Unikraft Linux FILE EXISTS NO FILE 5000 4054 (1126ns) 4000 3277 (910ns) 3000 2647 (735ns) 2219 (617ns) 1968 (547ns) 2000 1637 (455ns) Average # TSC 1000 308 291 (86ns) (81ns) 0 SHFS VFS VFS VFS (No mitig.) High performance POSIX unikernels are now a reality! Info: https://unikraft.org/ Code: https://githuB.com/unikraft Reproduce: https://githuB.com/unikraft/eurosys21-artifacts.