beating the virtualization tax for nosql workloads with osv

37
Beating the virtualization tax for NoSQL workloads with OSv Don Marti and Glauber Costa Cloudius Systems

Upload: don-marti

Post on 21-May-2015

279 views

Category:

Software


1 download

DESCRIPTION

NoSQL data stores such as Cassandra and Redis are memory and CPU intensive loads which can have unacceptable performance when run under virtualization in production environments. Over the past two years, the OSv project has profiled some of the important bottlenecks for NoSQL applications, and designed a new open-source guest environment to improve performance in key areas such as JVM memory allocation and network throughput. The side effect of this performance work has been to move some difficult tuning tasks off the administrator's to-do list and into the guest OS where they can be handled automatically with better responsiveness.

TRANSCRIPT

Page 1: Beating the Virtualization Tax for NoSQL Workloads with OSv

Beating the virtualization tax for NoSQL workloads with OSv

Don Marti and Glauber CostaCloudius Systems

Page 2: Beating the Virtualization Tax for NoSQL Workloads with OSv

Hardware

Hypervisor

guest OS

JVM

App Server

Java App

What is OSv?

guest OS

C++ App

Hardware

Hypervisor

OSv VM

App Server

Your App

OSv VM

Your App

Before After

Page 3: Beating the Virtualization Tax for NoSQL Workloads with OSv

Performance and Manageability

■ Performance■ Single address space■ Simplified networking

■ Manageability■ No local users■ No local config files

■ Simplicity: less than 1 second boot time

Page 4: Beating the Virtualization Tax for NoSQL Workloads with OSv

Trust is not free

Colocated (same CPU)

Apart(different CPU)

Linux 905 ns 13148 ns

OSv 328 ns 1402 ns

■ Context switch microbenchmark

Page 5: Beating the Virtualization Tax for NoSQL Workloads with OSv

No config files

■ REST API for all configurable items

■ AJAX GUI for config and management (optional)

Page 6: Beating the Virtualization Tax for NoSQL Workloads with OSv

VM build and deploy

■ Capstan: rapid VM build (and run)■ Docker-like config file■ Takes about 3 seconds to build■ Runs on any OS (written in Go)

Page 7: Beating the Virtualization Tax for NoSQL Workloads with OSv

1. Network performance

Page 8: Beating the Virtualization Tax for NoSQL Workloads with OSv

Traditional stack Network Channels

Page 9: Beating the Virtualization Tax for NoSQL Workloads with OSv

OSv-specific networking

■ Bypass socket layer■ full zero-copy achievable

Page 10: Beating the Virtualization Tax for NoSQL Workloads with OSv

Memcached benchmark

Requests/s (higher is better)

Page 11: Beating the Virtualization Tax for NoSQL Workloads with OSv

OSv networking: inbound

■ Handle inbound data without the overhead of the socket layer.

■ Called for every incoming packet.

Page 12: Beating the Virtualization Tax for NoSQL Workloads with OSv

OSv networking: outbound

■ Send the frame directly to the ifnet device.

■ PF hook is called with relevant locks held.

Page 13: Beating the Virtualization Tax for NoSQL Workloads with OSv

2. Memory management

Page 14: Beating the Virtualization Tax for NoSQL Workloads with OSv

Manual memory tuning

■ 240,000 Google hits for [jvm heap size]■ This is a job for a computer, not a human being.

Page 15: Beating the Virtualization Tax for NoSQL Workloads with OSv

JVM Memory System memory

Lend memory

Memory ballooning

Page 16: Beating the Virtualization Tax for NoSQL Workloads with OSv

Shrinker API

■ Register a callback■ OSv calls your shrinker■ No manual tuning of cache size

■ Used in osv-memcached

Page 17: Beating the Virtualization Tax for NoSQL Workloads with OSv

Redis on OSv

Page 18: Beating the Virtualization Tax for NoSQL Workloads with OSv

“porting” Redis

make CFLAGS="-fPIC" LDFLAGS="-shared" MALLOC=libc

■ -fPIC option■ -shared option■ MALLOC=libc (not required)

■ OSv malloc is integrated with kernel, optimized for small objects.

Page 19: Beating the Virtualization Tax for NoSQL Workloads with OSv
Page 20: Beating the Virtualization Tax for NoSQL Workloads with OSv

Details on Redis test

■ Ubuntu 14.04■ Affinity turned on in the Ubuntu guest

■ Both systems: Amazon c3.8xlarge■ 32 vCPUs■ 60GB RAM■ Intel Xeon E5-2680 v2 @ 2.8GHz■ 10 Gigabit networking

Page 21: Beating the Virtualization Tax for NoSQL Workloads with OSv

Redis details

■ Lua scripting, PUB/SUB, etc, it all works■ Redis uses fork for “BGSAVE” command.

■ This is the only functionality not supported.■ Single address space, no copy on write.■ Less than 20Mb redis image, now bootable

everywhere.

Page 22: Beating the Virtualization Tax for NoSQL Workloads with OSv

Conclusions

■ Memory and CPU intensive loads can have unacceptable performance under virtualization.

■ The OSv project has profiled important bottlenecks for NoSQL applications.

■ Virtual appliances available: Cassandra, Tomcat, Redis

■ Work in progress. Please join us.

Page 23: Beating the Virtualization Tax for NoSQL Workloads with OSv

Thank you

Download or try it in the cloud at: http://osv.io/

Follow @CloudiusSystems on Twitter

Page 24: Beating the Virtualization Tax for NoSQL Workloads with OSv

Begin backup slides

Page 25: Beating the Virtualization Tax for NoSQL Workloads with OSv

Run most workloads on any cloud

OSv

Page 26: Beating the Virtualization Tax for NoSQL Workloads with OSv

Rapid VM build and deploy

■ Build an OSv VM in ~3 seconds■ Small VMs (as small as 10MB) for fast deploy■ Boot in ~1 second for resilience and scaling■ Enable continuous delivery

Page 27: Beating the Virtualization Tax for NoSQL Workloads with OSv

Performance

■ System calls are free■ context switches are cheap (4x speed of recent Linux)

■ Network performance significantly faster■ around 20% with netperf over recent Linux■ more than 50% for some UDP workloads

■ SpecJVM between 3 and 5% faster■ Boots in < 1 second

■ As little as 100-200ms without local filesystem

Page 28: Beating the Virtualization Tax for NoSQL Workloads with OSv

Virtualization Oriented

■ No spinlocks in the kernel■ Simplest solution to lock holder preemption

■ No complicated hardware model■ Fair scheduler■ Huge pages■ Single address space: one set of page tables

Page 29: Beating the Virtualization Tax for NoSQL Workloads with OSv

So what about containers?

Page 30: Beating the Virtualization Tax for NoSQL Workloads with OSv

■ Docker is awesome! Low overhead!■ Small artifacts■ Fast deployment■ Fast startup (container start, not OS boot)

■ Docker is awesome! Easy builds!■ Simple configuration file■ Minimal additional work on top of application build

Docker is awesome

Page 31: Beating the Virtualization Tax for NoSQL Workloads with OSv

Hypervisors are awesome, too

■ Live migration (load balance, hardware maint)■ Multiple kernel versions available■ Running VMs everywhere is awesome!

■ Public cloud, private cloud, existing hypervisor...■ Security is awesome!

■ Container attack surface is full kernel interface.■ Hypervisor attack surface is small.

Page 32: Beating the Virtualization Tax for NoSQL Workloads with OSv

■ Fast boot, fast provisioning■ High performance■ Tiny footprint■ Virtualized

■ Live migration■ Elasticity■ MMU access

Everything is awesome

Page 33: Beating the Virtualization Tax for NoSQL Workloads with OSv

Different customization levels

● JVM-based application○ No effort

● Traditional C/C++ application○ More effort

● Virtio-app○ NFV - highest gain

Page 34: Beating the Virtualization Tax for NoSQL Workloads with OSv

C++ simplifies flow of control

Page 35: Beating the Virtualization Tax for NoSQL Workloads with OSv

Run existing applications

■ Open source, POSIX-compatible■ Run native Linux applications■ Run Java applications

Page 36: Beating the Virtualization Tax for NoSQL Workloads with OSv

Network channels: before

Page 37: Beating the Virtualization Tax for NoSQL Workloads with OSv

Network channels: after