• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Question Is there a way to restart reset Opcache periodically or invalidate not accessed files (dedicated FPM- handler)

serverman

New Pleskian
I'm currently using Plesk for a shared hosting server with the dedicated PHP-FPM handler per site.
This allows every site to have it's own Opcache, but this is also the issue...
Let's say there are 10 sites with 64 MB for Opcache, that's 640 MB in total!
Lot's of those sites don't get visited regularly, so the cache could be cleared after a while.

A solution could be to restart the PHP-FPM process for every site, but this will result in errors for visitors.
Another solution would be 1 PHP-FPM handler, but the cache will get filled by the big sites. This results in automatic Opcache restarts because the memory is full.

My question: is there a way to reset the cache periodically, or is there a way to clear the files from the cache when they haven't been access for let's say a week?
 
Hello, serverman

> A solution could be to restart the PHP-FPM process for every site, but this will result in errors for visitors.
You can just replace `restart` with `reload` to flush cache and avoid errors for visitors.
 
Thank you for your answer, this helps a lot.
How can I reload it though?

I find these services:
plesk-php73-fpm_DOMAIN_COM_144.service
plesk-php73-fpm_DOMAIN_COM_144

But whatever I try, I can't seem to find a way to reload it.
Using the service command it simply says unknown service.

They are definitely there in /lib/systemd/system:
-rw-r--r-- 1 root root 262 Jan 31 13:40 plesk-php73-fpm_DOMAIN.COM_144.service
drwxr-xr-x 2 root root 4.0K Jan 31 10:18 plesk-php73-fpm_DOMAIN.COM_144.service.d
drwxr-xr-x 2 root root 4.0K Jan 31 10:17 plesk-php80-fpm_DOMAIN.COM_144.service.d

This is what's in the service file, seems that it does not do a graceful reload?

ExecStart=/opt/plesk/php/7.3/sbin/php-fpm -c /var/www/vhosts/system/DOMAIN.COM/etc/php.ini --fpm-config /var/www/vhosts/system/DOMAIN.COM/etc/php-fpm.conf --nodaemonize
ExecReload=/bin/kill -USR2 $MAINPID
 
Or you could just run a php script containing opcache_reset();as a cronjob.

Thanks for your reply.
This would indeed work, except the problem is that every site has it's own PHP-handler.
I would have to make a cronjob for every website, for every client.
 
Why is that a problem anyway? Are you that low on resources?
Normally the kernel should swap out pages that have not been used for a long time when memory is needed.
 
Why is that a problem anyway? Are you that low on resources?
Normally the kernel should swap out pages that have not been used for a long time when memory is needed.
There are more than 50 websites hosted on the system.
In a worst-case scenario this could lead to a memory usage of 3.2 GB for Opcache alone.
If I can prevent old not accessed files to be cleared from the cache (let's say after a week), it would be much more efficient on the resources.

Normally the kernel should swap out pages that have not been used for a long time when memory is needed.
Swap usage went up by 2 GB by simply switching to dedicated FPM handlers, so it could already be doing that indeed.
 
Back
Top