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:
RUBY_HEAP_FREE_MIN=10000
RUBY_HEAP_MIN_SLOTS=40000
RUBY_HEAP_SLOTS_INCREMENT=20000
RUBY_GC_MALLOC_LIMIT=40000000
RUBY_HEAP_SLOTS_GROWTH_FACTOR=1.1
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).
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
begin
uid, gid = Process.euid, Process.egid
user, group = 'mongrel', 'mongrel'
target_uid = Etc.getpwnam(user).uid
target_gid = Etc.getgrnam(group).gid
worker.tmp.chown(target_uid, target_gid)
if uid != target_uid || gid != target_gid
Process.initgroups(user, target_gid)
Process::GID.change_privilege(target_gid)
Process::UID.change_privilege(target_uid)
end
rescue => e
raise e
end
To verify the contents of the env at this stage of the init I inserted a:
File.open('/tmp/unicorn_init.log','w'){|f| f << "Who am I?
#{`whoami`}\n#{`env`}"}
The user is really "mongrel" at this stage and the env does not contain any of
the GC tunings.
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!
David
_______________________________________________
mongrel-unicorn mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/mongrel-unicorn