bcache and aerospike

28
Bcache and Aerospike LSPE Dec 20, 2014 Anshu Prateek Devops, Aerospike

Upload: anshu-prateek

Post on 13-Jul-2015

2.415 views

Category:

Software


1 download

TRANSCRIPT

Page 1: Bcache and Aerospike

Bcacheand

Aerospike

LSPEDec 20, 2014

Anshu PrateekDevops, Aerospike

Page 2: Bcache and Aerospike

Agenda

● Bcache● What is bcache?

– Features

● Why bcache?● How to use bcache?● Why bcache with Aerospike?

Page 3: Bcache and Aerospike

● Anshu Prateek● Aerospike Devops Lead● Ex - Yahoo! Search Operations● http://about.me/anshuprateek● [email protected]

Page 4: Bcache and Aerospike

bcache

● Block – cache● cache in the Linux kernel's block layer● Starting Kernel >=3.10 (June 2013)

Page 5: Bcache and Aerospike

bcache?

● Kent Overstreet● http://bcache.evilpiepirate.org● https://github.com/g2p/bcache-tools.git● GNU General Public License (GPL)

Page 6: Bcache and Aerospike

What is bcache?

● creates hybrid volumes and provides performance improvements

● one or more fast storage devices, such as flash-based solid-state drives (SSDs), to act as a cache for one or more slower storage devices, such as hard disk drives

Page 7: Bcache and Aerospike

What is bcache?

Page 8: Bcache and Aerospike

Caching methods

● Write-through [default]● Write-pass● Write-around

Page 9: Bcache and Aerospike

Features

● A single cache device can be used to cache an arbitrary number of backing devices, and backing devices can be attached and detached at runtime, while mounted and in use (they run in passthrough mode when they don't have a cache).

● (But not multiple caching device for a single backing device)

Page 10: Bcache and Aerospike

Features

● Recovers from unclean shutdown - writes are not completed until the cache is consistent with respect to the backing device (Internally, bcache doesn't distinguish between clean and unclean shutdown).

● Detects and bypasses sequential IO (with a configurable threshold, and can be disabled).

Page 11: Bcache and Aerospike

Features

● Throttles traffic to the SSD if it becomes congested, detected by latency to the SSD exceeding a configurable threshold (useful if you've got one SSD for many disks).

● Readahead on cache miss (disabled by default).

Page 12: Bcache and Aerospike

Features

● Highly efficient writeback implementation; dirty data is always written out in sorted order, and if writeback_percent is enabled background writeback is smoothly throttled with a PD controller to keep around that percentage of the cache dirty.

● Very high performance b+ tree - bcache is capable of around 1M iops on random reads, if your hardware is fast enough.

Page 13: Bcache and Aerospike

Why bcache?

● BIG HDD– But slow

● Fast SSD– Smaller, comparatively costlier..

– But cheaper than RAM!

Page 14: Bcache and Aerospike

Why bcache?

● Cloud providers– AWS – Direct attached ephemeral SSD

– GCE – Local attached SSD (ephemeral)

– Persistent● AWS EBS● GCE SSD

Page 15: Bcache and Aerospike

Why bcache?

● Persistence (in cloud)

- Is network attached

- hence, slower compared to direct attached● Desktop / laptop / servers

Page 16: Bcache and Aerospike

Why bcache?

● Performance of direct attached (ephemeral)+

● Persistence of storage

Page 17: Bcache and Aerospike

How to..?

● Kernel >=3.10– Fedora, Ubuntu, Amazon Linux

● SSD– Direct attached is better

● Bigger/slower HDD/Network SSD

Page 18: Bcache and Aerospike

How to..?

● Install bcache tools● Unmount caching and backing device● Wipe existing FS (backup!)

– wipefs -a /dev/xvdb

● make-bcache -B /dev/xvdf -C /dev/xvdb● Done!

Page 19: Bcache and Aerospike

How to..?

● /sys/fs/bcache● /sys/block/bcache0

Page 20: Bcache and Aerospike

How to w/ Aerospike?

● Caching Mode

Default Write through

● Caching device– 2 or more

● Backing device– Same size as caching device

Page 21: Bcache and Aerospike

How to w/ Aerospike?

● Tuning● By default, bcache does not cache sequential

IO, just the random reads and writes that SSDs excel at. For Aerospike, we recommend enabling caching of sequential IO as well.

● Disable congestion throttling on bcache to avoid cache misses.

Page 22: Bcache and Aerospike

How to w/ Aerospike?

● We recommend using a one to one mapping between backing and caching devices to avoid cache misses. Avoid configuring a single caching device with multiple backing devices.

● Though bcache documentation shows way of creating and attaching caching and backing devices in a single command (make-bcache -B /dev/backing -C /dev/caching), we have seen problems when using this single command in cloud providers due to known bugs. Hence, we suggest not using this currently and instead use two invocations to setup the backing device and the caching device. These bugs have been fixed in the latest bcache but the fixed kernel is not available for all distros yet.

Page 23: Bcache and Aerospike

How to w/ Aerospike?

● http://www.aerospike.com/docs/operations/plan/ssd/bcache/asbcache/

Page 24: Bcache and Aerospike

Why w/ Aerospike?

● Cloud providers– No persistence w/ performance

● So far..– In-memory backed with persistence

– Costly!

● Bcache provides persistence w/ performance– At upto 80% the cost saving!!

Page 25: Bcache and Aerospike

Why w/ Aerospike?

Page 26: Bcache and Aerospike

Why w/ Aerospike?

Page 27: Bcache and Aerospike

Why w/ Aerospike?

Page 28: Bcache and Aerospike

Questions..?