This article describes what PHP workers are, how your website uses them, and how many you need for your WordPress website.
- What Are PHP Workers?
- How Many PHP Workers Do I Need?
- What Happens if You Don’t Have Enough PHP Workers?
- Choosing the Right WordPress Hosting Plan
What Are PHP Workers?
PHP workers process the PHP code used to develop your WordPress website. When visiting your website, the user’s browser requests to load the website. This request is first met by NGINX. NGINX utilizes the Cache Manager to determine how to handle the request.
The request is immediately served from the cache (if available) or sent to Apache for handling. Apache assigns the PHP process(es) to a pool of PHP workers. A PHP worker runs the script. Apache receives the response and updates the NGINX cache. Finally, NGINX serves the response to the client’s browser.
PHP workers only handle requests that are not cached. So, a static website does not need a large number of PHP workers. In this case, most of the content does not change so caching is sufficient. On the contrary, a dynamic website or one with a lot of complexity may need more PHP workers. A complex website with more PHP workers prevents requests from queuing up.
Generally, more PHP workers will help your website load faster. However, not all websites need a lot of workers. Read on to learn more about how you can determine how many PHP workers is right for you.
How Many PHP Workers Do I Need?
To ensure stability and quick access to your website, you need to allocate enough PHP workers. A large number of workers prevents a delay in waiting for other PHP workers to finish before it can accept/process new requests. However, a large number of workers may not be necessary, say if you are running a static website with caching.
Examples of a static website:
- Small Business Website
- Brochure Website
Examples of a dynamic website:
- eCommerce Website
- Forum Website
The number of PHP workers needed is highly dependent on the amount of dynamic content your website uses. For instance, a forum website is limited in the ability to cache pages. This is because the content is changing and a cached page would miss the most recent content added. Similarly, shopping cart pages are never the same for prospects, so they can not be cached either.
What Happens if You Don’t Have Enough PHP Workers?
Determining the right amount of PHP workers is important to prevent performance issues. When you reach your PHP worker limit, they will start building up in a queue and eventually begin moving out the oldest requests. The result for users could be the dreaded 504 errors, 502 bad gateway errors or other incomplete requests. Often times there will be slow uncached requests that delay processing, but this problem is solved easily by increasing the number of PHP workers.
Choosing the Right WordPress Hosting Plan
Your website is a critical component of your business. For optimal performance, it should be hosted in an environment that is secure and fast. Our WordPress Hosting plans offer a variety of configurations to suit your needs (and at a price your budget will appreciate). The table below indicates the amount of PHP Workers included in each tier of WordPress Hosting.
|PHP Workers||2||3||4||6||No Limit||No Limit|
When analyzing how many PHP workers you will need for your website, it is best to consider the number of simultaneous visits in addition to the amount of dynamic content. If you are running an eCommerce website, you can compare PHP workers to the number of checkout lanes you want to open for your visitors to make a purchase.
Also, be sure to consider how many websites you will be running. Depending on the complexity of the website(s) and simultaneous traffic we recommend between 2 – 4 workers per website.
Now that you have a better understanding of what PHP workers are, you can make a more educated assessment of your WordPress website’s needs. Want to learn more about our WordPress Hosting plans? Chat with a WordPress expert anytime.