3 ms·
Will Unicorn automatically kill older forked processes periodically and fork off new ones, or is that something that would need to be done separately?
by pixelcort 14y ago
Will Unicorn automatically kill older forked processes periodically and fork off new ones, or is that something that would need to be done separately?
- swampthing 14y agoOne of the comments on the Heroku article mentions this gem, which does just that: https://github.com/kzk/unicorn-worker-killer https://github.com/kzk/unicorn-worker-killer
- kawsper 14y agoRegarding memory, I think you can do something like this in your Unicorn config: after_fork do |server, worker| size_in_bytes = 60010241024 # megabytes Process.setrlimit(Process::RLIMIT_AS, size_in_bytes)
- kawsper 14y agoI think Unicorn kills off old workers and spawns new regularly.
- lucaspiller 14y agoWe haven't had any issues with memory leaks since we've been using Unicorn and Rails 3. Back in the old days of Mongrel and Rails 2 we had to restart the processes periodically because of this, but we haven't seen any issues with this setup. Here are the stats: www-data 21714 0.0 5.6 102928 87164 ? Sl Feb26 0:30 unicorn_rails master -c production.conf.rb -E production -D www-data 21762 0.2 8.5 150672 131996 ? Sl Feb26 1:58 unicorn_rails worker[0] -c production.conf.rb -E production -D www-data 21768 0.2 8.5 152036 132352 ? Sl Feb26 1:58 unicorn_rails worker[1] -c production.conf.rb -E production -D www-data 21774 0.2 8.1 145248 125668 ? Sl Feb26 1:56 unicorn_rails worker[2] -c production.conf.rb -E production -D www-data 21780 0.2 8.3 148792 129736 ? Sl Feb26 2:01 unicorn_rails worker[3] -c production.conf.rb -E production -D www-data 21786 0.1 8.3 148384 129260 ? Sl Feb26 1:48 unicorn_rails worker[4] -c production.conf.rb -E production -D www-data 21792 0.1 8.6 152156 133880 ? Sl Feb26 1:52 unicorn_rails worker[5] -c production.conf.rb -E production -D
- lucian1900 14y agoWhy would that be desirable? (I'm not a Ruby developer, so I have no idea)