Skip to content

Restart workers on Memory Limits #1355

@withinboredom

Description

@withinboredom

Describe you feature request

Currently, in PHP, it allows setting a memory limit per a request. We also have worker scripts that restart based on the number of requests. Inspired by https://externals.io/message/126226, it may make sense to measure memory usage per the limit to handle potential memory leaks.

This needs a few things working together: GOMEMLIMIT for keeping the Go runtime in check, memory_limit ini settings, and the current container/cgroup memory limits (plus current number of threads).

From that, we can derive if a request is going to potentially exceed those limits, we can start a rolling restart of workers before handling the request. If after restarting the workers, and we are still brushing up against the limits, then we can assume there is a memory leak in go and we need to restart the entire process.

Note: this could also be an autoscaling strategy (density vs. speed)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions