Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

increase opcache buffer to 64 #791

Merged
merged 1 commit into from
Jun 13, 2022
Merged

increase opcache buffer to 64 #791

merged 1 commit into from
Jun 13, 2022

Conversation

szaimen
Copy link
Collaborator

@szaimen szaimen commented Jun 6, 2022

Close #772

Signed-off-by: szaimen [email protected]

@szaimen szaimen added 3. to review Waiting for reviews enhancement New feature or request labels Jun 6, 2022
@szaimen szaimen added this to the next milestone Jun 6, 2022
@szaimen
Copy link
Collaborator Author

szaimen commented Jun 6, 2022

@MichaIng does this look good?

@Zoey2936
Copy link
Collaborator

Zoey2936 commented Jun 8, 2022

I think it could also directly set to 64, then the chance to hit this limit would be much smaller

@szaimen szaimen force-pushed the enh/772/opcache-buffer branch from 1372a2b to 565f777 Compare June 13, 2022 09:41
@szaimen
Copy link
Collaborator Author

szaimen commented Jun 13, 2022

I think it could also directly set to 64, then the chance to hit this limit would be much smaller

fine by me 👍

@szaimen szaimen changed the title increase opcache buffer to 32 increase opcache buffer to 64 Jun 13, 2022
@szaimen szaimen merged commit bfab40f into main Jun 13, 2022
@delete-merged-branch delete-merged-branch bot deleted the enh/772/opcache-buffer branch June 13, 2022 09:41
@MichaIng
Copy link
Member

MichaIng commented Jun 13, 2022

IMO 64 MiB for interned strings buffer is too much. It is reserved from the 128 MiB overall default OPcache size and 64 MiB for PHP scripts is rare but possible with Nextcloud only, hence this can cause the other limit to be reached. 64 MiB strings should only be possible with temporary scripts and hence temporary strings which are not cleared automatically once a new temporary script got created, I guess. It's difficult to analyse since there is no way (I'm aware of) to list the actually stored strings.

I'm not sure how to deal with this best: If only Nextcloud is used, more than 16 MiB strings buffer should never be reasonable, but with other applications using the same pool it can be (along with a larger overall cache size). So not sure whether hiding the warning in general for >16 MiB is a good idea. For VM/Docker/Snap/AIO however we know that it's Nextcloud only, just backend internally I'm not aware of a method to know this (which could be used for the checks to show or not show the warning).

It would be really great to find out which apps/use cases cause this high strings buffer usage, but so far I couldn't find a clear match among the reports.

I'm open for suggestions, in a new/related issue on server, of course.

@szaimen
Copy link
Collaborator Author

szaimen commented Jun 13, 2022

Thanks for the answer! So even 32 is not reasonable?

@MichaIng
Copy link
Member

MichaIng commented Jun 16, 2022

Hard to say absolute. If really an app contains that large amount of strings in it's code/GUI, it can be reasonable. But I cannot imaging that any app does so.

Would be great to be able to look into the strings buffer and see which strings from which scripts it contains.

I'll have a look into Nextcloud data, to probably find a location where apps can store temporary data/scripts. Strings from the database are AFAIK not hold in that buffer (like such contained in the generated HTML documents.

Some reading: https://www.phpinternalsbook.com/php7/internal_types/strings/zend_strings.html#interned-strings

@szaimen
Copy link
Collaborator Author

szaimen commented Jun 16, 2022

Okay, so I would reduce it to 16 again and ask people in the future to fist debug it?

@MichaIng
Copy link
Member

MichaIng commented Jun 16, 2022

I'd suggest to use 32 MiB for the following reason:

  • Nextcloud is able to use max 64 MiB of the regular OPcache. I tested this once with installing and browsing the GUI of literally all available apps, and hit close to 64 MiB.
  • So 32 MiB for interned strings is safe to use without a risk to hit the default overall OPcache size of 128 MiB, when only Nextcloud is used.

I'll also suggest this for nextcloud/server#32902.

I btw verified that increasing the interned strings buffer, even that it is reserved from the overall OPcache memory, does not increase the system memory usage.

@szaimen
Copy link
Collaborator Author

szaimen commented Jun 17, 2022

thanks! will do so :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

increase the PHP OPcache cache buffer
3 participants