LSPHP Memory allocation

Hi forum,

How does LSPHP allocate memory, in terms of the settings in each php instance and env var LSAPI_CHILDREN
say you are running 100 virtual hosts in LS with each having its own external app for lsphp.

All php instances have
opcache.memory_consumption = 128M
memory_limit = 256M

How to calculate idle memory usage and theoretical max?
Does each master php process per external app set site opcache.memory_consumption? or does it only use the actual opcache memory for each instance reported from opcache_get_status()?

Idle memory usage: 100 external apps * 128M opcache.memory_consumption = 12,8G ?
Theroritical maximum memory*: 100 external apps * ( 128M opcache.memory_consumption + ( 20 LSAPI_CHILDREN * 256M memory_limit ) ) = 52G

*If ALL sites are used and maxing out LS connections with a php script using ALL memory - questionable scenario yes.

Any info/insight on this matter is much appreciated :)


Staff member
not like that way. one user will share the opcode cache within that process group, it doesn't x LSAPI_CHILDREN=20.

"ALL sites are used and maxing out LS connections with a php script" is rare situation. when application cache, it doesn't go through PHP. Even you runinto it, normally the CloudLinux LVE to limit user's resource usage to avoid abusing the server.
i guess it will x LSAPI_CHILDREN with memory_limit, if all possible connection max out php memory on this instance + 1x their shared opcache.