Page cache limit

user331398 picture user331398 · Jun 17, 2013 · Viewed 8.6k times · Source

I'm using Ubuntu with kernel 3.2.1, x86_64. I'm trying to benchmark a file system, and I want to limit the page cache size to avoid the file system cache taking up too much RAM, which would obviously improve performance (but would not reflect the results on systems with less memory).

Is there a way to do that? I've seen an option in some RHEL distribution for tuning /proc/sys/vm/pagecaches which seems to satisfy this, but I dont see anything useful in Ubuntu except dirty_background_ratio, which will only trigger flushing to disk, not more caching (so I can get a lot more sync I/O etc)

Thank you

Answer

V H picture V H · Jun 17, 2013

ubuntu does not seem to have vm.pagecache settings

ls -l /proc/sys/vm/
total 0
-rw-r--r-- 1 root root 0 Jun 17 14:13 block_dump
--w------- 1 root root 0 Jun 17 14:13 compact_memory
-rw-r--r-- 1 root root 0 Jun 17 14:13 dirty_background_bytes
-rw-r--r-- 1 root root 0 Jun 17 09:16 dirty_background_ratio
-rw-r--r-- 1 root root 0 Jun 17 14:13 dirty_bytes
-rw-r--r-- 1 root root 0 Jun 17 14:13 dirty_expire_centisecs
-rw-r--r-- 1 root root 0 Jun 17 09:16 dirty_ratio
-rw-r--r-- 1 root root 0 Jun 17 09:16 dirty_writeback_centisecs
-rw-r--r-- 1 root root 0 Jun 17 14:13 drop_caches
-rw-r--r-- 1 root root 0 Jun 17 14:13 extfrag_threshold
-rw-r--r-- 1 root root 0 Jun 17 14:13 hugepages_treat_as_movable
-rw-r--r-- 1 root root 0 Jun 17 14:13 hugetlb_shm_group
-rw-r--r-- 1 root root 0 Jun 17 09:16 laptop_mode
-rw-r--r-- 1 root root 0 Jun 17 14:13 legacy_va_layout
-rw-r--r-- 1 root root 0 Jun 17 14:13 lowmem_reserve_ratio
-rw-r--r-- 1 root root 0 Jun 17 14:13 max_map_count
-rw-r--r-- 1 root root 0 Jun 17 14:13 memory_failure_early_kill
-rw-r--r-- 1 root root 0 Jun 17 14:13 memory_failure_recovery
-rw-r--r-- 1 root root 0 Jun 17 14:13 min_free_kbytes
-rw-r--r-- 1 root root 0 Jun 17 14:13 min_slab_ratio
-rw-r--r-- 1 root root 0 Jun 17 14:13 min_unmapped_ratio
-rw-r--r-- 1 root root 0 Jun 17 09:15 mmap_min_addr
-rw-r--r-- 1 root root 0 Jun 17 14:13 nr_hugepages
-rw-r--r-- 1 root root 0 Jun 17 14:13 nr_hugepages_mempolicy
-rw-r--r-- 1 root root 0 Jun 17 14:13 nr_overcommit_hugepages
-r--r--r-- 1 root root 0 Jun 17 14:13 nr_pdflush_threads
-rw-r--r-- 1 root root 0 Jun 17 14:13 numa_zonelist_order
-rw-r--r-- 1 root root 0 Jun 17 14:13 oom_dump_tasks
-rw-r--r-- 1 root root 0 Jun 17 14:13 oom_kill_allocating_task
-rw-r--r-- 1 root root 0 Jun 17 09:15 overcommit_memory
-rw-r--r-- 1 root root 0 Jun 17 14:13 overcommit_ratio
-rw-r--r-- 1 root root 0 Jun 17 14:13 page-cluster
-rw-r--r-- 1 root root 0 Jun 17 14:13 panic_on_oom
-rw-r--r-- 1 root root 0 Jun 17 14:13 percpu_pagelist_fraction
-rw-r--r-- 1 root root 0 Jun 17 14:13 scan_unevictable_pages
-rw-r--r-- 1 root root 0 Jun 17 14:13 stat_interval
-rw-r--r-- 1 root root 0 Jun 17 14:13 swappiness
-rw-r--r-- 1 root root 0 Jun 17 14:13 vfs_cache_pressure
-rw-r--r-- 1 root root 0 Jun 17 14:13 zone_reclaim_mode

you could try the following:

vi /etc/sysctl.conf

vm.min_free_kbytes=1024
vm.swappiness = 100

then run

sysctl -p
vm.min_free_kbytes = 1024
vm.swappiness = 100

Unsure if it is of any help.

The swapiness 100 Swap more application data to disk when ram is exhausted