Skip to content

[12.x] Reset PHP’s peak memory usage when resetting scope for queue worker #55069

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 18, 2025

Conversation

TimWolla
Copy link
Contributor

This is similar to the reset of the total query duration that is already happening. PHP’s peak memory usage is another bit of global state is not useful to keep in a long-running process handling individual self-contained jobs.

By resetting the peak memory usage for each executed job it becomes possible to measure a given job’s maximum memory usage accurately, allowing to optimize hardware resources, for example by placing individual jobs with a high-memory usage into their own queue that is executed on a larger worker instance.

This is similar to the reset of the total query duration that is already
happening. PHP’s peak memory usage is another bit of global state is not useful
to keep in a long-running process handling individual self-contained jobs.

By resetting the peak memory usage for each executed job it becomes possible to
measure a given job’s maximum memory usage accurately, allowing to optimize
hardware resources, for example by placing individual jobs with a high-memory
usage into their own queue that is executed on a larger worker instance.
@TimWolla TimWolla changed the title Reset PHP’s peak memory usage when resetting scope for queue worker [12.x] Reset PHP’s peak memory usage when resetting scope for queue worker Mar 18, 2025
@taylorotwell taylorotwell merged commit c3670c2 into laravel:12.x Mar 18, 2025
41 checks passed
@TimWolla TimWolla deleted the queue-worker-memory branch March 18, 2025 18:05
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.

2 participants