Zbatery: Rack HTTP server without a fork stuck in it

Zbatery is an HTTP server for Rack applications on systems that either do not support fork(), or have no memory (nor need) to run the master/worker model. It is based on Rainbows! (which is based on Unicorn (which is based on Mongrel)) and inherits parts of each. Zbatery supports your choice of all the thread/fiber/event/actor-based concurrency models and Rack middleware that Rainbows! supports (or will ever support) in a single process.

If you're on GNU/Linux and overwhelmed by options in zbatery, consider yahns as it has fewer options, optional fork usage, and more energy-efficient during non-peak traffic.

Zbatery will still exploit certain features of Unix for transparent upgrades, log reopening, and graceful stops, but does not rely on them for basic functionality.



Zbatery is copyright 2009,2010,2011 by all contributors (see logs in git). Zbatery is licensed under the Ruby (1.8) license or the GPL (v2 or v3). See the included LICENSE file for more details.

Zbatery is 100% Free Software.


You may install it via RubyGems on RubyGems.org:

gem install zbatery

Zbatery depends on Rainbows!, and in turn, Unicorn. Despite Unicorn and Rainbows! being Unix-only, the Unicorn HTTP parser C extension should build on non-Unix-like systems (unverified).


for Rack applications

In APP_ROOT (where config.ru is located), run:


Zbatery will bind to all interfaces on TCP port 8080 by default.

Configuration File(s)

Zbatery will look for the config.ru file used by rackup in APP_ROOT.

For deployments, it can use a config file for Unicorn and Rainbows!-specific options specified by the --config-file/-c command-line switch. Zbatery accepts all options found in Unicorn::Configurator as well as the "Rainbows!" block, so you can have the following in your config file:

Rainbows! do
  use :ThreadSpawn
  worker_connections 666

See the Rainbows! configuration documentation for more details.


There is NO WARRANTY whatsoever if anything goes wrong, but let us know and we'll try our best to fix it.


Most of the work is done in Rainbows!, Zbatery is just a shim to allow access to Rainbows! without requiring fork() or signals.

You can get the latest source via git from the following locations:

git://repo.or.cz/zbatery.git (mirror)

You may browse the code from the web and download the latest snapshot tarballs here:

Inline patches (from "git format-patch") to the mailing list are preferred because they allow code review and comments in the reply to the patch.

We will adhere to mostly the same conventions for patch submissions as git itself. See the Documentation/SubmittingPatches document distributed with git on on patch submission guidelines to follow. Just don't email the git mailing list or maintainer with Zbatery patches.


There currently are no tests specific to Zbatery. Keep in mind that Zbatery is only a small shim to drive Rainbows! (and Unicorn) underneath. Rainbows! and Unicorn both have extensive (but very UNIX-specific) test suites.


All feedback (bug reports, user/development discussion, patches, pull requests) go to the mailing list/public-inbox. We are currently borrowing the Rainbows! mailing list since most of our code (and problems) are related to Rainbows! rainbows-public@bogomips.org.

We love to hear from you!
Email patches (using git send-email), pull requests (formatted using git request-pull), questions, bug reports, suggestions, etc. to us publically at:
Mail archives are available at: http://bogomips.org/rainbows-public/
Please send plain-text email only and do not waste bandwidth on HTML mail, HTML mail will not be read.
Quote as little as reasonable and do not top post.
For sensitive topics, email us privately at: rainbows@bogomips.org