README in ebb-0.0.4 vs README in ebb-0.1.0

- old
+ new

@@ -1,92 +1,83 @@ # A Web Server Called *Ebb* Ebb aims to be a small and fast web server specifically for hosting -web frameworks like Rails, Merb, and in the future Django. +dynamic web applications. 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. -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](http://brainspl.at/articles/2007/11/09/a-fair-proxy-balancer-for-nginx-and-mongrel) -and a front-end server. It is not meant to serve static files in production. +At one level Ebb is a minimalist C library that ties together the +[Mongrel state machine](http://mongrel.rubyforge.org/browser/tags/rel_1-0-1/ext/http11/http11_parser.rl) +and [libev](http://software.schmorp.de/pkg/libev.html) event loop. One can use +this library to drive a web application written in C. (Perhaps for embedded +devices?) However, most people will be interested in the binding of this +library to the Ruby programming language. The binding provides a +[Rack](http://rack.rubyforge.org/) server interface that allows it to host +Rails, Merb, or other frameworks. -## Design +A Python-WSGI binding is under development. -The design is similar to the [Evented -Mongrel](http://swiftiply.swiftcore.org/mongrel.html) web server; except -instead of using [EventMachine](http://rubyeventmachine.com/) to drive -network interactions, the Ebb web server handles sockets directly in C and -employs the use of the [libev](http://software.schmorp.de/pkg/libev.html) -event loop. +## Install -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 by executing - `gem install ebb` + gem install ebb -Ebb depends on having glib2 headers and libraries installed. (Easily available -on any UNIX system.) Manual download can be done at +Ebb depends on having glib2 headers and libraries installed. For example, in +Macintosh if one is using Darwin ports then the following should do the trick + + port install glib2 + +Downloads are available at the [RubyForge project page](http://rubyforge.org/frs/?group_id=5640). -## Why? +## Running -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. +Using the executable `ebb_rails` one can start Ebb with a Rails project. Use +`ebb_rails -h` to see all of the options but to start one can try -Following are some benchmarks. Please take these measurements with a grain -of salt. Benchmarks like these are notorious for presenting an inaccurate -or highly slanted view of how software performs. -The code for these can be found in the `benchmark` directory. + cd my_rails_project/ + ebb_rails start -![Response Size](http://s3.amazonaws.com/four.livejournal/20080227/response_size.png) +When using `ebb_rails` from monit, the monitrc entry might look like this: -This shows how the web servers perform with respect to throughput (using a -simple Rack application). Concurrency is at 50 clients. + check process myApp4000 + with pidfile /home/webuser/myApp/current/tmp/ebb.4000.pid + start program = "/usr/bin/ruby /usr/bin/ebb_rails start -d -e production -p 4000 -P /home/webuser/myApp/current/tmp/ebb.4000.pid -c /home/webuser/myApp/current" as uid webuser and gid webuser + stop program = "/usr/bin/ruby /usr/bin/ebb_rails stop -P /home/webuser/myApp/current/tmp/ebb.4000.pid" as uid webuser and gid webuser + if totalmem > 120.0 MB for 2 cycles then restart + if loadavg(5min) greater than 10 for 8 cycles then restart + group myApp -![Concurrency](http://s3.amazonaws.com/four.livejournal/20080227/concurrency.png) +To use Ebb with a different framework you will have to do a small amount of +hacking at the moment! :) -A simple concurrent clients benchmark serving a *hello world* page. +## Speed -![Uploads](http://s3.amazonaws.com/four.livejournal/20080227/post_size.png) +Because Ebb-Ruby handles most of the processing in C, it is able to do work +often times more efficiently than other Ruby language web servers. -Ebb processes uploads before handing it over to the web application. This -allows Ebb to continue to process other clients while the upload is in -progress. The cliff at 40k here is because Ebb's internal request -buffer is set at 40 kilobytes before it writes to file. +![Benchmark](http://s3.amazonaws.com/four.livejournal/20080311/ebb.png) +Ebb-Ruby can handle threaded processing better than the other 'evented' +servers. This won't be of any benefit to Rails applications because Rails +places a lock around each request that wouldn't allow concurrent processing +anyway. In Merb, for example, Ebb's thread handling will allow Ebb instances +to handle larger loads. [More](http://four.livejournal.com/848525.html) + ## Contributions -Contributions (patches, criticism, advice) are very welcome! The source code -is hosted at [repo.or.cz](http://repo.or.cz/w/ebb.git). It can be retrieved +Contributions (patches, criticism, advice) are very welcome! +Please send all to to +[the mailing list](http://groups.google.com/group/ebbebb). + +The source code +is hosted [github](http://github.com/ry/ebb/tree/master). It can be retrieved by executing -`git clone http://repo.or.cz/r/ebb.git` + git clone git://github.com/ry/ebb.git -I intend to keep the C code base very small, so do email me before writing any -large additions. Here are some features that I would like to add: -* Streaming responses! +Here are some features that I would like to add: * HTTP 1.1 Expect/Continue (RFC 2616, sections 8.2.3 and 10.1.1) * A parser for multipart/form-data * Optimize and clean up upload handling * Option to listen on unix sockets instead of TCP * Python binding