GC settings for unicorn?
normalperson at yhbt.net
Thu Nov 26 11:55:41 EST 2009
David Palm <dvdplm at gmail.com> wrote:
> Hi all,
> we have a batch of unicorn workers running behind nginx in production since a week now. Works awesomely.
> We're using REE 1.8.7 and I'd like to tune the GC settings to something like:
> Now, how should I go about getting unicorn to pick that up the ENV? I
> tried sticking the above exports into /etc/profile.d/ree_gc_tuning.sh
> but when unicorn spawns workers they don't get the environment from
> the spawning user (root).
I would set those in the init/deploy script you're using. REE picks up
those variables at startup before it ever sees Unicorn.
However, if you want to change/modify them once your site is live
without downtime, then you should be able to change them anywhere in the
Unicorn config file (any valid Ruby can be in there, so just
ENV["FOO"] = "BAR") and then SIGUSR2 to upgrade the process (and
SIGQUIT the old master). It doesn't look like you can affect the
running process with those GC settings, but environment variables
are carried across fork + exec so the new one can pick them up at
> Our unicorn.rb config file has this in the after_fork section:
> # Unicorn master is started as root, which is fine, but let's
> # drop the workers to mongrel:mongrel
Actually, with the latest versions you should be able to just do this:
worker.user "mongrel", "mongrel"
> Is there a best practise regarding this? Where should env var setting
> go? Is tuning the GC something we'd want to be able to do in the
> unicorn config file directly (feature request...)?
> Thanks for any pointers!
No problem, let us know how it goes!
More information about the mongrel-unicorn