Remove -std=c99
[ebb.git] / README
blob9f9a08d606e957fbc769ca1cf010c34391e12c6f
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 
14 [Evented Mongrel](http://swiftiply.swiftcore.org/mongrel.html) web server; 
15 except instead of using EventMachine (a ruby binding to libevent), the Ebb 
16 web server is written in C and uses the 
17 [libev](http://software.schmorp.de/pkg/libev.html) event loop library.
19 Connections are processed as follows:
21 1. libev loops and waits for incoming connections.
23 2. When Ebb receives a connection, it passes the request into the
24    [mongrel state machine](http://mongrel.rubyforge.org/browser/tags/rel_1-0-1/ext/http11/http11_parser.rl) 
25    which securely parses the headers.
27 3. When the request is complete, Ebb passes the information to a user
28    supplied callback.
30 4. The Ruby binding supplying this callback transforms the
31    request into a [Rack](http://rack.rubyforge.org/) compatible `env` hash 
32    and passes it on a Rack adapter.
34 Because Ebb is written mostly in C, other language bindings can be added to
35 make it useful to Non-Ruby frameworks. For example, a Python WSGI interface is
36 forthcoming.
38 ## Download
40 The Ruby binding is available as a Ruby Gem. It can be install by executing
42   `gem install ebb`
44 Ebb depends on having glib2 headers and libraries installed. (Easily available
45 on any UNIX system.) Manual download can be done at
46 the [RubyForge project page](http://rubyforge.org/frs/?group_id=5640).
48 ## Why?
50 Because by building the server in C one is able to side-step the 
51 limitations on speed of many scripting languages. Inefficiencies are okay
52 for quick and beautiful code, but for production web servers that might handle
53 thousands of requests a second, an attempt should be made to be as efficient
54 as possible in processing connections.
56 Following are some benchmarks. Please take these measurements with a grain
57 of salt. Benchmarks like these are notorious for presenting an inaccurate
58 or highly slanted view of how software performs. 
59 The code for these can be found in the `benchmark` directory.
61 ![Response Size](http://s3.amazonaws.com/four.livejournal/20080227/response_size.png)
63 This shows how the web servers perform with respect to throughput (using a 
64 simple Rack application). Concurrency is at 50 clients.
66 ![Concurrency](http://s3.amazonaws.com/four.livejournal/20080227/concurrency.png)
68 A simple concurrent clients benchmark serving a *hello world* page.
70 ![Uploads](http://s3.amazonaws.com/four.livejournal/20080227/post_size.png)
72 Ebb processes uploads before handing it over to the web application. This 
73 allows Ebb to continue to process other clients while the upload is in 
74 progress. The cliff at 40k here is because Ebb's internal request
75 buffer is set at 40 kilobytes before it writes to file.
78 ## Contributions
81 Contributions (patches, criticism, advice) are very welcome! The source code
82 is hosted at [repo.or.cz](http://repo.or.cz/w/ebb.git). It can be retrieved 
83 by executing
85 `git clone http://repo.or.cz/r/ebb.git`
87 I intend to keep the C code base very small, so do email me before writing any
88 large additions. Here are some features that I would like to add:
90 * Multipart parser
91 * Streaming responses
92 * Optimize and clean up upload handling
93 * Option to listen on unix sockets instead of TCP
94 * Python binding
96 ## (The MIT) License
98 Copyright © 2008 [Ry Dahl](http://tinyclouds.org) (ry at tiny clouds dot org)
100 <div id="license">
101 Permission is hereby granted, free of charge, to any person obtaining
102 a copy of this software and associated documentation files (the
103 "Software"), to deal in the Software without restriction, including
104 without limitation the rights to use, copy, modify, merge, publish,
105 distribute, sublicense, and/or sell copies of the Software, and to
106 permit persons to whom the Software is furnished to do so, subject to
107 the following conditions:
109 The above copyright notice and this permission notice shall be
110 included in all copies or substantial portions of the Software.
112 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
113 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
114 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
115 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
116 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
117 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
118 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
119 </div>