What Is DM Cache?
A DM cache is a way to create extra storage space on a data storage network. "DM" is short for "Device Mapper," a Linux tool for creating a DM cache. You can use a DM cache to provide added storage, improving your system's performance and its ability to "scale" -- or grow -- to meet increased demands from users.
-
Device Mapper
-
Device mapper is a Linux component that maps logical volumes -- storage blocks of data -- onto the physical storage space available. Device mapper also creates virtual devices to read and write blocks of data and map the data onto memory spaces. When a system stores data in a DM cache rather than physical memory, the device mapper directs queries for data to the cache, which cuts the time for recovering the data.
Cache Structure
-
A DM cache consists of the data cached there and the metadata associated with it. Metadata is data about data: the contents of a file, its size, the format the data is stored in and so on. When the device mapper steers a block of data to the cache, the computer tries to find an empty block to hold the information. If there are none, it searches for a block of data it can replace, such as a block that hasn't seen much recent use. That data will be returned to memory.
-
Advantages
-
DM caches use a simplified architecture, which makes them adaptable and easy to customize. Users can adjust the block size and the cache capacity based on the amount of data it will have to handle or on the value of the data. If a particular application needs to store a great deal of data in sequence, users can configure the cache for that purpose. If a user wants to record information in a database simultaneously with the cache, that won't interfere with the cache's operations.
Drawbacks
-
One drawback to using a DM cache is that the Linux operating system has limited space for storing metadata. If the cache is large, and includes lots of small blocks, that adds up to a lot of metadata for the stored information. To solve this problem, the user must increase the block size. Another possible problem is that, after a server crash, the cache metadata may no longer match the cache contents, though it is possible to restore the correct configuration eventually.
-