Re: Adding a way to disable the stat cache
| From: | Christian Schneider | Date: | Fri, 03 Sep 2021 20:12:13 +0000 |
| Subject: | Re: Adding a way to disable the stat cache | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-115940@lists.php.net to get a copy of this message | ||
Am 03.09.2021 um 18:12 schrieb Kevin Lyda <kevin@lyda.ie <mailto:kevin@lyda.ie>>:
> To run this php script:
>
> <?php
> $iterations = 1000000;
> function all_the_stats($filename) {
> @lstat($filename);
> @stat($filename);
> }
> while ($iterations--) {
> all_the_stats(__FILE__);
> }
>
> I see this output:
>
> Without cache
>
> real 0m7.326s
> user 0m5.877s
> sys 0m1.448s
> With cache
>
> real 0m5.010s
> user 0m5.009s
> sys 0m0.000s
So this is almost a 50% performance regression ;-)
And the more interesting number for me here is "sys 0m1.448s" vs "sys 0m0.000s".
Which means 1.5s out of the additional 2.3s are spent in system calls.
Side-note: Why is the user time without cache higher than with cache? That seems counter-intuitive.
Maybe the checking of the ini-settings or some libc-code?
I'm interested in the load put on a system with a high request count and a typical application.
Reducing system calls used to matter there as the kernel does not multi-process the same way user
land does.
But then again, maybe I'm overly cautious :-)
Regards,
- Chris