Skip to content

applications(php): detail MEMORY_LIMIT behavior#897

Open
davlgd wants to merge 1 commit intomainfrom
davlgd-memory-limit
Open

applications(php): detail MEMORY_LIMIT behavior#897
davlgd wants to merge 1 commit intomainfrom
davlgd-memory-limit

Conversation

@davlgd
Copy link
Copy Markdown
Collaborator

@davlgd davlgd commented Mar 19, 2026

📝 What does this PR do?

This pull request updates the PHP application documentation to clarify how memory limits are set and enforced for php-fpm workers. The changes provide more precise explanations about available memory, default values, and the impact of environment variables and configuration options.

Documentation improvements:

  • Clarified that php-fpm worker memory limits are based on the application's available memory (total RAM minus system overhead), and updated the table header to "Default Memory Limit" for each flavor.
  • Expanded the explanation for the MEMORY_LIMIT environment variable, specifying that it should be set in MB as an integer, and clarified that the maximum allowed value is the available application memory. Added an example for the Nano instance and described what happens if the limit is exceeded, including logging behavior.
  • Noted that setting max_children via CC_CONFIGURATION_PM_MAX_CHILDREN also affects the effective memory limit, as the system ensures all workers fit within available memory.

🔗 Related Issue (if applicable)


🧪 Type of Change

  • ⚠️ Bug fix
  • 📅 Changelog update
  • 📚 Documentation update
  • ✨ New content/feature
  • 🔧 Technical/maintenance

✅ Quick Checklist


👥 Reviewers

@PLhuillery

@davlgd davlgd requested review from PLhuillery and Copilot March 19, 2026 16:28
@davlgd davlgd self-assigned this Mar 19, 2026
@github-actions
Copy link
Copy Markdown

:octocat: Preview is deploying...

Please wait while the preview is deploying on Clever Cloud...

ℹ️ Name 🔗 Infos & links
🌱 Deploying commit 3fe1c5f
👁️ Preview Generating preview app...

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the PHP application documentation to better explain how PHP-FPM worker memory limits are derived from available instance memory, and how configuration can affect the effective limit.

Changes:

  • Clarifies that worker limits depend on application available memory (RAM minus system overhead) and renames the table column to “Default Memory Limit”.
  • Expands MEMORY_LIMIT explanation with an upper bound based on available memory and a Nano example.
  • Notes that CC_CONFIGURATION_PM_MAX_CHILDREN influences the effective per-worker memory limit.

You can also share your feedback on Copilot code review. Take the survey.

To change this limit you can define `MEMORY_LIMIT` [environment variable](/doc/reference/reference-environment-variables#php).

If you define a limit exceeding the application memory it will use the default one.
When php-fpm spawns a worker it allocates a smaller part of the application's available memory to the worker. The available memory is the instance's total RAM minus system overhead (monitoring, logging and kernel). Here are the default values for each flavor:
Comment on lines +145 to +147
To change this limit, define the `MEMORY_LIMIT` [environment variable](/doc/reference/reference-environment-variables#php) (in MB, as an integer).

The maximum allowed value is the application's available memory, which is lower than the instance's total RAM due to system overhead. For example, a Nano instance has 512 MB of total RAM, but only around 416 MB are available to your application. If you set `MEMORY_LIMIT` higher than the available memory, the default value is used instead and a warning is logged. Setting `max_children` through `CC_CONFIGURATION_PM_MAX_CHILDREN` also affects the effective memory limit, as the system adjusts it to ensure all workers can fit in the available memory.

To change this limit, define the `MEMORY_LIMIT` [environment variable](/doc/reference/reference-environment-variables#php) (in MB, as an integer).

The maximum allowed value is the application's available memory, which is lower than the instance's total RAM due to system overhead. For example, a Nano instance has 512 MB of total RAM, but only around 416 MB are available to your application. If you set `MEMORY_LIMIT` higher than the available memory, the default value is used instead and a warning is logged. Setting `max_children` through `CC_CONFIGURATION_PM_MAX_CHILDREN` also affects the effective memory limit, as the system adjusts it to ensure all workers can fit in the available memory.
@github-actions
Copy link
Copy Markdown

:octocat: Preview is deploying...

Please wait while the preview is deploying on Clever Cloud...

ℹ️ Name 🔗 Infos & links
🌱 Deploying commit 3fe1c5f
👁️ Preview Generating preview app...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Doc: Document max limit for MEMORY_LIMIT

2 participants