Handling of requests in the NGINX-PHP application server is managed by FastCGI Process Manager (FPM). Its main configuration file is php-fpm.conf, located inside the etc folder.
FPM can work in either dynamic or static mode, enabled according to the pm directive’s value. By default it is equal to dynamic, which allows Jelastic to configure other related parameters due to the amount of allocated environment resources:
pm.max_children - it has different meanings for the static and dynamic process manager state. In the first case, it defines the number of child processes to be created at the server’s start (which won’t be changed anyway), and in the second one - the maximum number of child processes, that are allowed to be created (as their amount will subsequently scale up, if required).
If you’d like to state your custom value, note: This directive is mandatory. Its value should be big enough to handle such amounts of simultaneous requests as you expect to receive, and small enough to ensure that there is enough RAM for the number of child processes you’ve stated, otherwise the server may become unstable.
pm.start_servers - states the number of child processes, created on server’s startup. It is used only with the dynamic pm value, since for the static process manager mode, all of the children processes (where the amount is stated within the pm.max_children parameter) are loaded at once. If this directive is not set, the default value will be used, which is calculated due to the next formula (the appropriate values can be found within the same configuration file):
pm.min_spare_servers + (pm.max_spare_servers - pm.min_spare_servers) / 2
If you’d like to state your custom value, note: The actual amount of child processes depends on the load and is not bounded to their initial number, set by the current parameter. So there is usually little reason to adjust it.
pm.max_spare_servers - sets the desired maximum number of idle (waiting) server processes. Such processes can quickly react on the received requests and process them almost immediately, skipping the regularly needed time of initiating a new operation. After the request is handled, the appropriate child process returns to the waiting state (nevertheless, if the overall number of idle processes become greater than the pm.max_spare_servers value, then it will be killed).
If you’d like to state your custom value, note: This directive is used only when the pm mode is set to dynamic and is mandatory. It acts in a bundle with the similar pm.min_spare_servers directive, which is located just up the file and sets the minimum number of child processes in the idle state. So if the amount of spare processes become less than this number, then some new ones will be created.
Within the Jelastic implementation, values for these settings are calculated automatically, based on the maximum amount of available resources (dynamic cloudlets). Below you can find the table with these parameters’ default values (based on Jelastic 3.1 version) for a few main environment RAM levels:
|Directive||Dynamic cloudlets (RAM)|
|8 (1 Gb)||16 (2 Gb)||32 (4 Gb)|
Now, if you are interested, you can find an example on How It Works or a way to Disable the Automatic Jelastic Optimization, in order to set your custom values for these directives.