Yahns - sleepy application server for Ruby (tech preview)

Hi all, pushed out yahns 0.0.0TP1 (tech preview 1) to RubyGems.org
$ gem install --pre yahns
$ git clone git://yhbt.net/yahns
we like plain-text email [email protected]

yahns - sleepy, multi-threaded, non-blocking application server for Ruby

A Free Software, multi-threaded, non-blocking network application server
designed for low idle power consumption. It is primarily optimized
for applications with occasional users which see little or no traffic.
yahns currently hosts Rack/HTTP applications, but may eventually support
other application types. Unlike some existing servers, yahns is
extremely sensitive to fatal bugs in the applications it hosts.


  • zero wakeups when all clients are idle
  • idle client connections may live forever if there is no FD pressure
  • suitable for slow clients, fast clients, or a mixture of both
  • HTTP/0.9 support
  • HTTP/1.1 persistent connections and pipelining
  • decodes HTTP chunked encoding for requests
  • parses HTTP/1.1 trailers in requests
  • supports streaming responses with lazy buffering for slow clients
  • optional streaming input for fast clients
  • able to host multiple applications with different settings
  • uses epoll to scale to many idle connections
  • abuses epoll as a load balancer between threads inside a process
  • optional multi-process support (in addition to threads)
  • fairly balances new clients between multiple processes (on Linux)

Supported Platforms

yahns is developed primarily for modern GNU/Linux systems.

We may support kqueue for FreeBSD/OpenBSD/NetBSD if there is significant
interest. Non-Free systems/dependencies will never be supported

Supported Ruby implementations:

  • (Matz) Ruby 2.0 or later
  • Rubinius 2.0 or later (planned)


We are happy to see feedback of all types via plain-text email.
Please send comments, user/dev discussion, patches, bug reports,
and pull requests to the public mailing list at:

[email protected]

No subscription is necessary to post. Please Cc: all recipients as
subscription is not necessary.

You may subscribe by sending a request to:

[email protected]
with the Subject line: “subscribe”

This README is our homepage, we would rather be working on HTTP servers
all day than worrying about the next browser vulnerability because
HTML/CSS/JS is too complicated for us.


We use git and follow the same development model as git itself
(mailing list-oriented, benevolent dictator).

git clone git://yhbt.net/yahns

Please use git-format-patch(1) and git-send-email(1) distributed with
the git(7) suite for generating and sending patches. Please format
pull requests with the git-request-pull(1) script (also distributed
with git(7)) and send them via email.

See http://www.git-scm.com/ for more information on git.


yahns is designed to optimimally use multiple threads with non-blocking
The event loop is not a traditional single-threaded design with a mutex
slapped on as an afterthought, but designed from the beginning to
multiple threads.

  • two classes of long-lived, persistent threads
    1. blocking acceptors
    2. non-blocking event loop workers
  • epoll acts as a queue (by using one-shot notifications)
  • acceptors accept new clients and put them in the epoll “queue”
  • workers pull clients off the queue, rearming them to epoll on EAGAIN

The end result is clients transition freely and fairly between threads
and will always be able to find the next idle thread to run on.

This design works with kqueue, too, and we will support kqueue if there
is interest. In fact, got our design inspiration from the name “kqueue”
when working on another project. We may also support libkqueue:


In addition to multiple threads, yahns optionally supports multiple
processes to work around low FD limits as well as contention in the:

  • kernel (socket (de)allocation from accept/close)
  • standard C library (malloc/free)
  • Ruby VM (GVL, GC)
  • application it hosts


Copyright 2013, Eric W. [email protected] and all contributors.
License: GPLv3 or later https://www.gnu.org/licenses/gpl-3.0.txt

yahns is copyrighted Free Software by all contributors, see logs in
revision control for names and email addresses of all of them. yahns
contains code from Mongrel, unicorn, and Rainbows! which may also be
licensed under the GPLv2 or later.

yahns is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.

yahns is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
for more details.

You should have received a copy of the GNU General Public License along
with this program; if not, see https://www.gnu.org/licenses/gpl-3.0.txt

lrg nabgure ubeevoyl-anzrq freire :>

yahns 0.0.1 - many small fixes and test coverage

Just a bunch of improvements found while running tests.
It’s still incomplete and missing a bunch of features from
existing servers, but maybe it works…

Clone git://yhbt.net/yahns.git for full details

Eric W. (18):
test/helper: fix __covmerge race for forked processes
wire up client_max_body_size limits
fix and test Rack hijack support
SIGUSR2 handling uses Process.spawn + tests
fix USR1 log reopening when using worker_processes
test_bin: add additional tests for SIGHUP
test_server: skip test_mp_balance for now
test/server_helper: dump entire log on errors
ensure we stop all threads at exit
GNUmakefile: avoid calling exit in test-mt
test_bin: set close-on-exec for Ruby 1.9.3 compatibility
test_server: bigger delays for graceful shutdown test
tests: disable $-w on 1.9.3 to quiet down warnings
test/helper: prevent minitest at_exit from running in children
recheck IO#closed? on thread pools after a short delay
test_config: isolate directories with logs
test_reopen_logs: workaround timing problem with worker_processes
set close-on-exec on all long-lived descriptors