Re: Question abou PHP 8.2/8.3 in Kubernetes/OpenShift

AllenJB <[email protected]> Tue, 8 Oct 2024 14:28:59 +0100
Newsgroups gmane.comp.php.general
Message-ID <[email protected]>
On 08/10/2024 11:29, Alex wrote:
> We run CraftCMS in OpenShift and have no limits defines, that means 
> that PHP can use the whole 8 CPUs and 32 GB RAM.
>
> The Problem is that we see that PHP only uses ~200M-500M.
>
> Have anybody some tips how to check what's the limiting factor in PHP 
> is so that we can tune it?

Do you have an actual performance problem (beyond "not using a lot of 
memory") you're trying to solve? (If so, what?)

eg. Are specific requests "slow"? Are you getting error messages or 
undesired behavior?

PHP won't use memory unless it's actually needed. The default 
php-fpm/mod_php run model means that each request starts PHP scripts 
from scratch with no knowledge of other requests. Most requests will 
need no more than around 2MB of memory. More will only be required for 
specific tasks such a working with image files or large imports/exports.

Individual PHP-FPM workers will only hold onto the maximum system memory 
ever used by any request that specific worker handled (so resets if 
either process idle timeout or max requests pm. settings are reached, 
depending on which pm mode is used).

Unlike some server software (eg. databases), PHP doesn't keep a lot in 
memory in the name of performance. This is something PHP scripts and 
applications are expected to handle themselves - for example, by 
utilizing caches such as memcached/redis/valkey or alternative 
application architectures (long running application servers)

Given you're working with a specific application/framework (CraftCMS), 
you may get better answers about configuration tuning or specific 
performance issues from their community resources and support.