Paul Barry

Do we really need multi-threaded web applications?

April 17, 2008

I’ve given a few presentations on Merb now and had the chance to discuss Merb with several different people. One point people have mentioned is that Rails is single threaded by design, not as a limitation as I’ve sort of implied in the talks I’ve given. Rails being single threaded relieves the developer from thinking about threading issues, which can cause bugs that hard to track down and test for. Sure, this makes it theoretically less efficient than a multi-threaded app, but that may be a small price to pay.

On the other hand, before doing Rails I was doing multi-threaded web applications in Java/J2EE for years and I never ran into threading issues. Most MVC frameworks made it pretty easy to avoid those types of problems and it was easy enough to just make sure that any servlets that I would write wouldn’t use any shared data. Threading issues were something you had to kind in the back of your mind, but I never really had any problems.

So do we need multi-threaded web applications or do the potential complexities introduced by threading outweigh that benefit? And how much resource utilization/performance benefit is there to be gained by making our Ruby web apps multi-threaded?

Posted in Technology | Topics Merb, Ruby, Rails | 2 Comments


April 17, 2008

I gave a talk last night at the NoVaRUG on Merb. I also gave the same talk at B’More on Rails last week. Thank You to everyone who helped organize these meetings and to everyone that attended. Here are my slides from the presentation:


The 16th slide titled “Demo” has a video embed in it that didn’t translate over to SlideShare, so here it is. This video demonstrates using the render_deferred method of Merb to return a Proc to mongrel which releases the lock on the Merb app and allows other requests to be processed by Merb. I added this one in at the last minute, it wasn’t included in the Baltimore talk. I have to give credit and save that this was inspired by George Malamidis’ recent blog post.

UPDATE: The video of this presentation is available here

Posted in Technology | Topics Merb, Ruby | 2 Comments

Acts As Conference - Day 2

February 14, 2008

The sun has set on Acts as Conference 2008. In case you missed it, here are my notes from Day 1. I just have a few quick notes from Day 2.

The morning started off with someone (Taylor?) from Engine Yard with a hosting support Q&A session. One thing he said is you shouldn’t be using ferret, it is not production ready and they get a lot of support issues related to ferret. He suggests using sphinx and ultrasphinx instead. I can comment on that, I haven’t used either myself.

Next was Charles Nutter talking about JRuby. He said that JRuby 1.0 is 2x slower that Ruby 1.8, but the upcoming JRuby 1.1 is 2x faster than Ruby 1.8, and the trunk is 2-5x faster than Ruby 1.8 and often faster than Ruby 1.9. He said that they (the JRuby team) have reached a point where they are going to stop worrying about performance issues because they consider it to be fast enough.

After that was Anthony Eden who gave a talk about the internals of ActiveRecord. One thing that came up in the discussion was the Ruby send method in Ruby 1.9. They have changed it so that if you try to use send to call a private method to an object, that raises a NoMethodError. You can use send! if you really want to call private method. Obviously the Rails core team doesn’t agree with this change, and since Ruby is a dynamic language with open classes, you can override things like that, which they have done in ActiveSupport already.

Next was Bryan Liles’ talk on Behavior Driven Development (BDD). It was a narrative covering Bryan’s journey to BDD. His “air keyboard” livecast style was a big hit. The synopsis of his talk was that testing is hard, you only get good at it through experience, BDD is really the same thing as Test Driven Development (TDD) and RSpec is good but not the be all, end all of testing.

Next up was Dave Naffis and Josh Owens. I have to say they weren’t the most engaging speakers, but the certain did have some really good content. One of the thing that stuck out for me was Juggernaut. Juggernaut is a rails plugin that uses flash to allow you to push data from the server to the client. It sounds like a great tool for certain applications like a chat room or a screen that shows real-time, updating data.

After that was Charles Brian Quinn, or CBQ for short. He is a great speaker, confident, clear, and engaging. His talk was on teaching Rails, which was really good. He does Rails training professionally and I bet he does a great job. One thing I remember from his talk was to avoid using foo and bar in examples, instead use real examples that your audience will understand. I agree with him on this for most cases, but in some situations I think foo and bar can actually useful to represent “you can use anything here”. For example, as you know, ActiveRecord has a class method set_table_name, which allows you to specify something other than the table name that gets used by convention, which is the pluralized version of the class name. In that case, I think it’s perfectly ok to say:

class Person < ActiveRecord::Base
    set_table_name :foo

Last up was Obie Fernandez with the keynote speech. I thought it was a great talk with some really good ideas. First let’s get what I consider to be the only blunder of the talk. He showed the images from Jeff Patton’s “Iterating and incrementing are separate idea”:





I’ll give Patton’s explanation, because I don’t have exactly what Obie said:

By incremental development I mean to incrementally add software a time. Each increment adds more software - sorta like adding bricks to a wall. After lots of increments, you’ve got a big wall.

By iterative development I mean that we build something, then evaluate whether it’ll work for us, then we make changes to it. We build expecting to change it. We never expected it to be right. If it was, it’s a happy accident. Because we don’t expect it to be right, we often build the least we have to to then validate whether it was the right thing to build.

That’s the gist of it. I suggest reading the full article on it, it is very good. I certainly can’t criticize Obie for referencing this great article along with it’s fantastic images, but the problem was that Luke Francl already referenced the same thing the previous day in his speech. Maybe it was because Luke was sitting right next to me, but it seemed like everyone in the room kind of snickered when Obie brought up that slide. It was really bad because he obviously didn’t attend Luke’s talk and had no idea that everyone had already seen that, so he made no comment to that effect.

That really rubbed me the wrong way. This was a conference where there were no concurrent sessions, so you could attend every talk, so there was no excuse for not attending. Maybe Obie had a reason that he couldn’t attend the first day of the conference, but I feel like if you are speaking at the event, you should make an effort to attend the other talks.

Anyway, that aside, I loved Obie’s talk. There were two ideas that stuck out in my mind. First was “Practice makes permanent”, which means if you practice doing the wrong things, like writing code without tests, you are just ingraining bad habits. Second was the idea that no one cares what tools you use to build your application, but we as developers have a tendency to obsess about our tools. I think he was trying to say we should spend less time arguing about Rails vs. Django vs. Merb and more time working on building great applications. I really hope the video of his talk gets put online at some point because I’d like to watch it again. He covered a lot of good ideas about application development that I’d like to go over again. If you have a chance to see him speak, or any of the speakers from this conference for that matter, do yourself a favor and go check it out.

Posted in Technology | Topics Merb, Ruby, Rails

The Web Application Framework Candidates

February 14, 2008

The web application framework race is heating up, so let’s take a moment to meet some of the candidates.


George W. Bush

The current leader in the web application framework space, has a declining approval rating from the general public, but still maintains support from members of the static typing party.


Hillary Clinton

One of the leading candidates from the dynamic typing party. This candidate has experience that proves she can bring change.


Barack Obama

A candidate from the dynamic party who is quickly gaining support, running on his campaign of hope. Has a stance similar to that of Rails on many of the campaign issues.


John Edwards

Another strong dynamic party candidate, but having a hard time stealing the spotlight from the two dynamic party candidates, despite running on a strong platform.


John McCain

The leading candidate for the static typing party, particularly among moderate static typers, but having a hard time gaining support from conservative members of the static party who claim that he is too dynamic on some issues.


Ron Paul

A candidate that appeals to some members of both the dynamic and static typing parties, quickly gaining notoriety on the web for his support of once unconventional ideas like functional programming.