Merb, Mongrel+Erb

Hey there folks-

I'm happy to announce the first useable release of my new pocket-

framework Merb. Merb is a mongrel handler with built in controller
and view templating with erb. It has a nice routing system similar to
rails but much simpler. It uses some of the code from the camping
handler and the rails handler and then some of its own secret sauce
to form imho a nice fast little framework.

ActiveRecord is supported as shown in the sample app. Merb does not

use cgi.rb at all(yay!) but can handle file uploads very well. See
the sample app. And it can process concurrent file uploads without
blocking. Merb also supports the X-SENDFILE header so you can set
that header to a path to a file in your controller and then mongrel
will serve it directly and your controller can continue on to the
next request.

Merb is a pet project of mine but was born out of real life need. I

am using it in combination with rails apps that need a lot of file
uploads or need to serve some dynamic pages faster then rails will
allow. Right now Merb performs very well for a dynamic ruby framework
thanks to mongrel being very fast when it doesn’t have the Rails
Albatross ? on its back. Serving a dynamic templated page thru merb
routing and controller with 10 ActiveRecord objects being listed out
in the view, merb clocks in at 400req/sec on my macbook and a bit
better on a real server. Static files are served as fast as mongrel can.

I am using this along side a rails app by rewriting requests to a

suburl to the merb mongrel like /foo → merb handler. I am
investigating making it possible to mount merb at a url in mongrel
itself along side a rails app but I have to do more testing to see
how that affects everything.

If you want to play along at home you can do this to get a quick start:

$ sudo gem install merb
$ gem unpack merb
$ cd merb-0.0.3/examples/sample_app

edit the conf/merb_init.rb to add your database password info.

then add a posts table to your db with a title and body column.

$ merb start -t

Then you can browse to these urls to play around.

http://localhost:4000/posts/new
or
http://localhost:4000/posts/list
or
http://localhost:4000/uploads/start

Here are the relevant links if you want to get involved with Merb
development.

http://rubyforge.org/frs/?group_id=2383
http://merb.devjavu.com/
http://svn.devjavu.com/merb
http://brainspl.at/articles/2006/10/15/merb-gets-cool-routes-and-file-
uploads

Keep in mind that Merb is only a week or two old and is changing

fast! If you want to get in on the ground floor and help me add to
the base system then you are most welcome. On the other hand, if Merb
kills your children I am not responsible :wink:

Thanks for playing!

Cheers-

– Ezra Z.
– Lead Rails Evangelist
[email protected]
– Engine Y., Serious Rails Hosting
– (866) 518-YARD (9273)