메뉴 건너뛰기

신축건물 하자 보수 센터

Fehnocache Minimize Caching Effects GitHub

WalkerFortier222 2026.07.14 14:18 조회 수 : 1

免费俄罗斯色情 - https://mrq.com/.

Fehnocache minimize caching effects GitHub


What is this tool good for:


What this tool is not good for:


So then why does this tool exist?


How to run a process and its children in a memory-bounded cgroup


Do this if you e.g. want to run a backup but don’t want your system to slow
down due to page cache thrashing.


If your distro uses systemd, this is very easy. Systemd allows to run a
process (and its subprocesses) in a "scope", which is a cgroup, and you can
specify parameters that get translated to cgroup limits.


When I run my backups, I do:


The effect is that cache space stays bounded by an additional max 500MiB:


Before:


During (notice how buff/cache only goes up by ~300MiB):


Use systemd-cgls to list the cgroups systemd creates. On my system, the above
command creates a group called run-u467.scope in the system.slice parent
group; you can inspect its memory settings like this:


Install cgroup-tools and be prepared to enter your root password to initially
create cgroups.


After entering this, your shell is a member of that cgroup, and any new process
spawned will belong to that cgroup, too, and inherit the memory limit. The
cgroups created like this won’t be cleaned up automatically.


More info: https://www.kernel.org/doc/Documentation/cgroup-v1/memory.txt


The nocache tool tries to minimize the effect an application has on
the Linux file system cache. This is done by intercepting the open
and close system calls and calling posix_fadvise with the
POSIX_FADV_DONTNEED parameter. Because the library remembers which
pages (ie., 4K-blocks of the file) were already in file system cache
when the file was opened, these will not be marked as "don't need",
because other applications might need that, although they are not
actively used (think: hot standby).


Just type make. Then, prepend ./nocache to your command:


The command make install will install the shared library, man
pages and the nocache, cachestats and cachedel commands
under /usr/local. You can specify an alternate prefix by using
make install PREFIX=/usr.


Debian packages are available, see https://packages.qa.debian.org/n/nocache.html.


Please note that nocache will only build on a system that has
support for the posix_fadvise syscall and exposes it, too. This
should be the case on most modern Unices, but kfreebsd notably has no
support for this as of now.


For testing purposes, I included two small tools:


It looks like this:


Also, you can use vmstat 1 to view cache statistics.


For debugging purposes, you can specify a filename that nocache should log
debugging messages to via the -D command line switch, e.g. use nocache -D /tmp/nocache.log …. Note that for simple testing the file /dev/stderr
might be a good choice.


Without nocache, the file will be fully cached when you copy it
somewhere:


With nocache, the original caching state will be preserved.


The pre-loaded library tries really hard to catch all system calls
that open or close a file. This happens by "hijacking" the libc
functions that wrap the actual system calls. In some cases, this may
fail, for example because the application does some clever wrapping.
(That is the reason why __openat_2 is defined: GNU tar uses this
instead of a regular openat.)


However, since the actual fadvise calls are performed right before
the file descriptor is closed, this may not happen if they are left
open when the application exits, although the destructor tries to do
that.


There are timing issues to consider, as well. If you consider nocache cat , in most (all?) cases the cache will not be restored. For
discussion and possible solutions see http://lwn.net/Articles/480930/.
My experience showed that in many cases you could "fix" this by doing
the posix_fadvise call twice. For both tools nocache and
cachedel you can specify the number using -n, like so:


This actually only sets the environment variable NOCACHE_NR_FADVISE
to the specified value, and the shared library reads out this value.
If test number 3 in t/basic.t fails, then try increasing this number
until it works, e.g.:

莫斯科旅行全攻略,身体与精神双重享受,一般人我不告诉他

One could also consider that the fact pages are kept mean the kernel
considers they are hot, and decide the overhead of allocating one byte
per page for mincore and the actual mincore calls are not worth it when
the kernel actually does keep some pages when it wants to.


In this case you can either run nocache with -f or set the
NOCACHE_FLUSHALL environment variable to 1, e.g.:


By default nocache will only keep track of file descriptors less than 2^20
that are opened by your application, in order to bound its memory
consumption. If you want to change this threshold, you can supply the
environment variable NOCACHE_MAX_FDS and set it to a higher (or lower) value.
It should specify a value one greater than the maximum file descriptor that
will be handled by nocache.


Most of the application logic is from Tobias Oetiker's patch for
rsync http://insights.oetiker.ch/linux/fadvise.html. Note however,
that rsync uses sockets, so if you try a nocache rsync, only
the local process will be intercepted.

번호 제목 글쓴이 날짜 조회 수
40939 Can I Wipe Out Tax Debt In Liquidation? NidaKirkcaldie70014 2026.07.18 3
40938 Irs Taxes Owed - If Capone Can't Dodge It, Neither Can You KayleneRace22402 2026.07.18 1
40937 10 Tax Tips To Lessen Costs And Increase Income BriannaP479167290353 2026.07.18 14
40936 13 Aspects Of Kitchen Area Design You May Not Have Known Lila4463428783417 2026.07.18 0
40935 Bad Credit Loans - 9 Stuff You Need Find Out About Australian Low Doc Loans RuebenDeatherage57 2026.07.18 0
40934 Sales Tax Audit Survival Tips For The Glass Sell! Adolph7445905254025 2026.07.18 2
40933 Annual Taxes - Humor In The Drudgery ElwoodKohler157 2026.07.18 0
40932 When Is A Tax Case Considered A Felony? Angelina83M522510078 2026.07.18 0
40931 Details Of 2010 Federal Income Tax Return LeandraXmo42265416156 2026.07.18 2
40930 A Good Reputation For Taxes - Part 1 SantoDacre97846920464 2026.07.18 0
40929 Norfolk Broads Holidays - Dead Or Alive? CaroleCoode70198432 2026.07.18 22
40928 Declaring Back Taxes Owed From Foreign Funds In Offshore Banking Accounts HazelHalvorsen995 2026.07.18 1
40927 How To Rebound Your Credit Score After A Monetary Disaster! TristaDees11770603 2026.07.18 1
40926 Smart Taxes Saving Tips PaulinaApj42758 2026.07.18 0
40925 10 Reasons Why Hiring Tax Service Is A Must! HubertJose87373237 2026.07.18 2
40924 Government Tax Deed Sales CamillaG262090943742 2026.07.18 0
40923 10 Tax Tips To Cut Back Costs And Increase Income AlexandriaCotter9240 2026.07.18 0
40922 Reduce The Carbon Footprint: How To Lower My Carbon Footprint Guide DeenaGair81787398739 2026.07.18 0
40921 Mastering Kiting In Tower Rush JeffreyCarslaw2 2026.07.18 0
40920 Full Episode Guide And Season-by-Season Recap For The Gaslight District LuzFyans8918328134 2026.07.18 0
위로