Bcache and Aerospike

6,266 views

Published on

What is bcache? Why to use bcache? How to use bcache?
Presentation at LSPE on Dec 20, 2014

Published in: Software
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
6,266
On SlideShare
0
From Embeds
0
Number of Embeds
4,793
Actions
Shares
0
Downloads
11
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

Bcache and Aerospike

  1. 1. Bcache and Aerospike LSPE Dec 20, 2014 Anshu Prateek Devops, Aerospike
  2. 2. Agenda ● Bcache ● What is bcache? – Features ● Why bcache? ● How to use bcache? ● Why bcache with Aerospike?
  3. 3. ● Anshu Prateek ● Aerospike Devops Lead ● Ex - Yahoo! Search Operations ● http://about.me/anshuprateek ● anshu@aerospike.com
  4. 4. bcache ● Block – cache ● cache in the Linux kernel's block layer ● Starting Kernel >=3.10 (June 2013)
  5. 5. bcache? ● Kent Overstreet ● http://bcache.evilpiepirate.org ● https://github.com/g2p/bcache-tools.git ● GNU General Public License (GPL)
  6. 6. 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
  7. 7. What is bcache?
  8. 8. Caching methods ● Write-through [default] ● Write-pass ● Write-around
  9. 9. 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)
  10. 10. 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).
  11. 11. 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).
  12. 12. 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.
  13. 13. Why bcache? ● BIG HDD – But slow ● Fast SSD – Smaller, comparatively costlier.. – But cheaper than RAM!
  14. 14. Why bcache? ● Cloud providers – AWS – Direct attached ephemeral SSD – GCE – Local attached SSD (ephemeral) – Persistent ● AWS EBS ● GCE SSD
  15. 15. Why bcache? ● Persistence (in cloud) - Is network attached - hence, slower compared to direct attached ● Desktop / laptop / servers
  16. 16. Why bcache? ● Performance of direct attached (ephemeral) + ● Persistence of storage
  17. 17. How to..? ● Kernel >=3.10 – Fedora, Ubuntu, Amazon Linux ● SSD – Direct attached is better ● Bigger/slower HDD/Network SSD
  18. 18. 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!
  19. 19. How to..? ● /sys/fs/bcache ● /sys/block/bcache0
  20. 20. How to w/ Aerospike? ● Caching Mode Default Write through ● Caching device – 2 or more ● Backing device – Same size as caching device
  21. 21. 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.
  22. 22. 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.
  23. 23. How to w/ Aerospike? ● http://www.aerospike.com/docs/operations/plan/ ssd/bcache/asbcache/
  24. 24. 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!!
  25. 25. Why w/ Aerospike?
  26. 26. Why w/ Aerospike?
  27. 27. Why w/ Aerospike?
  28. 28. Questions..?

×