CirrusGrid dynamic resources organization complements the basic PHP one to bring the maximum efficiency for PHP integration into the PaaS. Upon changing the amount of allocated resources for your environment (i.e. cloudlets count), CirrusGrid automatically adjusts the appropriate PHP directives to fit the new conditions. Herewith, you still can configure parameters manually, within your server’s configuration file.
The type of basic requests’ handling and dispatching system varies for different PHP application servers, so the directives they use are different too, though the functionality of such parameters could be similar. To learn more about these directives for a particular application server, navigate to the corresponding section below:
Besides that, you can learn How the Auto Configuration Works or, if you want to redefine the values manually, proceed to the How to Disable the Automatic CirrusGrid Optimization section of this guide.
Dynamic requests handling in Apache PHP is implemented with the help of the prefork Multi-Processing Module (MPM), which helps to reveal full server potential. The MPM directives used are stored in the main Apache /etc/httpd/conf/httpd.conf configuration file.
Here is a complete list of parameters, which are configured by CirrusGrid for the prefork module:
Based on the allocated resources (i.e. a number of dynamic cloudlets reserved for the Apache PHP server) and capacity of the CPU provided by your particular hosting provider, the platform automatically adjusts the ServerLimit and MaxRequestWorkers parameters:
MaxRequestWorkers = ServerLimit = min({containerRam} / 30MiB, {coresCount} * 5)
Due to this statement, both directives are stated equal to the lower value between:
In such a way, parameters are dynamically changed based on the number of allocated cloudlets, but won’t grow over the hardware limits.
Note: If you’d like to state your custom value for these directives, be aware that incorrect values can cause your Apache PHP server instability:
You may also be interested in How the Auto Configuration Works or how to Disable the Automatic CirrusGrid Optimization to set your custom values for these directives.
Request handling in the NGINX PHP application server is managed by FastCGI Process Manager (FPM), which can be configured via the /etc/php-fpm.conf file. It is automatically added to the favorites list in the container file manager for quick access:
The FPM works in the ondemand mode (the pm directive) by default, it spawns new processes when needed (i.e. on demand) and removes idle ones. The only additional parameters for this mode are:
Tip: The exact value depends on the capacity of the CPU provided by your particular hosting provider and the number of allocated cloudlets for your container. In such a way, cloudlets count enlargement results in the automatic growth of the pm.max_children parameter. This directive can be defined explicitly without disabling the automatic CirrusGrid optimization through the appropriate PHPFPM_MAX_CHILDREN variable.
If needed, you can Disable the Automatic CirrusGrid Optimization to change the FPM mode and adjust other directives (be aware that incorrect values can cause your NGINX PHP server instability).
Also, to gain the advanced performance the PHP FPM listener utilizes the UNIX domain socket instead of the common TCP one. Such a solution is better suited for the communications within the same host, allowing to skip some checks and operations (like routing).
You can check how the parameters mentioned above are changed based on the allocated resources. We’ll consider it on the Apache PHP server example:
1. Create a new PHP environment with the Apache PHP application server inside (if you don’t have one).Then, click the Config button for this node and find the prefork module configs in the /etc/httpd/conf/httpd.conf file.
Remember the values of the directives for the current cloudlets number (16 in our case).
2. Now, with the help of the Change Environment Topology button, set a new resource limit for the Apache PHP server (e.g. 32 cloudlets). Refresh the /etc/httpd/conf/httpd.conf file and compare values of the prefork parameters with the ones in the previous step.
As you can see, the directive values increased automatically due to a higher amount of available resources allocated, so the automatic optimization works. Similar to this, upon lowering cloudlets count, these parameters’ values will be reduced.
To state your custom values instead of the automatically configured directives, you need to disable the automatic CirrusGrid optimization. Otherwise, your custom changes will be reverted during the container restart/update.
Note: Inappropriate directive values may cause your server instability, so it is not recommended to apply any manual changes unless you know exactly what you are doing.
The process is almost the same for both PHP servers – you just need to remove the line with the CirrusGrid optimization mark at the beginning of the corresponding configuration file:
Apache PHP – “# Jelastic autoconfiguration mark” within the /etc/httpd/conf/httpd.conf file
NGINX PHP – “; Jelastic autoconfiguration mark” within the /etc/php-fpm.conf file
After the corresponding string is deleted, the parameters’ values won’t be auto-configured by the CirrusGrid PaaS optimization mechanism, so that you can state your custom parameters. Don’t forget to Save the file to apply the new configurations.
Powered by BetterDocs
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.