Emergency

fadvise – may be not what you expect


Posted on:

|

By:


PREVIOUS POST
NEXT POST
Share Button

I often hear suggestion to use

system call to avoid caching in OS cache.
We recently made patch for

, which supposes to create archive without polluting OS cache, as like in case with backup, you do not really expect any benefits from caching.

However working on the patch, I noticed, that

with

, does not really do what I expected (I used this call as it is often suggested for this purpose). In fact it does not prevent caching, it only releases already cached data.

And if we do

, it says exactly:

So it is totally fair. What we may really want is

call.

But… But, there is surprise. It does not work. And no wonder, there is Linux kernel source code:

which means that Linux kernel does nothing on fadvise call with FADV_NOREUSE.

Digging a little more on this topic, I found
http://kerneltrap.org/node/7563, where Linus Torvalds, about 3 years ago, confirms that FADV_NOREUSE is no-op operation.
Quite hopeless that it is not fixed for many years.

As for the patch for tar, I ended up with FADV_DONTNEED call after each copy of each block. Dirty, but it works, it only uses OS cache with one block size.

You can get patch there

, it adds parameter

, along with our old patch

to throttle read IO.

Share Button
PREVIOUS POST
NEXT POST


Vadim Tkachenko

Vadim leads Percona's development group, which produces Percona Clould Tools, the Percona Server, Percona XraDB Cluster and Percona XtraBackup. He is an expert in solid-state storage, and has helped many hardware and software providers succeed in the MySQL market.



Tags:

Categories:
Hardware and Storage, MySQL


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *