Skip to content

Support for shutdown on idle #2580

@schuetzm

Description

@schuetzm

Is your feature request related to a problem? Please describe.
In order to reduce resource consumption, infrequently utilised Rails/Rack apps should not occupy memory when they are not actively used. Socket activation, which Puma already supports, solves part of this; applications can be started on demand as soon as a request comes in. However, there doesn't seem to be a way to shut down the server again when the app is no longer active.

Describe the solution you'd like
There should be an (opt-in) setting that allows to specify a timeout. If no new request is received inside that timeout, the server should shut down and exit cleanly. Care must be taken not to close the sockets received from systemd.

Describe alternatives you've considered
This feature cannot be implemented in the service manager (systemd), as it doesn't keep track of activity on the sockets it created after the service has been started. This information is only available to Puma itself.

(I'd be willing to implement this if someone can point me at the right place to start.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions