Merb is useable and a gem

Posted by ezmobius Wed, 18 Oct 2006 00:03:00 GMT

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.


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

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 ;)

Thanks for playing!

Tags , ,  | 9 comments


  1. ivo said about 8 hours later:
    can't wait playing around with it. what about getting upload progress information while uploading (e.g. like are ther any plans getting this working sometimes? regards ivo
  2. Ezra said about 23 hours later:
    Yeah that will be pretty easy to integrate and I have plans to do so but its not in there yet.
  3. Tom said 1 day later:
    Hi Ezra,
    merb is great! how about renaming "conf" to "config" for that you could "merge" a merb project handling file uploads into the directory structure of an existing rails project? like:
    Cheers, tom
  4. Amr Malik said 3 days later:
    Hey Ezra, cool stuff! one quick thing, the line regarding the uploads should say "upload" not "uploads" (quoting the line below) >>> http://localhost:4000/uploads/start cheers, Amr
  5. David Felstead said 5 days later:
    This is very neat! I was thinking about building something exactly like this (Mongrel + lightweight Ruby web framework) a few days ago, and lo and behold, here it is! Good stuff :)
  6. said 5 days later:
    Hi, I downloaded Merb in a separate directory (windows XP), ran gem install merb gem unpack merb merb start -t but I get errors refering to InstantRails: the last one saying: 'require' from D:/InstantRails/ruby/lib/ruby/gems/1.8/gems/merb-0.0.3/bin from D:/InstantRails/ruby/bin/merb:18:in 'load' from D:/InstantRails/ruby/bin/merb:18 I ran the "gem" commands D:/InstantRails/Ruby/ What should I do to get out of this error? Thanks Per-Olof
  7. Brandon Z said 6 days later:
    Sounds really cool, but (if I may be so bold as to say so) it could use a catchier name. How about Catnip (mongrel + [h]erb)? That might work, even though mongrels are normally dogs. Good names contribute to the success of their bearers. Compare Ruby, Rails, Java, C#, BASIC, to APL, Algol, Lisp (has a negative connotation, even though it is very memorable), Smalltalk (same as Lisp).
  8. hrln said 99 days later:
    did gem install and there is no conf directory...
  9. Mark Thomas said 136 days later:
    How about the name "maglev" because of its relationship with Rails. It's like a Rails "lite". Not as many routes supported, but it sure goes fast!

(leave url/email »)

   Preview comment