Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Commits on Nov 17, 2015
  1. examples: add systemd socket and service files

    Eric Wong committed
    Since we have init scripts, we ought to have the equivalent for
    systemd users who cannot upgrade via the normal SIGUSR2 mechanism;
    but can use multiple services: "unicorn@1" + h"unicorn@2" to
    accomplish the same thing.
    Based on examples by Christos Trochalakis <>
Commits on Oct 15, 2015
  1. unicorn.conf.rb: remove mention of REE-specific setting

    Eric Wong committed
    Ruby 2.0+ has a copy-on-write-friendly memory layout by default,
    and REE is long dead and just confusing to new users.
Commits on Jul 15, 2015
  1. doc: remove references to old servers

    Eric Wong committed
    They'll continue to be maintained, but we're no longer advertising
    them.  Also, favor lowercase "unicorn" while we're at it since that
    matches the executable and gem name to avoid unnecessary escaping
    for RDoc.
Commits on Feb 4, 2015
  1. remove old inetd+git examples and exec_cgi

    Eric Wong committed
    While it was technically interesting and fun to tunnel arbitrary
    protocols over a semi-compliant Rack interface, nobody actually does
    it (and anybody who does can look in our git history).  This was
    from back in 2009 when this was one of the few servers that could
    handle chunked uploads,were one of the few users of chunked uploads,
    nowadays everyone does it! (or do they? :)
    A newer version of exec_cgi.rb still lives on in the repository of
    yet another horribly-named server, but there's no point in bloating
    the installation footprint of somewhat popular server such as unicorn.
Commits on Oct 4, 2014
  1. examples: add run_once to before_fork hook example

    Eric Wong committed
    There may be code in a before_fork hook which should run only once,
    document an example using a guard variable since it may not be
    immediately obvious to all users.
    Inspired-by: Bráulio Bhavamitra <>
Commits on Apr 5, 2013
  1. doc: update documentation for systemd + PrivateTmp users

    Eric Wong committed
    The PrivateTmp feature of systemd breaks the usage of /tmp for the
    shared Unix domain socket between nginx and unicorn, so discourage the
    use of /tmp in that case.
    While we're at it, use consistent paths for everything and use an
    obviously intended-for-user-customization "/path/to" prefix instead
    of "/tmp"
    Reported-by: David Wilkins <>
Commits on Nov 29, 2012
  1. check_client_connection: document local-only requirement

    Eric Wong committed
    In my testing, only dropped clients over Unix domain sockets or
    loopback TCP were detected with this option.  Since many
    nginx+unicorn combinations run on the same host, this is not a
    Furthermore, tcp_nodelay:true appears to work over loopback,
    so remove the requirement for tcp_nodelay:false.
  2. Begin writing HTTP request headers early to detect disconnected clients

    Tom Burns committed with Eric Wong
    This patch checks incoming connections and avoids calling the application
    if the connection has been closed.
    It works by sending the beginning of the HTTP response before calling
    the application to see if the socket can successfully be written to.
    By enabling this feature users can avoid wasting application rendering
    time only to find the connection is closed when attempting to write, and
    throwing out the result.
    When a client disconnects while being queued or processed, Nginx will log
    HTTP response 499 but the application will log a 200.
    Enabling this feature will minimize the time window during which the problem
    can arise.
    The feature is disabled by default and can be enabled by adding
    'check_client_connection true' to the unicorn config.
    [ew: After testing this change, Tom Burns wrote:
      So we just finished the US Black Friday / Cyber Monday weekend running
      unicorn forked with the last version of the patch I had sent you.  It
      worked splendidly and helped us handle huge flash sales without
      increased response time over the weekend.
      Whereas in previous flash traffic scenarios we would see the number of
      HTTP 499 responses grow past the number of real HTTP 200 responses,
      over the weekend we saw no growth in 499s during flash sales.
      Unexpectedly the patch also helped us ward off a DoS attack where the
      attackers were disconnecting immediately after making a request.
    ref: <>
    Signed-off-by: Eric Wong <>
Commits on Mar 20, 2012
  1. examples/nginx.conf: use $scheme instead of hard-coded "https"

    Eric Wong committed
    This adds a little more flexibility to the nginx config,
    especially as protocols (e.g. SPDY) become more prevalent.
    Suggested-by: Eike Herzbach <>
  2. examples/nginx.conf: remove redundant word

    Eric Wong committed
    From: Eike Herzbach <>
Commits on Jan 28, 2012
  1. doc: update doc for Ruby 2.0.0dev CoW-friendliness

    Eric Wong committed
    Ruby 2.0.0dev is the future and includes a CoW-friendly GC,
    so we shall encourage folks to give Ruby 2.0.0dev a spin.
Commits on Jun 7, 2011
  1. examples/nginx.conf: better wording for ipv6only comment

    Eric Wong committed
  2. examples/nginx.conf: add ipv6only comment

    Eric Wong committed
    IPv4-mapped-IPv6 addresses are fugly.
Commits on Apr 29, 2011
  1. oob_gc: reimplement to fix breakage and add tests

    Eric Wong committed
    This was broken since v3.3.1[1] since nginx relies on a closed
    socket (and not Content-Length/Transfer-Encoding) to detect
    a response completion.  We have to close the client socket
    before invoking GC to ensure the client sees the response
    in a timely manner.
    [1] - commit b72a86f
  2. examples/big_app_gc: fix comment

    Eric Wong committed
    Oops, comments should match the latest code
  3. examples/big_app_gc: update this example

    Eric Wong committed
    OobGC is actually broken with nginx these days since
    we needed to preserve the env for body.close...
Commits on Apr 27, 2011
  1. examples/nginx.conf: clarify proxy_buffering for Rails 3.1

    Eric Wong committed
    I've tested with nginx 1.0.0 and confirmed "proxy_buffering off;"
    can cause Unicorn to block on a slow client reading a
    large response.  While there's a potential (client-visible)
    performance improvement with Rails 3.1 streaming responses, it
    can also hurt the server with slow clients.
    Rainbows! with (ThreadSpawn or ThreadPool) is probably the best
    way to do streaming responses efficiently from all angles (from
    a server, client and programmer time perspective).
Commits on Apr 12, 2011
  1. @emmanuel

    Document "user" directive in example unicorn conf

    emmanuel committed with Eric Wong
Commits on Mar 29, 2011
  1. add examples/logrotate.conf

    Eric Wong committed
    logrotate is the de facto tool for logrotation, so an
    example config for highlighting important parts are in order.
    Since our USR1 signal handling is part of the crusade against
    the slow and lossy "copytruncate" option, be sure to
    emphasize that :)
Commits on Jan 25, 2011
  1. examples/nginx.conf: use try_files directive

    Eric Wong committed
    This feature is in nginx 0.7.x and 0.8.x and optimized
    better than the "if" directive in nginx.conf
  2. examples/nginx: avoid unnecessary listen directive

    Eric Wong committed
    There's no need to use listen unless you use non-default port or
    can enable "deferred" or "httpready" (which you usually want).
Commits on Oct 27, 2010
  1. examples/unicorn.conf: add a note about throttling signals

    Eric Wong committed
    Sending the same signal faster than the receiver can process
    means signals can get lost.
Commits on Jun 11, 2010
  1. examples/init: "upgrade" task waits for completion

    Eric Wong committed
    This makes the user (sysadmin in this case) more aware if the
    upgrade fails or doesn't work as intended.  This change could be
    more useful for Rainbows! with its long-running responses.
Commits on Jun 4, 2010
  1. doc: emphasize the importance of stderr_path

    Eric Wong committed
    While second nature to myself, stderr_path may be an
    overlooked configuration parameter for some users.  Also,
    add a minimal sample configuration file that is shorter
    and hopefully less intimidating to new users.
Commits on May 6, 2010
  1. examples: add big_app_gc monkey patch

    Eric Wong committed
Commits on Feb 8, 2010
  1. examples/ add "reopen-logs" target

    Eric Wong committed
  2. examples/ reenable set -u

    Eric Wong committed
    This may be used as a basis of other scripts so we need
    to stash $1 before we "set -u"
Commits on Jan 26, 2010
  1. KNOWN_ISSUES: background threads + Logger monkey patch

    Eric Wong committed
    Thanks to Michael Guterl for informing us of the issues
    and testing the monkey patch.
Commits on Nov 24, 2009
  1. Add examples for nginx and unicorn

    Eric Wong committed
    These should help make things easier for folks unfamiliar
    with nginx setups.
Commits on Oct 9, 2009
  1. examples/ remove "set -u"

    Eric Wong committed
    It's too simple of a script and causes running the init script
    with zero arguments to fail instead of printing out the usage
Commits on Aug 18, 2009
  1. examples/echo: "Expect:" value is case-insensitive

    Eric Wong committed
    From RFC 2616, section 14.20:
    > Comparison of expectation values is case-insensitive for
    > unquoted tokens (including the 100-continue token), and is
    > case-sensitive for quoted-string expectation-extensions.
Commits on Jul 4, 2009
  1. Favor Struct members to instance variables

    Eric Wong committed
    There's a small memory reduction to be had when forking
    oodles of processes and the Perl hacker in me still
    gets confused into thinking those are arrays...
Commits on Jul 1, 2009
  1. Remove cat-chunk-proxy, curl CVS supports non-blocking stdin

    Eric Wong committed
    Now that upstream curl supports this functionality, there's
    no reason to duplicate it here as an example.
  2. Force streaming input onto apps by default

    Eric Wong committed
    This change gives applications full control to deny clients
    from uploading unwanted message bodies.  This also paves the
    way for doing things like upload progress notification within
    applications in a Rack::Lint-compatible manner.
    Since we don't support HTTP keepalive, so we have more freedom
    here by being able to close TCP connections and deny clients the
    ability to write to us (and thus wasting our bandwidth).
    While I could've left this feature off by default indefinitely
    for maximum backwards compatibility (for arguably broken
    applications), Unicorn is not and has never been about
    supporting the lowest common denominator.
Commits on Jun 7, 2009
  1. examples/cat-chunk-proxy: link to proposed curl(1) patch

    Eric Wong committed
    Then hopefully soon we'll be able to get rid of this script...
Something went wrong with that request. Please try again.