Introducing the Merb
Posted by ezmobius Mon, 09 Oct 2006 23:02:00 GMT
Meet the ‘Merb’. Merb == Mongrel + Erb. It is a super lightwieght ruby app server that maps urls to simple classes that can render erb templates.
so a request to:
/foo/bar/baz/12
maps to:
Foo.new.bar('baz', '12')
It parses the query string and form posts into @params and @cookies so you can use them in your mini controllers. This is just a toy for now but actually quite useful. If you have a few pages of your dynamic site that have to be fast and you maybe don’t need the full power of rails then Merb can serve dynamic templated requests at 700req/sec with no database access. I’ll get some benchmarks for db access as well soon. But the idea is to also be able to handle multiple file uploads at once without blocking your rails processes. You can either use your front end webservers rewrite module to send all requests to /merb or whatever to the merb server. I am also exploring making it so you can add this as a handler to the mongrels that run your main app and have them co-exist with your rails app mounted at a certain url.
Anyway, please have a play with it and send any feature requests or bugs to the trac install here: Merb Trac Install
And here is the readme that gives a little more detail about how Merb works currently. Merb README
You can check it out of svn here:
svn co http://svn.devjavu.com/merb
There is a little sample app with a few controllers inside the repo. just run ruby server.rb and play on localhost:4000 a bit.
Feedback is most welcome at this point
Searching...





Nice Ezra, I actually did something very similar for the company I'm working for now. 99% of the requests we got were for very specific urls and didn't need the full power of rails. I wanted something thread save so I didn't have to worry about blocking rails requests. I ended up making a custom mongrel handler and improving on mongrel's Compression handler. Eventually I'd really like to see rails become thread safe. It's even a project I've considered undertaking recently.
there are some path issues. server.rb doesn't point to the example/sample_app which is two dir's below. just so you know.
@Amr-
i have been updating things so you shoudl install the gem instead and use the merb start command from within the sample app dir.
very specific urls and didn't need the full power of rails.