ry / ebb fork watch download tarball
public this repo is viewable by everyone
Description: web server
Homepage: http://ebb.rubyforge.org
Clone URL: git://github.com/ry/ebb.git
Ryan Dahl (author)
2 months ago
commit  62b496c6d96f8e7cf52c258c740d63c7b1d23ccf
tree    aecdf1790d4f7de6d3661c512fe678e29e42b817
parent  0e2dc886e26a1afc11882f3f6e999943d7af2478
ebb /
name age message
folder README Wed Feb 27 07:51:20 -0800 2008 more site changes [Ryan Dahl]
folder Rakefile Wed Feb 27 07:51:20 -0800 2008 more site changes [Ryan Dahl]
folder VERSION Sat Feb 23 10:28:25 -0800 2008 add version file [Ryan Dahl]
folder benchmark/ Wed Feb 27 07:51:20 -0800 2008 more site changes [Ryan Dahl]
folder bin/ Tue Feb 26 17:06:52 -0800 2008 more small changes - ebb_rails working [Ryan Dahl]
folder libev/ Sun Feb 17 09:45:36 -0800 2008 File reorganization [Ryan Dahl]
folder ruby_lib/ Tue Feb 26 17:06:52 -0800 2008 more small changes - ebb_rails working [Ryan Dahl]
folder site/ Wed Feb 27 07:51:20 -0800 2008 more site changes [Ryan Dahl]
folder src/ Tue Feb 26 16:29:33 -0800 2008 small fixes - clean up - tests [Ryan Dahl]
README
# A Web Server Called *Ebb*

## Intended Use

Ebb aims to be a very small and fast web server specifically for hosting 
web frameworks like Rails, Merb, and in the future Django.

It is *not* meant to be a full featured web server like Lighttpd, Apache, or
Nginx. Rather it should be used in multiplicity behind a load balancer and
a front-end server. It is not meant to serve static files in production.

## Design

The design is similar to the 
[Evented Mongrel](http://swiftiply.swiftcore.org/mongrel.html) web server; 
except instead of using EventMachine (a ruby binding to libevent), the Ebb 
web server is written in C and uses the 
[libev](http://software.schmorp.de/pkg/libev.html) event loop library.

Connections are processed as follows:

1. libev loops and waits for incoming connections.
2. When Ebb receives a connection, it passes the request into the
   [mongrel state machine](http://mongrel.rubyforge.org/browser/tags/rel_1-0-1/ext/http11/http11_parser.rl) 
   which securely parses the headers.
3. When the request is complete, Ebb passes the information to a user
   supplied callback.
4. The Ruby binding supplying this callback transforms the
   request into a [Rack](http://rack.rubyforge.org/) compatible `env` hash 
   and passes it on a Rack adapter.

Because Ebb is written mostly in C, other language bindings can be added to
make it useful to Non-Ruby frameworks. For example, a Python WSGI interface is
forthcoming.

## Download

The Ruby binding is available as a Ruby Gem. It can be install simply by 
executing

  `gem install ebb`

Ebb depends on having glib2 headers and libraries installed. (Easily available
on any UNIX system.)

## Why?

Because by building the server in C one is able to side-step the 
limitations on speed of many scripting languages. Inefficiencies are okay
for quick and beautiful code, but for production web servers that might handle
thousands of requests a second, an attempt should be made to be as efficient
as possible in processing connections.

![Response Size](http://s3.amazonaws.com/four.livejournal/20080227/response_size.png)

This shows how the web servers perform with respect to throughput (using a 
simple Rack application). Concurrency is at 50 clients.

![Concurrency](http://s3.amazonaws.com/four.livejournal/20080227/concurrency.png)

A simple concurrent clients benchmark serving a *hello world* page.

![Uploads](http://s3.amazonaws.com/four.livejournal/20080227/post_size.png)

Ebb processes upload before handing it over to the web application. This 
allows Ebb to continue to process other clients while the upload is in 
progress. The large difference here is merely because Ebb's internal request 
buffer is set at 40 kilobytes before it writes to file. (Improvement can 
be made here.)


## Contributions


Contributions (patches, criticism, advice) are very welcome! The source code
it hosted at [repo.or.cz](http://repo.or.cz/w/ebb.git) can be gotten by 
executing

`git clone http://repo.or.cz/r/ebb.git`

I intend to keep the C code base very small. Do email me before writing any
large additions. Here are some features that I want to add:

### Todo 
* Multipart parser
* Streaming responses
* Optimize and clean up upload handling
* Option to listen on unix sockets instead of TCP
* Python binding

## (The MIT) License

Copyright © 2008 [Ry Dahl](http://tinyclouds.org) (ry at tiny clouds dot org)

<div id="license">
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
</div>