BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage Interviews Zed Shaw on Mongrel, Ruby stacks and languages besides Ruby

Zed Shaw on Mongrel, Ruby stacks and languages besides Ruby

Bookmarks
   

1. We are here with Zed Shaw, king of the Internet. Why don't you tell us a little bit about yourself?

Basically I am the guy that wrote Mongrel, and developed it for a bunch of people and then basically that's the only thing that I have done in my entire life. That's all that people care about.

I wrote Mongrel and I worked on a bunch of other open source projects and I do Rails professionally and also writing a book. I have been doing open source for about 10 years and lived all over the place, all over US. I've done just about everything you can imagine.

   

2. Tell us in a nutshell what Mongrel is and what is so special about it?

Mongrel is a web server that helps you run any Ruby web application, not just Rails, lots of different stuff, it's embeddable, it's an API and it's very, very small. It's only about 2500 lines of code.

   

3. Your presentation today dealt with the intersection of open source and business interests. And you have some views on how business should interact with open source projects.

Not so much should, but how it generally works better. And for the most part I tried to tell people that when you are working with open source projects it's not a company, it's a bunch of people doing it as a hobby more or less, even if there is a company fronting it, it's still going to be open source. The majority of my presentation was around how you interact with it, and the fact that you have to deal with a lot more crap and basically about the ways that I hear companies that deal with me especially complain about how they don't get service, and if you give nothing you get nothing, and that's the nutshell for the whole presentation. And then there's also a kind of a general thing that I think a lot of these companies have no sense of humor. There's some funny things out there, especially with my project and other projects and they consider that the wrong thing unprofessional.

   

4. What does it mean to have a sense of humor relating to an open source project?

With my projects it tends to be able to accept some vulgarity. In general it's more just that in a lot of business they expect it to be memo quality, they expect to be something put on the memo and sent it out, and so when they do it open source it's an open fairly straight forward, very uncensored communication channel. In the two types of companies I have seen, there is a company that's using an open source project, they will come in and demand things, because they are used to demanding things from companies that have contracts with, whereas this doesn't work with an open source project. And then from the company that is trying to sell stuff to an open source, I see that they come in and it's really obvious that they are selling, that's the key, and they don't have the sense of soft sell and how to talk to folks, you really just have to be a friend with general people in an open source project. A lot of my presentation was trying to tell people "This is people I've seen trying to use Mongrel and work with Mongrel and how they can do better to help the project and themselves".

   

5. How has Mongrel enabled the Rails community would you say?

I think it's coming from two directions: the first one is that it simplified the deployment, made it so much easier for a lot of folks, and that indirectly caused this cottage industry. Before there were 2 or 3 hosting companies for Rails and now there are 10 or 15. That's partially because Rails became more popular but also because it became simpler to do different types of hosting. You have the hosting and capabilities from Xen, but then the ability to run Mongrel and put a gigantic load balancer in front of it the way some places do, simplified things. On the other side though is that Ruby pushed the limits, Mongrel pushed the limits of Ruby, and I think a lot of my criticism are about the garbage collection, the threads, the array bugs, the supporting of MenTaLguY guy so that he can get his threads faster at working, his work including it, I think a lot of that helped by making Ruby more solid as a server platform. Before people weren't pushing it as hard as it could go and it's just that big push really stabilized a lot of Ruby applications. Still not as stable as I would like, but it really helped a lot, it really pushed it a lot further.

   

6. What is the fast thread fix by MenTaLguY guy?

The fast thread stuff is actually known in [Ruby] 1.8.6 and what it does is the threading before was written using Ruby and arrays and the weird Ruby locking system they have. And what ends up happening is there were these leaks that just came about by the way Array was implemented and there were some patches by Erik Mahurin - if I say his name right - that fixed array but they were fairly invasive. Those patches went in to the 1.9/2.0 stream and on to the 18. MenTaLguY came about and what he did is using Ruby monkey patching and things. Basically he wrote a really nice clean C only version of all the thread locking primitives.

The basic threading is still there, it's just the primitives locking, syncing, queuing, all those things are now done in C and very well controlled. By doing this you basically install the fast read library and then boom all these bugs went away you don't have memory leaks, you don't have problems with stalling for no apparent reason, all this stuff goes away. Which is really interesting because when I first started complaining about this most people told me it didn't exist. It's funny that I say it didn't exist and start pushing and right after that we get a patch for Array which fixes a bunch of things, and then a nice patch for threads that fixes a bunch of things. I think that's one of the things that if there is going to be a lasting impact of Mongrel it will get rid of those bugs because before that, nobody would even believe that there could be these bugs in the Ruby platform. And then after, it's obvious that there are bugs that infect them.

   

7. Is Ruby fast enough for Rails production?

It is, you can basically get down and because of a system like Mongrel you don't have to use Rails only. You can actually branch out and start doing additional things outside Rails. I think it really helped a lot of folks; you've got Ezra doing all this Mongrel uploads using his framework which uses the same gear but doesn't use Rails. He's getting really good upload timings and he can use a few Mongrels to do what used to take tons and tons. It is ready for doing heavy loads and things like that. I don't think it's as good as I would like, I would like it to be much more robust on the other hand, staying up, and management and being able to monitor and control.

But on the other side of speed and performance you can use it, it's pretty fast, and lots of other frameworks once you put the application on the framework, the raw speed goes away too. As an observation, totally not backable, I found that your first version of a lot of your bigger stuff, doesn't matter what framework it is, but the first version of bigger pages and bigger functionality usually only gets one or two requests for a second anyway, so you always have to do some kind of tuning. Nowadays I tell people they can totally go Mongrel, you can go light speed LightHTTP, what was really killing it before were the bugs, the leaks and the bugs and now those are pretty much gone, and much better.

   

8. Is Mongrel part of a coming enterprise Ruby stack?

I don't even know what enterprise Ruby stack is. As far as I can tell it is people saying "We could probably sell this to some folks". I have talked to people and there are two sides: I hear rumors of enterprise Ruby stacks all over the place, various companies, and then I talk to people asking what they think that is and they say "I don't know". The only thing I think of is if there is going to be some kind of coming more supportable framework and stack it's has got to keep a lot of the stuff that made Mongrel successful, the simple deployments, simple setups simple starting, the same way you do development is the same way you deploy. If they break any of that, when I am using Mongrel to do development and then pushing something else to do deployment, I don't think it is going to work very well.

I also think that if anyone does anything like that, they pretty much have to give it away and do the support contracts. It's just the trend. You can't really sell web servers anymore. The only people that seam to sell web servers though, which is interesting, are on the Java and .Net side people who sell entire stacks. What I think they are trying to do is build a stack which is all these services written in Ruby, queuing and data store and session management, all these things, and sell that. It would be interesting to see if they come out and do that.

The thing I think would be interesting is if they keep it all Ruby, which I don't think is going to work, for various reasons I don't think Ruby can do all those things very well, or worse they go multi language like we have talked about the RabbitMQ using that for your queuing, various other techniques that's written in Erlang and it is very small too, I was checking it out and it's tiny and really slick. If you did something where if you want to do it now and you did Mongrel, RabbitMQ and a nice UI on top of that, it will be pretty much 90% of what you are getting from the WebSphere and these other things. And with those two combos you can do some nice session management, you can solve concurrency and start up, all that stuff.

   

9. Are you intending to profit of Mongrel now that it's successful in a commercial sense?

I don't really think you can, I mean I actually have more fun just putting it out there, even if I may rant about people I say are idiots and morons, they are the most fun part. And also I like the folks that need my help, the people that come to me and ask for help, I am always helping them out. The only thing I can see to make money through Mongrel would be maybe the support contract point of view, but like I said in my presentation it is only 2500 lines of code.

If you really want to productize it and turn it to something to make money on that's a lot of investment. You got to build user interfaces and management tools, things that people expect from corporations. They expect the WebSphere or .Net management framework for this, and I like having something small and tiny. Originally it was pretty bad with Mongrel, it wasn't making any money and most of job offers were getting more retarded and I decided I wasn't going to code for anyone anymore, mostly because of Mongrel. But now it's calmed down, people are using it, there's no pressure from a lot of folks. For me it's a really fun project to work on, and if it came up that there's a way I can balance still helping people out and still making cash out of it, I will totally do it, capitalist - I would go for it.

   

10. You were a programmer for a long time in the Java world, now you are a programmer in the Ruby world, compare and contrast, what are some of the differences?

When I was a programmer in the Java world there was actually easier to get contracts and it was easier to get internal contracts. It was easier for me to work internally for companies building services that really didn't go outside the company. And that was the majority of the Java work that I did. I never worked on any sites for Java that became gigantic external sites. Except for a few university portals and things like that, most of it was internal.

I have always considered that more valuable work, because I worked for the department of correction, the internal services I wrote saved millions and millions of tax paid dollars that were spend somewhere else. If you do a public face and say "You are not saving any money you are only spending it" you are not really able to show if it gives any benefits. Now that I am doing Ruby it's a complete inverse, it's all external stuff, products people want to do and so on. What I find is that the majority of people come at me with an offer, lots are just con men horrible people, they would have some dumb idea they will try to con you into it, they would give me contracts, just heinous contracts, weird contracts trying to take my inventions and make me list things out.

I don't think it's Ruby, but I think it's people smell money, and when people smell money you get con men basically evil bastards try to take you, and lucky for me I have been around the block and I can spot it, but it is also kind of horrid in that I expected when I did Mongrel that I will be able to go work for someone doing something else cool, and instead the only offers I got come from people who have no clue at all.

   

11. For Java people that still haven't made the leap, maybe they are doing web application stuff and they are considering moving on to Ruby, what's some advice you can give them?

First of I would say, moving to Ruby is a really good move, I have been crunching some statistics and doing some stuff and if I run into them, I do a blog post of just tracking trends as far as language adoption, and there is a guy who keeps statistics of message posts to the various comp.lang Usenet groups. And Ruby went up and then about 3 years ago dropped significantly. I think its peak was 48.000 messages that year and then when it dropped it's down to 18.000.

There's a serious drop and the thing I noticed is that it's a shift, it's not necessarily the other languages are increasing, it's almost as if those programmers that were doing Java have actually shifted down to Python, Ruby and PHP. I'm telling people that right now Java is turning into the new COBOL. If you are good at it, you got a good entrenched job and you can continue doing it, then you should keep doing it. If you go into Ruby, then there's a lot of work out there for Ruby, most of it that I see is being pitched to consulting firms. And the firms are picking up the Ruby work.

There are tones of work for it, it's possible for people to learn it. I would right now if I had a friend who is doing Java I would say "You got to go learn Ruby or Python and go pick those two, like pick up Rails or Django or any other Python frameworks, and go branch out and start learning those just because the trend is going away from Java for new development, and it's a good career move". Even of you never moved out of Java and you are able to stay where you are at, it's just a good career move, it's a good safety net.

   

12. To wrap it up, you are a programming language enthusiast I would say. What's the next language for you after Ruby?

I have got a few, I'm constantly tinkering with the languages: so I do Lua every once in a while, and I play with D, which is pretty cool. I'm telling people who are doing C++ to go do D, it's a really slick one, it's like C++ done right, compiles all that good stuff garbage collection. I may go check out Erlang now that there is a book, although it's just the functional Prolog thing, it drives me nuts, but the ideas in Erlang are really tight.

The language I have been playing with a lot and only really for desktop applications, because of the way it is designed is called Factor, but that's mostly kind of an esoteric language it's a modernized Forth so it's got all the stuff you get from LISP and functional programming languages. You got comprehension and list processing, but it's done in a stack language style, you can build really nice DSLs with it, really sweet looking programs, code is very efficient and fun to work in, but the main thing is that in just in three years they cranked out so much stuff.

Very few people manage to produce way more capability than even Ruby has got, full GUI languages, web servers, web frameworks, multi protocols, every kind of compressions, algorithms, in a very small amount of time, very small space and their virtual machine is only 6000 lines of C code which is impressive. They have a multi platform compiles on about 16 platforms and runs in 6 K of C code.

   

13. It is not vendor driven right?

No, a bunch of guys tinkering on it and they hang out in the IRC channel #concatenative and they are like open source guys. You got to have a sick scan so they are a little on the obnoxious side but as you start hang out with them you start contributing, show them that you actually picked that stuff up, they are really good. And the thing that I like the most I would actually love to copy it for Ruby is that they have their version of IRB, an intense, very graphical, very nice, everything is context and you can get documentation, it's almost like in between what you get on a Smalltalk full blown very documented system but it's still the IRB nice capable to fire off a few things and then shut it down.

It is image based, but it's not image based like Smalltalk was. Everything is in files, you can use traditional revision control. But then you build the program you got this nice image and you can load the files off of it, which is nice for a desktop application because what you are distributing then, unless you want to change the Virtual Machine which is rare, is a new image, and people restart their desktop application and you are done, there's no real patch or anything. Servers, I don't know about; I know you do, I know Seaside does, image base server set up but for me that seems kind of strange how you do your restarts how you do your management and a lot of people complain about image based languages and having to share code with lots of other folks. I know the Seaside guys get around that by having a revision control tool in Seaside, in the Smalltalk VM, but for me I like vim, I'm not going to add code in a Smalltalk VM and they have vim integration so it's a good thing.

Nov 15, 2007

BT