Content deleted Content added
The RedBurn (talk | contribs) m →History: ref link update |
|||
(22 intermediate revisions by 15 users not shown) | |||
Line 1:
{{Lowercase title}}
{{Use mdy dates|date=August 2014}}
{{short description|Cache in the Linux kernel's block layer}}
{{Infobox software
| name
| title
| logo
| logo caption =
| logo_size =
| logo_alt =
| screenshot
| caption =
| screenshot_size =
| screenshot_alt =
| collapsible =
| author =
| developer
| released
| discontinued =
| latest release version =
| latest release date
| latest preview version =
| latest preview date
| status =
| programming language
| operating system
| platform =
| size =
| language =
| language count
| language footnote =
| genre
| license
| website
}}
'''bcache''' (abbreviated from ''block cache'') is a [[Cache (computing)|cache]] in the [[Linux kernel]]'s block layer, which is used for accessing [[secondary storage]] devices.
Designed around the nature and performance characteristics of SSDs, bcache also minimizes [[write amplification]] by avoiding [[random write]]s and turning them into [[sequential write]]s instead.
bcache is licensed under the [[GNU General Public License]] (GPL), and Kent Overstreet is its primary developer. Overstreet considers bcache as a "prototype" for the development of [[bcachefs]], a filesystem with significant improvements over bcache.<ref>{{cite web
| title = bcache FAQ
| url = https://bcache.evilpiepirate.org/FAQ/
| access-date = 2021-05-07
}}</ref>
== Overview ==
Using bcache makes it possible to have SSDs as another level of indirection within the data storage access paths, resulting in improved overall performance by using fast [[Flash memory|flash]]-based SSDs as caches for slower mechanical hard disk drives (HDDs) with rotational [[Magnetic storage|magnetic media]].
| url = http://www.linuxjournal.com/content/advanced-hard-drive-caching-techniques
| title = Advanced Hard Drive Caching Techniques
| date =
| author = Petros Koutoupis | publisher = [[Linux Journal]]
}}</ref>
Caching is implemented by using SSDs for storing data associated with performed [[random read]]s and random writes, using near-zero [[seek time]]s as the most prominent feature of SSDs.
| url = https://www.kernel.org/doc/Documentation/bcache.txt
| title = Linux kernel documentation: Documentation/bcache.txt
| date =
| publisher = [[kernel.org]]
}}</ref>
| url = http://bcache.evilpiepirate.org/
| title = bcache: Linux kernel block layer cache
|
| author = Kent Overstreet | website = bcache.evilpiepirate.org
}}</ref><ref name="lwn-497024">{{cite web
| url = https://lwn.net/Articles/497024/
| title = A bcache update
| date =
| author = Jonathan Corbet | publisher = [[LWN.net]]
}}</ref>
Both ''[[write-back]]'' and ''[[write-through]]'' (which is the default) policies are supported for caching write operations.
Write-back policy with batched writes to HDDs provides additional benefits to write-sensitive [[redundant array of independent disks]] (RAID) layouts such as [[RAID 5]] and [[RAID 6]], which perform actual write operations as [[Atomic operation|atomic]] [[read-modify-write]] sequences.
| url = http://www.ecs.umass.edu/ece/koren/architecture/Raid/basicRAID.html
| title = Basic RAID Organizations
|
| website = ecs.umass.edu
}}</ref> of small random writes are reduced or avoided for such RAID layouts, by grouping them together and performing as batched sequential writes.<ref name="bcache" /><ref name="lwn-497024" />
Caching performed by bcache operates at the [[block device]] level, making itself [[file system]]–agnostic as long as the file system provides an embedded [[universally unique identifier]] (UUID); this requirement is satisfied by virtually all standard [[Linux file systems]], as well as by [[Linux swap|swap partitions]].
| url = https://lwn.net/Articles/394672/
| title =
| date =
| author1 = William Stearns | author2 = Kent Overstreet
| publisher = [[LWN.net]]
Line 85 ⟶ 91:
bcache was first announced by Kent Overstreet in July 2010, as a completely working Linux kernel module, though at its early beta stage.<ref>{{cite web
| url = https://lwn.net/Articles/394905/
| title =
| date =
| author = Kent Overstreet | publisher = [[LWN.net]]
}}</ref>
It was merged into the [[Linux kernel mainline]] in kernel version 3.10, released on June 30, 2013.<ref>{{cite web |date=June 30, 2013 |title=Linux kernel 3.10, Section 1.2. bcache, a block layer cache for SSD caching |url=https://kernelnewbies.org/Linux_3.10#Bcache.2C_a_block_layer_cache_for_SSD_caching |access-date=October 4, 2013 |website=kernelnewbies.org}}</ref><ref name="bcache-kent">{{cite web
▲ | website = kernelnewbies.org
| url = http://www.linux.com/news/featured-blogs/200-libby-clark/728209-about-the-linux-kernel-bcache
| title = All About the Linux Kernel:
| date =
| access-date = October 9, 2013
| author = Libby Clark
| website = linux.com
| archive-url = https://web.archive.org/web/20130929230638/http://www.linux.com/news/featured-blogs/200-libby-clark/728209-about-the-linux-kernel-bcache/
| archive-date = September 29, 2013
}}</ref> Overstreet has since been developing the [[file system]] [[bcachefs]], based on ideas first developed in bcache that he said began "evolving ... into a full blown, general-purpose [[POSIX]] filesystem".<ref>{{cite web
| last = Larabel |first = Michael
| title = A New Linux File-System Aims For Speed While Having ZFS/Btrfs-Like Features
| url = https://www.phoronix.com/scan.php?page=article&item=bcache-fs-linux&num=1
| date = 2015-08-21 | access-date = 2018-11-22
| work = [[Phoronix]]
}}</ref> He describes bcache as a "prototype" for the ideas that became bcachefs and intends bcachefs to replace bcache.<ref>{{cite web
| last = Edge | first = Jake
| title = An update on bcachefs
| url = https://lwn.net/Articles/755276/
| date = 2018-05-23 | access-date = 2018-11-22
| work = [[LWN.net]]
}}</ref> He officially announced bcachefs in 2015 and got it merged into the mainline Linux kernel in October 2023.<ref>{{cite web
| last = Larabel | first = Michael
| title = Bcachefs Merged Into The Linux 6.7 Kernel
| url = https://www.phoronix.com/news/Bcachefs-Merged-Linux-6.7
| date = 2023-10-31 | access-date = 2023-11-20
| work = [[Phoronix]]
| language = en
}}</ref>
Line 107 ⟶ 131:
* The same cache device can be used for caching an arbitrary number of the primary storage devices
* Runtime attaching and detaching of primary storage devices from their caches, while mounted and in use (running in passthrough mode when not cached)
* Automated recovery from unclean shutdowns{{snd}} writes are not completed until the cache is consistent with respect to the primary storage device; internally, bcache makes no
* Transparent handling of I/O errors generated by the cache devices<ref name="kernel-docs" />
* [[Write barrier]]s and associated cache flushes are properly handled
Line 127 ⟶ 151:
== See also ==
{{Portal|Free and open-source software|Linux}}
* [[dm-cache]]{{snd}} a Linux kernel's device mapper target that allows creation of hybrid volumes
* [[EnhanceIO]]{{snd}} a disk cache module for the Linux kernel.
* [[Flashcache]]{{snd}} a disk cache component for the Linux kernel, initially developed by Facebook
* [[Hybrid drive]]{{snd}} a storage device that combines flash-based and spinning magnetic media storage technologies
Line 139 ⟶ 163:
== External links ==
* {{Official website|http://bcache.evilpiepirate.org/}}
* [https://lwn.net/Articles/548348/ LSFMM: Caching{{snd}} dm-cache and bcache], [[LWN.net]], May 1, 2013, by Jake Edge
* [http://en.community.dell.com/techcenter/extras/m/white_papers/20438199/download Linux Block Caching Choices in Stable Upstream Kernel] (PDF), [[Dell]], December 2013
* Testing bcache series: {{usurped|1=[https://web.archive.org/web/20100829082801/http://www.linux-mag.com/id/7843/ Throughput]}}, {{usurped|1=[https://web.archive.org/web/20100911085025/http://www.linux-mag.com/id/7847 IOPS]}}, {{usurped|1=[https://web.archive.org/web/20100920062520/http://www.linux-mag.com/id/7852 Metadata]}}, and {{usurped|1=[https://web.archive.org/web/20101002103446/http://www.linux-mag.com/id/7858
* [http://lkml.indiana.edu/hypermail/linux/kernel/1306.1/01246.html Performance Comparison among EnhanceIO, bcache and dm-cache], [[LKML]], June 11, 2013
* [https://www.phoronix.com/scan.php?page=news_item&px=MTM4ODA EnhanceIO, Bcache & DM-Cache Benchmarked], [[Phoronix]], June 11, 2013, by Michael Larabel
|