Adapt PHP configuration to fit memory limit of an application automatically
See original GitHub issueCurrently, the PHP buildpack really makes no attempt to configure HTTPD, Nginx and PHP-FPM such that resource usage does not go above the memory limit assigned to a given application.
If you look at PHP & PHP-FPM, this is where 90%+ of the assigned memory will be used. Right now, we default the memory_limit
to 128M in php.ini
[1] and we set the max number of workers in php-fpm.conf to 5 [2]. This leaves us with a default memory liability of roughly 128M * 5 + HTTPD/Nginx + PHP-FPM itself. From what I’ve seen, this is far higher than most memory limits (128 - 256M) being assigned to PHP workloads, which means given the current default configurations there’s a potential for PHP to consume more memory than expected and crash the container.
Currently, we put the responsibility of adjusting PHP’s configuration on the user. It’s easy enough with the PHP buildpack to override these default PHP & PHP-FPM settings so that you can scale the app to use as much memory as is required for your workload. Having said that, it’s unlikely new users or casual users of the buildpack will go through this process and will just rely on the buildpack defaults.
This issue is to open a discussion about how we can improve the buildpack so that it will do a better job adapting the PHP configuration to make use of the memory limit assigned to an application by default.
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (5 by maintainers)
Top GitHub Comments
@astrieanna - I opened this to get feedback mostly. Right now what the buildpack does is pretty simple. There are more complicated things that we could be doing (see brainstorming above ^^).
I haven’t heard a lot of feedback on this though. It’d be nice if we could get this in front of a wider audience to perhaps hear what others thinks. Are there problems with what we do now? Does it work for most cases? Are there things people routinely change, customize or override with how the buildpack handles this now? Are there any concrete use cases that people could share? etc…
I will post something to the mailing list and see if that draws any additional feedback.
Closing this due to inactivity, it seems like this discussion could be continued with relation to the php-web-cnb here. But please feel free to re-open.