Tuesday, September 25, 2007

RESTful Web Services Book Review

Have you ever picked up a book on the assumption that you were going to need it, only to find out that a) it’s a great book and b) you’re not going to need it? This is just what happened to me with Leonard Richardson and Sam Ruby’s RESTful Web Services.

I really liked Leonard’s Ruby Cookbook (shoot I even did an interview with Leonard about it), so when I was looking at doing some Web Services stuff I leaped at the chance to pick up the book. Sadly, I didn’t end up working on the web services stuff so I lent the book out to some co-workers.

They loved it. It’s been passed from one member of the web services team to another, I even think the team’s manager has spent some time with it. It’s easy to see why they like it:

  • Richardson and Ruby write clearly and well
  • the book has a ton of examples (a lot of them in Ruby)
  • there’s a lot of good advice throughout the text
  • the coverage of REST and Ajax is timely and solid

Probably the best thing about the book though, is it’s solid core (Chapters 4-9, and especially 4-6). Chapter 4 describes Resource-Oriented Architectures (ROA) as a model for REST implementations. Chapter 5 is guide to designing a read-only ROA. Chapter 6 is a guide to designing a read-write ROA. I also liked chapter 8 (REST and ROA Best Practices).

If you’re planning on building RESTful web services, this book is a great place to start. Even if you’re not, it’s a pretty good book to learn more about them.

Practical JRuby on Rails, Hot Off The Press

Ola’s new book, Practical JRuby on Rails, is out sooner than I expected. I’m not going to write a review of it since I was a technical reviewer, but let me recommend it to you. This is the first book out there about JRuby, it’s got great coverage of integrating Ruby and Java in enterprise settings, and it’s by one of the core JRuby developers. What more could you ask for?

It’s too early for other reviews to be out there yet, but I think it’s a winner.

Wednesday, September 05, 2007

Book Review: Practical Ruby for System Administration

Apress has been putting out a number of solid Ruby books of late, and Practical Ruby for System Administration by André Ben Hamou is one of two great additions to their catalog.

André has a easy to read writing style, and covers a lot of ground in this book. The book contains a number of good examples, and would make a great book for a sys admin who’s looking into Ruby.

The most important chapter is probably the third, ‘A Practical Look at Performance’. It covers both determining whether Ruby is performant enough for systems administration tasks and analyzing and optimizing your Ruby code. Other chapters of particular note are the ninth, ‘Network Monitoring’, and the twelfth, ‘The Future of Ruby’. (Although I wish André had covered rubinius as well as YARV and JRuby in his coverage of execution environments.)

This book won’t replace The Pick-Axe as the go-to reference for a Rubyist, but it certainly belongs on the desk of your favorite sys admin (even if that’s yourself).

Wednesday, August 29, 2007

Happy (Belated) Birthday Ruport

I need to wish the Ruport project a belated “happy birthday”. I turns out that they turned two yesterday, Gregory Brown made the announcement on the ruby-talk list:

Just a quick bit of trivia:

Two years ago today, Ruport 0.1.0 was released on RubyForge.

He also mentioned that they’d be making the 41st public release of Ruport to celebrate. This isn’t just a ‘birthday release’ without any added value though. It’s a full on 1.2 release loaded with goodies for the discriminating Ruport user, and a few incompatibilities with the 1.0 version. Some of the major enhancements include:
  • Table#sort_rows_by now allows nil objects and allows ascending / descending order
  • Table constructors now accept :filters and :transforms Procs
  • AAR’s report_table() now accept :filters and :transforms Procs
  • Grouping constructor accepts :order, and new Grouping#sort_grouping_by method
  • Formatter::PDF#draw_table now exposes column heading formatting options
  • Renderers can now be passed :file => “somefile.txt” to save output
There are some flat-out new features as well:
  • Data::Feeder allows for custom transformations and filters on data
  • Grouping#sigma added (Thanks Dave Nelson)
  • Formatter::PDF#draw_text! will draw text at an absolute position, ignoring margins
  • Formatter::Template provides a simple templating system for renderer options

Congratulations to the whole Ruport team on a good looking 1.2, and on 2 great years. I wish them many happy returns.

Monday, August 27, 2007

JRuby 1.0.1 - Real World Performance

The other day, Thomas Enebo and the JRuby gang cut a 1.0.1 release of JRuby and I finally got around to benchmarking it against my LogWatchR app. I used the same data set and Ruby versions as previously (I need to upgrade my 1.9.0 install to see how that work's been going, but it won't happen today). (You can see the previous version of this benchmark here.)

This time around, JRuby showed significant performance improvements. (Oddly, the 1.8 and 1.9 benchmarks looked better too, I don't know if that's from a small code change or just that my system is running a little bit lighter these days.) My stock Ruby install ran the tests in an average of 9.294 seconds (+/- .41 seconds). My 1.9 install run them in 9.394 seconds (+/- .11). The JRuby results are a bit more involved:

  • no flags
    14.754 sec (+/- .26)
  • jruby -J-Djruby.jit.threshold=0 -J-server -O logwatcher.rb
    19.370 sec (+/- .31)
  • jruby -J-Djruby.jit.threshold=0 -O logwatcher.rb
    13.226 sec (+/- .30)
  • jruby -J-Djruby.jit.threshold=1 -O logwatcher.rb
    13.256 sec (+/- .25)

All this means that JRuby is now 142-159% as slow as the installed version of Ruby for LogWatchR. That's a pretty big improvement over the 223-278% it was at the last time I ran the tests. Not bad for a test that Charles Nutter told me didn't have many performance fixes in it. I can't wait to see what happens when the JRuby guys actually start to work on performance.

rubinius is still not up to running LogWatchR, but it looks like the 0.10 version (expected in October) will be the release I get to start using. In the meantime, rubinius performance is starting to look pretty good too.

If you enjoyed this article on profiling, you might also want to look at these: