This article describes how WordPress, WooCommerce and other plugins use PHP Workers.
PHP Workers is a concept in php-fpm that allows the web server to control how much resources can be spent at any given time, to process PHP requests. WordPress and WooCommerce process PHP requests at least once for every page view.
However, it’s usually more – because a page request also may trigger additional requests to the PHP backend, for example by using the admin-ajax.php interface. This interface is commonly used to fetch information that should be updated after the page has loaded. As an example, cart contents on a WooCommerce site is requested after the page has loaded. Therefore, what appears as a single page request for the user – may trigger multiple PHP requests to the backend.
On all Servebolt hosting plans, the your use of PHP Workers is unlimited. For many other hosting comapanies, PHP Workers is provided as a hard limit that will force you to upgrade your hosting plan if you exceed the number of PHP workers on your plan.
What type of plugins add additional PHP requests to WordPress?
There are a variety of plugins that add additional PHP requests to your website. WooCommerce is the most common example, but other examples could be plugins that provide wish lists, comments or ads (and a lot more!).
What happens when I have too few PHP Workers available in WordPress?
When you have to few PHP Workers available, it will have an impact on performance. The first thing you’ll notice is that your website will slow down and start performing worse than usual. The reason for this is that requests will start queueing if there are too few resources available.
Eventually, when the queue gets too long, your site will start failing for random requests. This means that the site visitors or admins will start experiencing either blank pages, white screen of death, or be thrown 500, 502 or 504 errors. When this happens, you may also run into issues with managing your site – because PHP workers also are required for your admin to work.
What can I do when I run out of PHP Workers?
There are basically three ways to counter this problem;
- Reduce the amount of PHP requests
This can be done in multiple ways, but will often require expert help from developers. If the cause of running out is due to your website getting more popular, it will be difficult to optimize your site further for reducing the resource usage. - Add more PHP workers to handle more simultaneous PHP requests
This often comes at a cost, and when you’ve first starting to exhaust the limit – you’ll quickly run into the next limit. - Or, switch to a hosting platform like Servebolt that provides unlimited amounts of PHP Workers
If you have questions that should be answered on this page, please leave a comment!