This is a monit recipe for a rails app with 4 Unicorn threads using SOCKET. The app averages a total memory usage of 600 MB.
If it goes over 800 MB send email alert only.
If over 860 MB, reload the app.
Also if it’s using too much CPU, alert by email.ceoec.ru
I use unicorn_rails on socket mode with nginx, and preload_app = true.
note: the HUP signal will reload the children processes without reloading code changes. This is fast and desirable.