Can I restart Puma Workers after the maximum number of requests?

Phusion Passenger offers the ability to restart worker processes after N requests to handle memory issues, and I was wondering if Puma has a similar setup? I haven't been able to find anything suitable in the documentation or code, but I haven't used Puma yet before maybe I'm missing something.

The documentation for the passenger function is here :

PassengerMaxRequests

The maximum number of requests that the application will process. After many requests have been processed, the application process will be closed and Phusion Passenger will restart it. A value of 0 means there is no maximum: the application process will thus be shut down when the wait timeout is reached.

This option is useful if your application is leaking memory. By closing it after a certain number of requests, all of its memory will be freed by the operating system.

I am currently having a problem with Heroku where we push memory quota limits in our Rails app after about 12-14 hours, because GC is causing a significant increase in memory usage. I'll also try to tweak our GC settings, but I've found this useful feature in production environments in the past, so I would like to install it if available.

+4


source to share


1 answer


You can use this gem while you find the best solution:



https://github.com/schneems/puma_worker_killer

0


source







All Articles