Advanced Hard Drive Caching Techniques
Using a benchmarking utility, the numbers will vary. On read operations, it is wholly dependent on whether the desired data resides in cache or whether the module needs to retrieve it from the slower disk. On write operations, it depends on the Flash technology itself, and whether it needs to go through a typical programmable erase (PE) cycle to write the new data. Regardless of this, the random read/write access to the slower drive has been increased significantly:
Sequential read: 105MB/s
Sequential write: 50MB/s
Random read: 67MB/s
Random write: 51MB/s
You can continue monitoring the cache status by typing:
$ sudo dmsetup status cache 0 20971520 cache stats: reads(301319), writes(353216), ↪cache hits(24485, 0.3),replacement(345972), ↪replaced dirty blocks(92857)
To remove the cache mapping, unmount the drive and invoke dmsetup:
$ sudo umount /mnt/cache $ sudo dmsetup remove cache
FlashCache is a project developed and maintained by Facebook. It was inspired by dm-cache. Much like dm-cache, it too is built from the device-mapper framework. It currently is hosted on GitHub and can be cloned from there. The repository encompasses the kernel module and administration utilities. Once built and installed, load the kernel module and in a similar fashion to the previous examples, create a mapping of the SSD and HDD:
$ sudo modprobe flashcache $ sudo flashcache_create -p back -b 8 cache /dev/sdb /dev/sda3 cachedev cache, ssd_devname /dev/sdb, disk_devname /dev/sda3 ↪cache mode WRITE_BACK block_size 8, md_block_size 8, ↪cache_size 0 FlashCache metadata will use 223MB of your 3944MB main memory
The flashcache_create administration utility is similar to the dmc-setup.pl Perl script used for dm-cache. It is a wrapper utility designed to simplify the dmsetup process. As with the dm-cache module, once the mapping has been created, you can view mapping details by typing:
$ sudo dmsetup table cache 0 20971520 flashcache conf: ssd dev (/dev/sdb), disk dev (/dev/sda3) cache mode(WRITE_BACK) capacity(57018M), associativity(512), data block size(4K) ↪metadata block size(4096b) skip sequential thresh(0K) total blocks(14596608), cached blocks(83), cache percent(0) dirty blocks(0), dirty percent(0) nr_queued(0) Size Hist: 4096:83 $ sudo dmsetup status cache 0 20971520 flashcache stats: reads(83), writes(0) read hits(0), read hit percent(0) write hits(0) write hit percent(0) dirty write hits(0) dirty write hit percent(0) replacement(0), write replacement(0) write invalidates(0), read invalidates(0) pending enqueues(0), pending inval(0) metadata dirties(0), metadata cleans(0) metadata batch(0) metadata ssd writes(0) cleanings(0) fallow cleanings(0) no room(0) front merge(0) back merge(0) disk reads(83), disk writes(0) ssd reads(0) ssd writes(83) uncached reads(0), uncached writes(0), uncached IO requeue(0) disk read errors(0), disk write errors(0) ssd read errors(0) ↪ssd write errors(0) uncached sequential reads(0), uncached sequential writes(0) pid_adds(0), pid_dels(0), pid_drops(0) pid_expiry(0)
Mount the mapping for file accessibility:
$ sudo mount /dev/mapper/cache /mnt/cache
Using the same benchmarking utility, observe the differences between FlashCache and the previous module:
Sequential read: 284MB/s
Sequential write: 72MB/s
Random read: 284MB/s
Random write: 71MB/s
The numbers look more like the native SSD performance. However, I want to note that this article is not intended to prove that one solution performs better than the other, but instead to enlighten readers of the many methods you can use to accelerate data access to existing and slower configurations.
To unmount and remove the drive mapping, type the following in the terminal:
$ sudo umount /mnt/cache $ sudo dmsetup remove /dev/mapper/cache
Petros Koutoupis is currently a senior software developer at Cleversafe, an IBM Company. He is also the creator and maintainer of the RapidDisk Project. Petros has worked in the data storage industry for more than a decade.
Practical Task Scheduling Deployment
July 20, 2016 12:00 pm CDT
One of the best things about the UNIX environment (aside from being stable and efficient) is the vast array of software tools available to help you do your job. Traditionally, a UNIX tool does only one thing, but does that one thing very well. For example, grep is very easy to use and can search vast amounts of data quickly. The find tool can find a particular file or files based on all kinds of criteria. It's pretty easy to string these tools together to build even more powerful tools, such as a tool that finds all of the .log files in the /home directory and searches each one for a particular entry. This erector-set mentality allows UNIX system administrators to seem to always have the right tool for the job.
Cron traditionally has been considered another such a tool for job scheduling, but is it enough? This webinar considers that very question. The first part builds on a previous Geek Guide, Beyond Cron, and briefly describes how to know when it might be time to consider upgrading your job scheduling infrastructure. The second part presents an actual planning and implementation framework.
Join Linux Journal's Mike Diehl and Pat Cameron of Help Systems.
Free to Linux Journal readers.Register Now!
- SUSE LLC's SUSE Manager
- My +1 Sword of Productivity
- Murat Yener and Onur Dundar's Expert Android Studio (Wrox)
- Managing Linux Using Puppet
- Non-Linux FOSS: Caffeine!
- Doing for User Space What We Did for Kernel Space
- SuperTuxKart 0.9.2 Released
- Google's SwiftShader Released
- Parsing an RSS News Feed with a Bash Script
- SourceClear Open
With all the industry talk about the benefits of Linux on Power and all the performance advantages offered by its open architecture, you may be considering a move in that direction. If you are thinking about analytics, big data and cloud computing, you would be right to evaluate Power. The idea of using commodity x86 hardware and replacing it every three years is an outdated cost model. It doesn’t consider the total cost of ownership, and it doesn’t consider the advantage of real processing power, high-availability and multithreading like a demon.
This ebook takes a look at some of the practical applications of the Linux on Power platform and ways you might bring all the performance power of this open architecture to bear for your organization. There are no smoke and mirrors here—just hard, cold, empirical evidence provided by independent sources. I also consider some innovative ways Linux on Power will be used in the future.Get the Guide