{"id":1300,"date":"2026-10-05T03:05:54","date_gmt":"2026-10-05T03:05:54","guid":{"rendered":"https:\/\/virtualserversvps.com\/blog\/?p=1300"},"modified":"2026-10-05T03:05:54","modified_gmt":"2026-10-05T03:05:54","slug":"tuning-vfs-cache-pressure-dentry-inode-small-vps","status":"publish","type":"post","link":"https:\/\/virtualserversvps.com\/blog\/tuning-vfs-cache-pressure-dentry-inode-small-vps\/","title":{"rendered":"Tuning Linux File Cache Pressure (vm.vfs_cache_pressure) on a VPS"},"content":{"rendered":"<div style=\"padding:20px\">\n\n<p class=\"wp-block-paragraph\"><code>vm.vfs_cache_pressure<\/code> controls how aggressively the kernel reclaims <em>dentry<\/em> and <em>inode<\/em> caches relative to page cache. Most tuning guides set it to 50 or 200 without explaining what it actually changes. On a small VPS serving many small files &mdash; WordPress, a git server, a container host &mdash; getting this wrong means either constant inode re-lookups or stalled directory traversal. This article explains the mechanism and how to measure it.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What the parameter really does<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The value is a scaling percentage, not a hard target. At 100 the kernel balances reclaim between dentry\/inode slabs and page cache proportionally to their size. Below 100 (e.g. 50) the kernel keeps dentries and inodes longer &mdash; it is <em>less<\/em> pressured to evict them. Above 100 (e.g. 200) it evicts them more eagerly, favouring page cache. The name is misleading: higher value = higher pressure = faster eviction of the directory caches.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># current value and where it lives\nsysctl vm.vfs_cache_pressure\ncat \/proc\/sys\/vm\/vfs_cache_pressure\n\n# persistent drop-in (recommended over editing sysctl.conf)\ncat &gt;\/etc\/sysctl.d\/60-vfs-cache.conf &lt;&lt;'EOF'\nvm.vfs_cache_pressure=50\nEOF\nsysctl --system<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Watch the slabs<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Dentries and inodes are exposed via slabinfo. Track <code>dentry<\/code> and <code>ext4_inode_cache<\/code> (or the btrfs equivalents) over time:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># object counts and memory per cache\ngrep -E 'dentry|inode_cache' \/proc\/slabinfo | awk '{print $1,$2,$3,$4*$5\/1024\" KB\"}'\n\n# total reclaimable slab memory\ncat \/proc\/meminfo | grep -E 'Slab|SReclaimable|SUnreclaim'<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">On a host serving thousands of small files, a healthy configuration shows <code>dentry<\/code> and inode slabs growing to a stable plateau and <code>SReclaimable<\/code> accounting for most of the slab. If <code>SUnreclaim<\/code> dominates, you have a kernel leak, not a cache-pressure problem &mdash; lowering pressure will not help, and you must not raise it.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Value<\/th><th>Behaviour<\/th><th>Best for<\/th><\/tr><\/thead><tbody><tr><td>50<\/td><td>Keeps dentries\/inodes longer<\/td><td>Many small files, WordPress, git, containers<\/td><\/tr><tr><td>100<\/td><td>Default proportional balance<\/td><td>General purpose<\/td><\/tr><tr><td>200&ndash;500<\/td><td>Evicts metadata eagerly<\/td><td>Large-file streaming, NFS client<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Measure the effect, don&#8217;t guess<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Use a filesystem-walk benchmark that stresses the dentry cache, then compare at different pressure values. Drop caches between runs so each starts cold:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># cold-cache directory traversal\necho 3 &gt; \/proc\/sys\/vm\/drop_caches\n\/usr\/bin\/time -v find \/var\/www -type f -printf '' 2&gt;&amp;1 | grep -E 'wall clock|Minor'\n\n# stat every file, forces inode lookups\nfind \/var\/www -type f -exec stat -c '%i %s' {} + &gt;\/dev\/null\n\n# repeat with the other value\nsysctl -w vm.vfs_cache_pressure=200<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">On typical web workloads the difference is real but modest: a warm dentry cache can cut <code>find<\/code> wall time by 30&ndash;50% versus a cold one, and keeping it warm across bursts of traffic avoids repeated inode lookups. Lowering pressure to 50 helps when your working set of paths fits in RAM but your workload is path-heavy. It does <em>not<\/em> help when the working set exceeds memory &mdash; then you are simply trading page cache for metadata and may slow file reads.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Interaction with swappiness and dirty ratios<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>vm.swappiness<\/code> decides anonymous vs file-backed reclaim; vfs_cache_pressure then splits the file-backed side.<\/li>\n<li><code>vm.dirty_ratio<\/code> \/ <code>vm.dirty_background_ratio<\/code> gate writeback and can dominate behaviour under heavy writes regardless of cache pressure.<\/li>\n<li>On a small VPS, set swappiness low (10&ndash;20) with a pressure of 50 for a path-heavy app, and always confirm with slab counters rather than trusting the number.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Because these tunables only matter when memory is genuinely constrained, they are most effective on small instances where RAM is the bottleneck. When you outgrow 1&ndash;2&nbsp;GB, more memory solves more than any sysctl &mdash; compare VPS hosting providers and size the plan to your file-path working set before you spend hours micro-tuning.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Bottom line: treat <code>vm.vfs_cache_pressure<\/code> as a dial that trades metadata cache for page cache, validate every change against <code>\/proc\/slabinfo<\/code> and a cold-cache filesystem walk, and leave it at 100 unless your measurements show a clear win.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>Sponsored: if you need a VPS with predictable memory and no hidden steals, <a href=\"https:\/\/interserver.net\/vps?id=1067805&amp;sid=virtualserversvps\" rel=\"noreferrer noopener sponsored\" target=\"_blank\">InterServer VPS plans<\/a> are worth a look.<\/em><\/p>\n\n<\/div>","protected":false},"excerpt":{"rendered":"<p>vm.vfs_cache_pressure controls how aggressively the kernel reclaims dentry and inode caches relative to page cache. Most tuning guides set it to 50 or 200 without explaining what it actually changes&#8230;.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":6,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1300","post","type-post","status-publish","format-standard","hentry","category-vps-guides-tutorials"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.1 (Yoast SEO v26.1) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Tuning Linux File Cache Pressure (vm.vfs_cache_pressure) on a VPS - Virtual Servers VPS Blog<\/title>\n<meta name=\"description\" content=\"vm.vfs_cache_pressure controls how aggressively the kernel reclaims dentry and inode caches relative to page cache. Most tuning guides set it to 50 or 200\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/virtualserversvps.com\/blog\/tuning-vfs-cache-pressure-dentry-inode-small-vps\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Tuning Linux File Cache Pressure (vm.vfs_cache_pressure) on a VPS\" \/>\n<meta property=\"og:description\" content=\"Tuning Linux File Cache Pressure (vm.vfs_cache_pressure) on a VPS\" \/>\n<meta property=\"og:url\" content=\"https:\/\/virtualserversvps.com\/blog\/tuning-vfs-cache-pressure-dentry-inode-small-vps\/\" \/>\n<meta property=\"og:site_name\" content=\"Virtual Servers VPS Blog\" \/>\n<meta property=\"article:published_time\" content=\"2026-10-05T03:05:54+00:00\" \/>\n<meta name=\"author\" content=\"Virtual-Servers-Vps-Editor\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Virtual-Servers-Vps-Editor\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/virtualserversvps.com\/blog\/tuning-vfs-cache-pressure-dentry-inode-small-vps\/\",\"url\":\"https:\/\/virtualserversvps.com\/blog\/tuning-vfs-cache-pressure-dentry-inode-small-vps\/\",\"name\":\"Tuning Linux File Cache Pressure (vm.vfs_cache_pressure) on a VPS - Virtual Servers VPS Blog\",\"isPartOf\":{\"@id\":\"https:\/\/virtualserversvps.com\/blog\/#website\"},\"datePublished\":\"2026-10-05T03:05:54+00:00\",\"author\":{\"@id\":\"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/82a299a8284a66ff49f97c74684724a0\"},\"description\":\"vm.vfs_cache_pressure controls how aggressively the kernel reclaims dentry and inode caches relative to page cache. Most tuning guides set it to 50 or 200\",\"breadcrumb\":{\"@id\":\"https:\/\/virtualserversvps.com\/blog\/tuning-vfs-cache-pressure-dentry-inode-small-vps\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/virtualserversvps.com\/blog\/tuning-vfs-cache-pressure-dentry-inode-small-vps\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/virtualserversvps.com\/blog\/tuning-vfs-cache-pressure-dentry-inode-small-vps\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/virtualserversvps.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Tuning Linux File Cache Pressure (vm.vfs_cache_pressure) on a VPS\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/virtualserversvps.com\/blog\/#website\",\"url\":\"https:\/\/virtualserversvps.com\/blog\/\",\"name\":\"Virtual Servers VPS Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/virtualserversvps.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/82a299a8284a66ff49f97c74684724a0\",\"name\":\"Virtual-Servers-Vps-Editor\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/d820b15f1cd028e97610d9adf536df7be5cb6423869967037d468d5355fa003f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/d820b15f1cd028e97610d9adf536df7be5cb6423869967037d468d5355fa003f?s=96&d=mm&r=g\",\"caption\":\"Virtual-Servers-Vps-Editor\"},\"sameAs\":[\"https:\/\/virtualserversvps.com\/blog\"],\"url\":\"https:\/\/virtualserversvps.com\/blog\/author\/virtualserversvps\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Tuning Linux File Cache Pressure (vm.vfs_cache_pressure) on a VPS - Virtual Servers VPS Blog","description":"vm.vfs_cache_pressure controls how aggressively the kernel reclaims dentry and inode caches relative to page cache. Most tuning guides set it to 50 or 200","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/virtualserversvps.com\/blog\/tuning-vfs-cache-pressure-dentry-inode-small-vps\/","og_locale":"en_US","og_type":"article","og_title":"Tuning Linux File Cache Pressure (vm.vfs_cache_pressure) on a VPS","og_description":"Tuning Linux File Cache Pressure (vm.vfs_cache_pressure) on a VPS","og_url":"https:\/\/virtualserversvps.com\/blog\/tuning-vfs-cache-pressure-dentry-inode-small-vps\/","og_site_name":"Virtual Servers VPS Blog","article_published_time":"2026-10-05T03:05:54+00:00","author":"Virtual-Servers-Vps-Editor","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Virtual-Servers-Vps-Editor","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/virtualserversvps.com\/blog\/tuning-vfs-cache-pressure-dentry-inode-small-vps\/","url":"https:\/\/virtualserversvps.com\/blog\/tuning-vfs-cache-pressure-dentry-inode-small-vps\/","name":"Tuning Linux File Cache Pressure (vm.vfs_cache_pressure) on a VPS - Virtual Servers VPS Blog","isPartOf":{"@id":"https:\/\/virtualserversvps.com\/blog\/#website"},"datePublished":"2026-10-05T03:05:54+00:00","author":{"@id":"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/82a299a8284a66ff49f97c74684724a0"},"description":"vm.vfs_cache_pressure controls how aggressively the kernel reclaims dentry and inode caches relative to page cache. Most tuning guides set it to 50 or 200","breadcrumb":{"@id":"https:\/\/virtualserversvps.com\/blog\/tuning-vfs-cache-pressure-dentry-inode-small-vps\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/virtualserversvps.com\/blog\/tuning-vfs-cache-pressure-dentry-inode-small-vps\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/virtualserversvps.com\/blog\/tuning-vfs-cache-pressure-dentry-inode-small-vps\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/virtualserversvps.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Tuning Linux File Cache Pressure (vm.vfs_cache_pressure) on a VPS"}]},{"@type":"WebSite","@id":"https:\/\/virtualserversvps.com\/blog\/#website","url":"https:\/\/virtualserversvps.com\/blog\/","name":"Virtual Servers VPS Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/virtualserversvps.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/82a299a8284a66ff49f97c74684724a0","name":"Virtual-Servers-Vps-Editor","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/d820b15f1cd028e97610d9adf536df7be5cb6423869967037d468d5355fa003f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d820b15f1cd028e97610d9adf536df7be5cb6423869967037d468d5355fa003f?s=96&d=mm&r=g","caption":"Virtual-Servers-Vps-Editor"},"sameAs":["https:\/\/virtualserversvps.com\/blog"],"url":"https:\/\/virtualserversvps.com\/blog\/author\/virtualserversvps\/"}]}},"_links":{"self":[{"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/posts\/1300","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/comments?post=1300"}],"version-history":[{"count":1,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/posts\/1300\/revisions"}],"predecessor-version":[{"id":1301,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/posts\/1300\/revisions\/1301"}],"wp:attachment":[{"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/media?parent=1300"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/categories?post=1300"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/tags?post=1300"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}