Databases Reference
In-Depth Information
However, this doesn't work infinitely, and some transactional or insert-heavy work-
loads don't benefit from this approach anyway. Flash storage can help here, too.
Single-threaded workloads are another characteristic scenario where flash can poten-
tially help. When a workload is single-threaded it is very sensitive to latency, and the
lower latency of solid-state storage makes a big difference. In contrast, multi-threaded
workloads can often simply be parallelized more heavily to get more throughput.
MySQL replication is the obvious example of a single-threaded workload that benefits
a lot from reduced latency. Using flash storage on replicas can often improve their
performance significantly when they are having trouble keeping up with the master.
Flash is also great for server consolidation, especially in the PCIe form factor. We've
seen opportunities to consolidate many server instances onto a single physical server—
sometimes up to a 10- or 15-fold consolidation is possible. See Chapter 11 for more on
this topic.
Flash isn't always the answer, though. A good example is for sequential write workloads
such as the InnoDB log files. Flash doesn't offer much of a cost-to-performance ad-
vantage in this scenario, because it's not much faster at sequential writes than standard
hard drives are. Such workloads are also high-throughput, which will wear out the
device faster. It's often a better idea to store your log files on standard hard drives, with
a RAID controller that has a battery-backed write cache.
And sometimes the answer lies in the memory-to-disk ratio, not just in the disk. If you
can buy enough RAM to cache your workload, you may find this cheaper and more
effective than purchasing a flash storage device.
Using Flashcache
Although there are many opportunities to make tradeoffs between flash storage, hard
disks, and RAM, these don't have to be treated as single-component tiers in the storage
hierarchy. Sometimes it makes sense to use a combination of disk and memory tech-
nologies, and that's what Flashcache does.
Flashcache is one implementation of a technique you can find used in many systems,
such as Oracle Database, the ZFS filesystem, and even many modern hard drives and
RAID controllers. Much of the following discussion applies broadly, but to keep things
concrete we'll focus only on Flashcache, because it is vendor-and filesystem-agnostic.
Flashcache is a Linux kernel module that uses the Linux device mapper. It creates an
intermediate layer in the memory hierarchy, between RAM and the disk. It is one of
the open source technologies created by Facebook and is used to help optimize Face-
book's hardware for its database workload.
Flashcache creates a block device, which can be partitioned and used to create a file-
system like any other. The trick is that this block device is backed by both flash and
disk storage. The flash device is used as an intelligent cache for both reads and writes.
 
Search WWH ::




Custom Search