If you are using your Synology NAS for hosting your WordPress or Joomla websites, and have high traffic over time, this article is for you because I will teach you how to configure the best PHP-FPM settings in your WebStation.
The PHP-FPM mode (FastCGI Process Manager) on Synology NAS has three choices: Static, Dynamic and On demand. You can find this on WebStation / PHP Settings / Select Default PHP 7.3 then edit.
- Dynamic: is maybe the most commonly used mode; it’s set as default on Webstation; it allows the server to juggle the number of spawned PHP processes between several settings.
- On demand: means that there are no minimum processes: once the requests stop, all the processes will stop. Some advocate for this setting because it means the server won’t be spending any resources in its idle state, but for the dedicated (non-shared) server instances this isn’t necessarily the best. Spawning a process includes an overhead, and what is gained in memory is being lost in time needed to spawn processes on-demand.
- Static: Static is best for performance. It allows the PHP processes to take over the maximum of the server’s resources, short of swapping, or driving the CPU to a halt. This setting means we’re forcing the maximum out of our system at all times. You can see an increase in RAM usage. Below, you can see a screenshot with the best FPM settings for WebStation.
Max Processes = Total Ram – Used Ram + Buffer – Memory per PHP process. This option sets the limit on the number of simultaneous requests that will be served. So in my case I set it to 50. The Max Processes setting limits the maximum number of simultaneously executing PHP requests an app is allowed to have. For example, with a Max Processes of 50, your website can support up to 50,000 visitors at a time. Max Processes of 20 can support up to 20,000 visitors at a time. Max Processes of 10 can support up to 10,000 visitors at a time. Note: These are the mariushosting settings. Read more: PageSpeed Insights Says: Mariushosting Faster Than Google.
Start servers = The number of child processes created on startup. Used only when FPM is set to Dynamic. In our case FPM is set to Static “maximum resources”. We can ignore this option.
Min spare servers = The desired minimum number of idle server processes. Used only when FPM is set to Dynamic. In our case, FPM is set to Static “maximum resources”. We can ignore this option.
Max spare servers = The desired maximum number of idle server processes. Used only when FPM is set to Dynamic. In our case, FPM is set to Static “maximum resources”. We can ignore this option.
Note: Read my article Pay For Web Hosting vs Hosting on My Synology NAS.