Chris Wanstrath <chris at ozmm.org> wrote:> Just wanted to say that GitHub has been running on Unicorn for about
> two weeks now. In that time it''s successfully served millions of
pages
> and has survived two separate DDoS attacks.
Wow, this is wonderful news!
> Here''s the config file we currently use (complete with a fun hack
to
> gracefully kill the old master when a new worker pool is ready):
>
> http://gist.github.com/189623
Great use of the before/after_fork hooks
One possible issue is a race condition in the before_fork hook,
so I''d put a rescue to protect the File.read in the before_fork:
old master new master
-----------------------------------------------------------------------
before_fork for worker=0
File.exist?(old_pid) => true
Process.kill :QUIT, File.read(old_pid).to_i
before_fork for worker=1
File.exist?(old_pid) => true
processes :QUIT
unlinks old_pid
# the File.read will raise Errno::ENOENT:
Process.kill :QUIT, File.read(old_pid).to_i
> (Tom''s thread with the `backlog` fix concerns our new servers,
which
> aren''t yet in production.)
>
> I plan to do a writeup on our transition from mongrel_cluster to
> Unicorn in the near future, in case others are interested. I''ll
post
> the link here when it''s available.
Looking forward to it!
> Also: I''m keeping a mirror of the project at
> http://github.com/defunkt/unicorn for any other GH users who want to
> watch updates in their generalized feed. I update it semi-regularly.
Cool, more exposure''s always good.
Small nit: "Eric Wong''s Unicorn" doesn''t sound quite
right...
While I am the benevolent dictator for now, I do welcome contributions.
I could not have have built it without standing on the shoulders of
Mongrel and the existence of Rack and nginx.
Personally, I try to keep a low public profile and it''s always been an
weird balancing act trying to get people to use my work at the same
time...
> Long live fork(2)! And thanks again for the project.
:)
--
Eric Wong