Thanks for your input, Weedpacket. This is really bugging me.
Weedpacket;11022681 wrote:Just as a random suggestion: Apache records the last-modified time when it does access (and cache) a file - and only feels it needs to read the file if the last-modified time changes. (In other words, inotifywait doesn't count merely querying a file's metadata (such as last-modified time, or permissions, or filename) as actually accessing the file.)
I have run the inotifywait command and then restarted apache and this restart does not result in Apache accessing any files in the web root. I am puzzled that checking a file's modification date does not constitute "access." I'm more puzzled that an apache restart didn't result in the web root being accessed.
I tried rebooting my machine entirely, running the inotifywait command, and accessing the site. This also did not result in access to anything but the .htaccess file. Apache is configured to start at boot time, so I was thinking perhaps Apache cached these files at boot?
So I started looking for an Apache cache. Googled around, did some grep searches and located the htcacheclean command. The grep searches revealed this:
CacheRoot /var/cache/apache2/mod_disk_cache
And I ran this command:
$ sudo htcacheclean -l 4096M -rvp /var/cache/apache2/mod_disk_cache
Statistics:
size limit 4096.0M
total size was 0.0K, total size now 0.0K
total entries was 0, total entries now 0
Which appears to have reported that it accomplished nothing. I've tried it again while running the inotifywait command to watch this cache directory and it really does seem to accomplish precisely nothing. And yet Apache does seem to cache these files -- I just don't know where.
I did a "touch index.php" and accessed my site -- this finally resulted in file access to my web root, but there was absolutely no file system activity reported in the cache directory. I'm thinking the cache might be somewhere else. Is there some apache command to find out?
I have not been able to determine precisely when and how often Apache accesses the files in my web root or where Apache is caching things. I'm also wondering what kind of file system load results from all these checks on a file modification time. I expect it's much easier than reading the contents of the file.
And I'm also totally confused that I see several file accesses on .htaccess for each page load. Why apache cannot cache this file is a mystery to me.