2

How can you tell how much of the filesystem cache is hot (frequently accessed) or not?

The use case would be determining when you are approaching the limits of your memory but before you actually hit them (and see a spike in page faults)

Essentially how can you tell the difference between:

1. a machine that has 4gb memory and nearly all of it is used for file caching but a process is only really accessing the same 100mb file repeatedly, and the rest was loaded over a long period of time and never accessed again (but is still cached in memory since there's no pressure to evict it)

vs

2. a machine that has 4gb memory and is repeatedly accessing 3.9gb of it (and is just on the edge of causing page faults)

John Smith
  • 21
  • 1

1 Answers1

1

I would:

  1. take a snapshot of mem swap usage
  2. drop cache using :

    sync; echo 3 > /proc/sys/vm/drop_caches

  3. monitor how cache is being used next to this.

But this may impact performance for a short period to refresh the cache if it is actually mostly hot.

tonioc
  • 1,047
  • 8
  • 11