stat cache / still needed these days?
| From: | Philip Hofstetter | Date: | Mon, 25 Jul 2016 07:55:07 +0000 |
| Subject: | stat cache / still needed these days? | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-94697@lists.php.net to get a copy of this message | ||
Hi,
I have just reported #72666 (touch() works differently on plain paths
and file:// paths with regards to cleaning the stat cache) and I would
gladly provide a PR with a fix and unit tests. However, before I start
working on this (well - it would be an easy fix), I would like to
question whether the stat cache is a good idea and whether it's still
(or ever was) needed these days.
File systems right now are really good at quickly providing the
information: On MacOS I measure only 10% loss in performance when
doing nothing but calling stat() and clearstatcache() compared to just
calling stat(). Over NFS on Linux, it's 20%.
Additionally, I wonder what the stat cache is actually helpful for -
as far as I understand it, this only helps if you repeatedly call
stat() (or a related function) on the same file within the same
request which probably isn't very common application behaviour to
begin with.
As such, before I fix touch() to call php_clear_stat_cache(), maybe
it's worth reconsidering the whole thing and removing it from PHP
itself at least for later versions, though I guess there I would be in
firm RFC territory which I'd be willing to write if I had RFC writing
credentials.
What do you think?
Philip