Monthly Archives: January 2008

Standout Jobs: launched

Yeah I know, I’m very late on this. I’m the latest one of the gang to blog about it. has launched a couple days ago and demoed at DEMO earlier today.

We’ve worked very hard on this and I’m really proud of the result!


Please give it a look and let me know what you think!


Filed under StandoutJobs

Get intimate with your load balancer tonight!

The Thin Cheesecake release is out (v0.6.1)!

sudo gem install thin

That tasty and sweet Cheesecake release comes with some new sweet topping: config file support, uses less memory, some speed tweaks, but that’s nothing new regarding what we all know and use from other web servers. Nothing very innovative, breath taking, crazy, revolutionary or surprising you say.

You’re right!

Almost …

There’s another feature that as never been seen amongst Ruby web servers (indeed, haven’t found any that does that). But first, lets explore the typical deployment of a Rails app.

Let’s deploy Rails shall we?

Typically you’d deploy your rails application using mongrel like this:

mongrel_rails cluster::configure -C config/mongrel_cluster.yml --servers 3 --chdir /var/www/app/current ...
mongrel_rails cluster::start -C config/mongrel_cluster.yml

Then on your web server / load balancer configuration file (Nginx in this case):

upstream  backend {

Now with Thin, it’s the same

thin config -C config/thin.yml --servers 3 --port 5000 --chdir ...
thin start -C config/thin.yml

That will start 3 servers running on port 5000, 5001 and 5002.
And your web server configuration stays the same.

Really, between you and me, is Thin really really faster?

Simple “hello world” app, running one server

And uses less memory too:
Mesured after running: ab -n5000 -c3

What about that new, crazy, amazing feature you mentioned?

Ever wanted to keep closer to you web server? Sometimes connecting through a TCP port on feels a bit … disconnected. What if we’d get closer to it, get intimate with it, share some feelings, exchange toothbrush?

Introducing UNIX socket connections

When using more then one server (a cluster) behind a load balancer, we need to connect those servers to the load balancer through dedicated ports like in the previous “Let’s deploy Rails” section. But this connect the 2 using a TCP socket which means, all requests have to go though the network interface stuff twice! Once from the client (browser) to the load balancer / web server and again to the backend server.

There’s a better approach to this. Some load balancer (like Nginx) support connecting to a UNIX domain socket.


upstream  backend {
  server   unix:/tmp/thin.0.sock;
  server   unix:/tmp/thin.1.sock;
  server   unix:/tmp/thin.2.sock;

Then start your Thin servers, like this:
thin start --server 3 --socket /tmp/thin.sock

And yes, it is faster:
3 servers running a simple Rails application, behind Nginx


Filed under ruby, thin

DemoCampCUSEC follow-up

Yesterday I presented Thin at DemoCampCUSEC. Things went pretty well and the other presentations were very good too.

My demo was basically re-coding a simplified version of Thin live, here’s the final result:

%w(rubygems eventmachine thin thin_parser rack).each { |f| require f }

class Connection < EventMachine::Connection  
  attr_accessor :app
  def initialize
    @parser =
    @data = ''
    @nparsed = 0
    @env = {}
  def receive_data(data)
    @data << data
    @nparsed = @parser.execute(@env, @data, @nparsed)
    process if @parser.finished?

  def process
    status, headers, body =
    body_output = ''
    body.each { |l| body_output << l }
    send_data "HTTP/1.1 #{status} OK\r\n" +
              headers.inject('') { |h, (k,v)| h += "#k: #v\r\n" } +
              "\r\n" +

welcome_app = proc do |env|
    200,                                  # Status
    {'Content-Type' => 'text/html'},      # Headers
      '<p>Welcome to my server!</p>',            # Body
      '<p><a href="/rails">My Rails app!</a></p>',

rails_app = => '/Users/marc/projects/refactormycode', :prefix => '/rails')

app ='/' => welcome_app, '/rails' => rails_app) do
  EventMachine.start_server '', 3000, Connection do |con| = app

Hope you enjoyed it!


Filed under conference, montreal, ruby, thin

Thin : A Followup!

Thin was launched a week ago and it instantly became a huge success in the Ruby community!

  • Someone created the #thin IRC channel on freenode where around 7-10 ppl hang around
  • Lots of people are active on the Google Group, asking questions and submitting patches (more then 50 members already!)
  • Thin was featured on Ruby Inside blog
  • and on the Rails Envy podcast in which Jason and Gregg are having a hard time saying my name
  • Joao Pedrosa switched to Thin on his blog
  • Daniel Fisher had a great review
  • Mat, Heri and Carl said some very nice words about it too
  • Thin support was added to Ramaze and Vintage frameworks (Kevin William also submitted a patch to Merb but has not been accepted yet)
  • A couple of days ago, the LOLCAT release of Thin fixed a couple of bugs and introduced Ruby 1.9 support under which Thin is even faster!

Also Julie Hache, asked me to present Thin at the upcoming DemoCampCUSEC2 and I accepted with pleasure! See you there!


Filed under ruby

Thin – A fast and simple web server

ThinThin is a web server that glues together 3 of the best Ruby libraries in web history:

  • the Mongrel parser: the root of Mongrel speed and security
  • Event Machine: a network I/O library with extremely high scalability, performance and stability
  • Rack: a minimal interface between web servers and Ruby frameworks

Which makes it, with all humble humility, the most secure, stable, fast and extensible Ruby web server ever built, bundled in an easy to use gem for your own pleasure.

Why another web server ?

Thin started as an experiment to build an 100% Ruby singled threaded server which ended up being as fast as Mongrel on some cases (like handling Rails request). But that was not enough. Using the EventMachine library the performance and stability are now more impressive then a 500 pounds guy standing on one hand and juggling with the other.

It’s less then 500 lines of clean and fully tested Ruby code plus the customized Mongrel parser (written in C).

Faster then Mongrel ? Yeah right !

Yes it is! It’s even faster then the patched version of Mongrel that uses EventMachine (aka Evented Mongrel).
Request / seconds comparison

Try it

sudo gem install thin

Then in your Rails application directory:

thin start

You can also use it with any framework that support Rack. More info on the usage page.

More alpha then the Greek letter

This is the first experimental release. If you use this on your production server right now you are stupid, looking for extreme sensations or trying to find a way to get fired.

If you’d like to help, have fun or report a bug, join me in the project Google Group and get the code:

git clone

Stay tuned for updates and releases!

If you care, Digg it or Reddit it !


Filed under ruby

Has Zed jumped the shark ?

Zed ShawZed Shaw, the creator of Mongrel, is writing some pretty nasty stuff about the Rails community, ThoughWorks and Ruby.

There’s no work for a smart man in a town full of stupid.

Although I agree there might be some stupid people working with Rails right now, there’s a huge number of very bright people too. And there’s stupid people working with PHP, Java, Python, C, Haskell, Erlang, Lua and Factor too.

The thing is: Rails is getting easier to use every day, lowering the barrier of entry for new coders. The Rails community is growing beginner level coders a lot faster then expert coders now. A year ago, it was probably the opposite. Alpha geeks like being credited for doing hard stuff, solving impossible puzzle, and making code run faster then you could think possible. But Rails is so standardized now, there’s little place for innovation. So new coders to make a name in that community by changing the game again. It was easy before, nothing was there, everything was to be done!

Congratulations because all the idiots who paid ThoughtWorks 6x times salary for junior ass wipes got taken and simply paid to train ThoughtWorks’ new crew

And maybe ThoughWorks is taking advantage of Rails popularity, but it will happen for other cool framework/language too if they get some day to that level of popularity. There’s no reason to shit on the Rails community for this.

After revitalizing myself, getting out of the Rails business (or trying), distancing myself from Mongrel, disconnecting from the Ruby community

Is this the end of Mongrel ?

Zed rant was pretty excessive and even though he claims that everything he writes on his blog is an act, I’m sure he’ll regret this as this will get quoted out of that so-called humorous context.

Strange way to start the new year!

What’s your thoughts on this ?


Filed under rails, ruby