Reputation: 8627
My scripts need to read a small file, about 10 bytes, on every HTTP request processed by PHP (PHP-FPM), so I wonder whether the file will be cached by the OS (in my case Ubuntu) to avoid disk I/O. Or should I avoid it?
Upvotes: 0
Views: 248
Reputation: 113
The answer to your question is:
Yes, it will be cached.
It depends on yourself.
The following question would be very helpful.
Does the Linux filesystem cache files efficiently?
Upvotes: 0
Reputation: 1410
Yes. If you start a program like htop and observe the yellow part of the memory usage, this is the amount of memory currently being used for disk cache. However, accessing the file will result in a disk-write to update the access time of that file, this can be disabled by adding the "noatime" option to the relevant partition line in /etc/fstab
Upvotes: 3