Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Our server is performing decently, but when backups or other scan processes run it will tank the entire server. Something like clamd will run and scan many files. While we expect slow performance, it's killing our cache and the end result is we don't get a system that can do anything.

Is there a way to disable disc/disk caching for a single command? The idea would be to run it like this:

# ./nocache clamd

Then while running clamd it would not thrash the primed cache while reading all the files on the system.

share|improve this question

2 Answers 2

up vote 2 down vote accepted

It has to be implemented in the program itself. If clamd doesn't already do it, you can modify clamd to avoid an unnecessarily large cache footprint by adding calls to functions like posix_fadvise(... POSIX_FADV_NOREUSE) or madvise(... MADV_DONTNEED) (if it memory maps the files). It will still push filesystem metadata out of the cache though. There's not much you can do about that.

share|improve this answer
    
Sad we don't have a user-level way, but thanks for the information. A madman could use a hook or create a process that executes the other code having called this POSIX function (or use LD_LIB) –  Kristopher Ives Nov 29 '11 at 23:22

Its not really the answer you are looking for but we just use ionice for backups and scans so they don't affect the other programs on the server.

ionice -c3 clamd
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.