Re: Questions about OPcache interned strings buffer
| From: | Micha | Date: | Wed, 01 Dec 2021 19:34:27 +0000 |
| Subject: | Re: Questions about OPcache interned strings buffer | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-327845@lists.php.net to get a copy of this message | ||
Thanks, that is precisely the StackOverflow question I made and linked already :). But sadly neither
does the behaviour derived from the code in the answer match the actually observed results from
opcache_get_status() I described, nor does it answer why it is as it is.Not sure what the definition
of a buffer overflow should tell me. You mean that the full interned strings buffer is the result of
a buffer overflow? Actually I don't think so, there are no errors or problems with it, it just
seems to be fully used. I only wonder why the used MiB of the interned strings buffer is higher than
the used MiB of the remaining while OPcache, and why it keeps being nearly fully used even when I
again double it's size. Somehow there seem to be more strings stored than actually available in
all PHP files. Maybe the result of intense other caching layers in Wordpress or phpBB, I recognised
large PHP scripts in some of their tmp/cache directories (up to 1 MiB size).Kind regards, Micha
-------- Ursprüngliche Nachricht --------Von: Dziamid Harbatsevich <newads777@gmail.com>
Datum: 01.12.21 19:50 (GMT+01:00) An: Micha <micha.faul@gmx.de> Betreff: Re: Questions about
OPcache interned strings buffer I think this will help to get closer.https://stackoverflow.com/a/67899794https://cwe.mitre.org/data/definitions/120.htmlOn
Sun, Nov 28, 2021 at 5:45 AM Micha <micha.faul@gmx.de> wrote:>>> Hi guys,>> I
have two questions regarding the OPcache interned strings bugger, I> hope this mailing list is
the right place to ask them, else feel free to> redirect me to a more fitting place.>> 1.
What is the logic behind the assigned strings buffer size and the> actually usable size? When
using powers of 2, it seems to be exactly 75%> of it being usable, but for values between powers
of 2, the usable> buffer size seems to increase by exactly what was added to the setting,> so
that the used percentage increases until the next power of 2 is> reached. So basically it is
possible that an increase of the settings> value leads to a decrease of the actually usable
strings buffer. I'm> just wondering about what the remaining <=25% are used for,
whether> using a power of 2 is preferable, or the opposite to have a batter> ratio. To avoid
confusion it may be reasonable to add the <=25% always> to the usage statistics output, so
that setting and statistics match.> Also Asked on stackoverflow:> https://stackoverflow.com/questions/67853338/opcache-interned-strings-buffer-size-lower-than-opcache-interned-strings-buffer>>
2. I have a PHP8.1 instance where I can increase the interned strings> buffer size as much as I
want, it is always nearly fully used based on> the statistics. Currently it's 256 MiB
assigned, 100% used with 512 MiB> overall OPcache size ~90% used. This doesn't look
reasonable, as the> interned strings buffer is also meant to reduce the actual OPcache usage>
(? bundling strings), so it looks wrong that it is used with more MiB> than the remaining
OPcache. Or is it somehow expected that every smaller> and larger fraction is a string is stored
in the interned strings buffer> as long as it is available, so that it basically always fills up?
If so,> how can one estimate a good size for ones individual instance?>> Best
regards,>> Micha