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

I have a directory with many files with high access rate. And I need to reduce the cache pressure of this specific directory to prevent other files (like my home directory files) from the pushing out from the filesystem cache. Can I limit filesystem cache for specific directory, or for specific processes or users under Linux ?

share|improve this question
    
How are these files accessed? Be as precise as possible. –  David Schwartz May 1 '13 at 17:58
    
You're not going to get useful answers if you don't explain precisely how the files are accessed. The solution will be to prevent that access from pushing other things out of cache. How that's done depends on what that access is. –  David Schwartz May 2 '13 at 5:15

1 Answer 1

You can lock a particular directory (or files) into the filesystem cache/VM subsystem by using the vmtouch utility.

Example:

Daemonise and lock all files in a /var/app/data into physical memory:

vmtouch -dl /var/app/data
share|improve this answer
    
That's the opposite of what the OP is asking for. –  David Schwartz May 1 '13 at 18:00
    
I dont need caching of partucular direcotory, I need to limit caching the particular directory, to specify how many megabytes of this directory files be in the cache. Or maybe limit the cacheing by process touching this files. –  s9gf4ult May 1 '13 at 18:07
    
Think include versus exclude. Include the things that need to be cached (the particular directory) and lock them in cache so that they are not pushed out by insignificant files. –  ewwhite May 1 '13 at 18:07
    
I dont have particular directory I need to include in cache, I have a directory which I need to limit. –  s9gf4ult May 1 '13 at 18:11
    
@s9gf4ult Why do you want to limit it? –  ewwhite May 4 '13 at 4:51

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.