decrease buffersize - fix readme
[ebb.git] / README
blobfe7ae30c462fa5f608976fa445e99e218e7e79cb
1 # A Web Server Called *Ebb*
3 Ebb aims to be a small and fast web server specifically for hosting 
4 web frameworks like Rails, Merb, and in the future Django.
6 It is not meant to be a full featured web server like Lighttpd, Apache, or
7 Nginx. Rather it should be used in multiplicity behind a 
8 [load balancer](http://brainspl.at/articles/2007/11/09/a-fair-proxy-balancer-for-nginx-and-mongrel) 
9 and a front-end server. It is not meant to serve static files in production.
11 ## Design
13 The design is similar to the [Evented
14 Mongrel](http://swiftiply.swiftcore.org/mongrel.html) web server; except
15 instead of using [EventMachine](http://rubyeventmachine.com/) to drive
16 network interactions, the Ebb web server handles sockets directly in C and
17 employs the use of the [libev](http://software.schmorp.de/pkg/libev.html)
18 event loop.
20 Connections are processed as follows:
22 1. libev loops and waits for incoming connections.
24 2. When Ebb receives a connection, it passes the request into the
25    [mongrel state machine](http://mongrel.rubyforge.org/browser/tags/rel_1-0-1/ext/http11/http11_parser.rl) 
26    which securely parses the headers.
28 3. When the request is complete, Ebb passes the information to a user
29    supplied callback.
31 4. The Ruby binding supplying this callback transforms the
32    request into a [Rack](http://rack.rubyforge.org/) compatible `env` hash 
33    and passes it on a Rack adapter.
35 Because Ebb is written mostly in C, other language bindings can be added to
36 make it useful to Non-Ruby frameworks. For example, a Python WSGI interface is
37 forthcoming.
39 ## Download
41 The Ruby binding is available as a Ruby Gem. It can be install by executing
43   `gem install ebb`
45 Ebb depends on having glib2 headers and libraries installed. (Easily available
46 on any UNIX system.) Manual download can be done at
47 the [RubyForge project page](http://rubyforge.org/frs/?group_id=5640).
49 ## Why?
51 Because by building the server in C one is able to side-step the 
52 limitations on speed of many scripting languages. Inefficiencies are okay
53 for quick and beautiful code, but for production web servers that might handle
54 thousands of requests a second, an attempt should be made to be as efficient
55 as possible in processing connections.
57 Following are some benchmarks. Please take these measurements with a grain
58 of salt. Benchmarks like these are notorious for presenting an inaccurate
59 or highly slanted view of how software performs. 
60 The code for these can be found in the `benchmark` directory.
62 ![Response Size](http://s3.amazonaws.com/four.livejournal/20080227/response_size.png)
64 This shows how the web servers perform with respect to throughput (using a 
65 simple Rack application). Concurrency is at 50 clients.
67 ![Concurrency](http://s3.amazonaws.com/four.livejournal/20080227/concurrency.png)
69 A simple concurrent clients benchmark serving a *hello world* page.
71 ![Uploads](http://s3.amazonaws.com/four.livejournal/20080227/post_size.png)
73 Ebb processes uploads before handing it over to the web application. This 
74 allows Ebb to continue to process other clients while the upload is in 
75 progress. The cliff at 40k here is because Ebb's internal request
76 buffer is set at 40 kilobytes before it writes to file.
78 ## Contributions
80 Contributions (patches, criticism, advice) are very welcome! The source code
81 is hosted at [repo.or.cz](http://repo.or.cz/w/ebb.git). It can be retrieved 
82 by executing
84 `git clone http://repo.or.cz/r/ebb.git`
86 I intend to keep the C code base very small, so do email me before writing any
87 large additions. Here are some features that I would like to add:
88 * Streaming responses!
89 * HTTP 1.1 Expect/Continue (RFC 2616, sections 8.2.3 and 10.1.1)
90 * A parser for multipart/form-data
91 * Optimize and clean up upload handling
92 * Option to listen on unix sockets instead of TCP
93 * Python binding
95 ## (The MIT) License
97 Copyright © 2008 [Ry Dahl](http://tinyclouds.org) (ry at tiny clouds dot org)
99 <div id="license">
100 Permission is hereby granted, free of charge, to any person obtaining
101 a copy of this software and associated documentation files (the
102 "Software"), to deal in the Software without restriction, including
103 without limitation the rights to use, copy, modify, merge, publish,
104 distribute, sublicense, and/or sell copies of the Software, and to
105 permit persons to whom the Software is furnished to do so, subject to
106 the following conditions:
108 The above copyright notice and this permission notice shall be
109 included in all copies or substantial portions of the Software.
111 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
112 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
113 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
114 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
115 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
116 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
117 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
118 </div>