{"id":347,"date":"2017-12-21T05:04:21","date_gmt":"2017-12-21T05:04:21","guid":{"rendered":"https:\/\/mellowhost.com\/blog\/?p=347"},"modified":"2017-12-21T05:04:51","modified_gmt":"2017-12-21T05:04:51","slug":"device-mapper-cache-you-have-created-a-cache-device-with-a-lot-of-individual-cache-blocks","status":"publish","type":"post","link":"https:\/\/mellowhost.com\/blog\/device-mapper-cache-you-have-created-a-cache-device-with-a-lot-of-individual-cache-blocks.html","title":{"rendered":"device-mapper: cache: You have created a cache device with a lot of individual cache blocks"},"content":{"rendered":"<p>The error would be similar to the following to be exact:<\/p>\n<blockquote><p>[172593.817178] device-mapper: cache: You have created a cache device with a lot of individual cache blocks (3276800)<br \/>\n[172593.817182] All these mappings can consume a lot of kernel memory, and take some time to read\/write.<br \/>\n[172593.817185] Please consider increasing the cache block size to reduce the overall cache block count.<\/p><\/blockquote>\n<p>It usually appears because you have created a large cache pool, while using a small chunk size.<\/p>\n<p>Here is what to be said about chunk size in lvmcache2 manual:<\/p>\n<blockquote><p>The size of data blocks managed by a cache pool can be specified with<br \/>\nthe &#8211;chunksize option when the cache LV is created. The default<br \/>\nunit is KiB. The value must be a multiple of 32KiB between 32KiB and<br \/>\n1GiB.<\/p>\n<p>Using a chunk size that is too large can result in wasteful use of<br \/>\nthe cache, where small reads and writes can cause large sections of<br \/>\nan LV to be mapped into the cache. However, choosing a chunk size<br \/>\nthat is too small can result in more overhead trying to manage the<br \/>\nnumerous chunks that become mapped into the cache. Overhead can<br \/>\ninclude both excessive CPU time searching for chunks, and excessive<br \/>\nmemory tracking chunks.<\/p><\/blockquote>\n<p>Basically chunk size is determining the block size at which your caches are going to be stored. To find your current chunk size run:<\/p>\n<blockquote><p>lvs -o+chunksize vgname\/cachevolumename<\/p><\/blockquote>\n<p>Should return something like the following:<\/p>\n<blockquote><p>#lvs -o+chunksize vg0\/newvz<br \/>\nLV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert Chunk<br \/>\nnewvz vg0 Cwi-aoC&#8212; 1.50t [cache] 14.14 0.75 5.12 64.00k<\/p><\/blockquote>\n<p>A good chunk size for a large cache device of size 200GB+ would be 256k. You may set the chunk size while setting up the device :<\/p>\n<blockquote><p>lvcreate &#8211;type cache-pool &#8211;chunksize 256K -L CacheSize -n CachePoolLV VG FastPVs<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>The error would be similar to the following to be exact: [172593.817178] device-mapper: cache: You have created a cache device with a lot of individual cache blocks (3276800) [172593.817182] All these mappings can consume a lot of kernel memory, and take some time to read\/write. [172593.817185] Please consider increasing the cache block size to reduce &hellip; <a href=\"https:\/\/mellowhost.com\/blog\/device-mapper-cache-you-have-created-a-cache-device-with-a-lot-of-individual-cache-blocks.html\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;device-mapper: cache: You have created a cache device with a lot of individual cache blocks&#8221;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[4,12,152,21,150,26],"tags":[156,153,155,154],"_links":{"self":[{"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/posts\/347"}],"collection":[{"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/comments?post=347"}],"version-history":[{"count":2,"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/posts\/347\/revisions"}],"predecessor-version":[{"id":349,"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/posts\/347\/revisions\/349"}],"wp:attachment":[{"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/media?parent=347"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/categories?post=347"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/tags?post=347"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}