unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [ANN] unicorn 0.93.3 - OpenBSD compatibility
@ 2009-10-09 23:28  6% Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2009-10-09 23:28 UTC (permalink / raw)
  To: mongrel-unicorn

Unicorn is a HTTP server for Rack applications designed to only serve
fast clients on low-latency, high-bandwidth connections and take
advantage of features in Unix/Unix-like kernels.  Slow clients should
only be served by placing a reverse proxy capable of fully buffering
both the the request and response in between Unicorn and slow clients.

* http://unicorn.bogomips.org/
* mongrel-unicorn@rubyforge.org
* git://git.bogomips.org/unicorn.git

Changes:

This release fixes compatibility with OpenBSD (and possibly
other Unices with stricter fchmod(2) implementations) thanks to
Jeremy Evans.  Additionally there are small documentation
changes all around.

Eric Wong (12):
      doc: expand on the SELF_PIPE description
      fchmod heartbeat flips between 0/1 for compatibility
      examples/init.sh: remove "set -u"
      configurator: update with nginx fail_timeout=0 example
      PHILOSOPHY: clarify experience other deployments
      PHILOSOPHY: plug the Rainbows! spin-off project
      README: remove unnecessary and extraneous dash
      DESIGN: clarification and possibly improve HTML validity
      README: remove the "non-existent" part
      README: emphasize the "fast clients"-only part
      drop the whitespace cleaner for Ragel->C
      unicorn 0.93.3
-- 
Eric Wong

^ permalink raw reply	[relevance 6%]

* [PATCH] doc: expand on the SELF_PIPE description
@ 2009-10-07 22:05  7% Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2009-10-07 22:05 UTC (permalink / raw)
  To: Ryan Tomayko; +Cc: mongrel-unicorn

There seems to be a small amount of confusion regarding how it's
used (and some of the code is not very obvious).  So explain our
usage of it and distinguish its use in the master vs worker(s).
---

  Hi Ryan,

  Great article[1] on Unicorn!  I just noticed a small misunderstanding
  in how SELF_PIPE is used by the workers, so I just updated the RDoc to
  hopefully better describe it.  I believe Unicorn is a great way to
  introduce Unix systems programming and you writing a great article is
  helping a lot :>

  As far as workers going down quickly in case the master dies
  unexpectedly: this is usually handled by checking the parent PID in
  the worker loop (which has a normal[2] upper bound of
  timeout(=default=60)/2.0 seconds per iteration on an idle server).
  Needing to get the workers to go down more quickly than that wasn't
  too important to us, so I made the decision to not get fancier.

  [1] - for those on the mailing list who haven't seen it:
        http://tomayko.com/writings/unicorn-is-unix

  [2] - for the case where speculative accept() is constantly
        successful, then this could be infinity as long as requests
        keep flowing in faster than they can be processed.
	      Not that I expect anybody to care or hit this case
        (unexpectedly dead masters are very uncommon already :>).

 lib/unicorn.rb |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/lib/unicorn.rb b/lib/unicorn.rb
index ddec8e9..d63567f 100644
--- a/lib/unicorn.rb
+++ b/lib/unicorn.rb
@@ -42,7 +42,23 @@ module Unicorn
     # This hash maps PIDs to Workers
     WORKERS = {}
 
-    # See: http://cr.yp.to/docs/selfpipe.html
+    # We use SELF_PIPE differently in the master and worker processes:
+    #
+    # * The master process never closes or reinitializes this once
+    # initialized.  Signal handlers in the master process will write to
+    # it to wake up the master from IO.select in exactly the same manner
+    # djb describes in http://cr.yp.to/docs/selfpipe.html
+    #
+    # * The workers immediately close the pipe they inherit from the
+    # master and replace it with a new pipe after forking.  This new
+    # pipe is also used to wakeup from IO.select from inside (worker)
+    # signal handlers.  However, workers *close* the pipe descriptors in
+    # the signal handlers to raise EBADF in IO.select instead of writing
+    # like we do in the master.  We cannot easily use the reader set for
+    # IO.select because LISTENERS is already that set, and it's extra
+    # work (and cycles) to distinguish the pipe FD from the reader set
+    # once IO.select returns.  So we're lazy and just close the pipe when
+    # a (rare) signal arrives in the worker and reinitialize the pipe later.
     SELF_PIPE = []
 
     # signal queue used for self-piping
-- 
Eric Wong

^ permalink raw reply related	[relevance 7%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2009-10-07 22:05  7% [PATCH] doc: expand on the SELF_PIPE description Eric Wong
2009-10-09 23:28  6% [ANN] unicorn 0.93.3 - OpenBSD compatibility Eric Wong

Code repositories for project(s) associated with this public inbox

	https://yhbt.net/unicorn.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).