The dentry_cache / dentry slab cache size continually grows on Red Hat Enterprise Linux

Solution Verified - Updated -

Issue

  • application creates a large number (~15,000/hour) of uniquely named files which are deleted after a certain time
  • Only about ~5000 files exist at any given time
  • The memory usage reported by free becomes very high
  • Investigation shows that the kernel memory slab cache of dentry structures (called dentry_cache in RHEL4 or RHEL5, called dentry in RHEL6 or RHEL7) is the cause of high usage
  • What will happen when the dentry_cache exhausts the available (cached/free) memory?
  • Why are dentry objects not freed after deletion of the file? The process owner? Could there be a hidden recycle bin somewhere due to the java delete method?
  • Can you explain the vfs_cache_pressure in more detail?
  • What other means can we do to reduce the dentry_cache size?
  • Can vm.drop_caches=2 be used?  Is there a different/preferred method? How safe is it? Can we run this a cron job?

Environment

  • Red Hat Enterprise Linux 4
  • Red Hat Enterprise Linux 5
  • Red Hat Enterprise Linux 6
  • Red Hat Enterprise Linux 7
  • Red Hat Enterprise Linux 8
  • Red Hat Enterprise Linux 9

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content