Learn from legendary Japanese Ruby hacker Masatoshi Seki in this first English-language book on his own Distributed Ruby library. You’ll find out about distributed computing, advanced Ruby concepts and techniques, and the philosophy of the Ruby way—-straight from the source.
Paperback list price normally $35.00, now on sale for $9.95 while supplies last.
About this Book
- 280 pages
- Release: P1.0 (2012-03-21)
- ISBN: 978-1-93435-693-7
dRuby has been part of the Ruby standard library for more than a decade, yet few know the true power of the gem. Completely written in Ruby, dRuby enables you to communicate between distributed Ruby processes as if there were no boundaries between processes. This is one of the few books that covers distributed and parallel programming for Ruby developers.
The dRuby Book has been completely updated and expanded from its Japanese version, with three new chapters written by Masatoshi-san. You’ll find out about the design concepts of the dRuby library, and walk through step-by-step tutorial examples. By building various distributed applications, you’ll master distributed programming as well as advanced Ruby techniques such as multithreading, object references, garbage collection, and security. Then you’ll graduate to advanced techniques for using dRuby with Masatoshi-san’s other libraries, such as eRuby and Rinda—-the Ruby version of the Linda distributed tuplespace system. In the three new chapters, you’ll see how to integrate dRuby and eRuby, get a thorough grounding in parallel programming concepts with Rinda, and create a full text search system using Drip.
Step by step, you’ll gain mastery of dRuby and distributed computing.
What You Need:
Ruby 1.9.2 or above. All exercises were run on OS X, though it should work on any operating system. You are expected to be comfortable reading Ruby code, as we do not explain basic syntax.
Q&A with author Masatoshi Seki
Q. In a nutshell: what is dRuby?
A. dRuby is a distributed object system. More precisely, it’s a library for Remote Method Invocation (RMI). You can easily publish your objects to others, or call objects in other processes.
Q. How is dRuby different from other distributed object systems? What’s unique about it?
A. The biggest difference is that dRuby is designed for (and written in) Ruby. It is ridiculously easy to start using distributed object systems. dRuby inherits lots of good parts from Ruby. For example, you can use a method with block, and dRuby dynamically chooses how to send a remote object, so you don’t have to describe an interface or its transportation method.
Q. How can dRuby and distributing programming change the way we develop our apps?
A. With the rise of web services, inter-process communication became a popular way to architect systems. You can choose inter-process communication not only for large-scale systems, but also for making small tools. Consequently, we’re facing issues with dealing with inter-process communication more than ever.
With dRuby, you can concentrate on building the core of your system while dRuby takes care of the complex inter-process communication layer. The easier it becomes to write an inter-process communication layer, the more often you will choose an inter-process communication architecture when you design your system.
Q. You’ve written a few other libraries – how do they interact with dRuby and what will we find useful about them?
In my book, I used dRuby as a glue to integrate with various other libraries of mine. For example, I used it with Rinda to turn its inter-thread coordination mechanism into inter-process coordination. I also turned the ERB templating system into a separate server to minimize preprocessing cost.
Many of my libraries have profound thoughts and ideas behind a relatively small number of APIs. It’s hard to grasp the whole picture just by glancing at API references. In this book, I provide various examples for combining these libraries to reveal their full intention and usefulness.
Q. If there’s one thing we should take away from your book, what would that be?
Many of my libraries are small and simple, but with deep philosophy behind them. My goal is for you to understand the thinking behind my libraries and use this understanding to strengthen your design skills.
Contents and Extracts
- Introducing dRuby
- Hello, dRuby
- Architectures of Distributed Systems excerpt
- Understanding dRuby
- Integrating dRuby with eRuby
- Pass by Reference, Pass by Value
- Multithreading excerpt
- Process Coordination
- Coordinating Processes Using Rinda
- Extending Rinda
- Parallel Computing and Persistence with Rinda excerpt (NOTE: use “gem install more_rinda” to try it out)
- Drip: A Stream-Based Storage System
- Building a Simple Search System with Drip
- Running dRuby and Rinda in a Production Environment
- Handling Garbage Collection
- Security in dRuby
Comments and Reviews
—Jesse Rosalia Senior software engineer
A fascinating and informative look at what is classically a total pain in the neck: distributed object management and process coordination on a single machine or across a network.
—Aaron Patterson Ruby and Ruby on Rails core committer
Any programmer wanting to understand concurrency and distributed systems using Ruby should read this book. The explanations and example code make these topics approachable and interesting.
—Kakutani Shintaro RubyKaigi organizer, Ruby no Kai
dRuby naturally extends the simplicity and power Ruby provides. Throughout this book, Rubyists should be able to enjoy a conversation with dRuby that makes you feel as if your own thoughts are traveling across processes and networks.
—Yuki “Yugui” Sonoda Ruby 1.9 release manager
dRuby is the key component that liberates Ruby objects from processes and machine platforms. Masatoshi himself explains its design, features, case studies, and even more in this book.
—Eric Hodel Ruby committer, RDoc and RubyGems maintainer
The dRuby Book is a fantastic introduction to distributed programming in Ruby for all levels of users. The book covers all aspects of dRuby, including the principles of distributed programming and libraries and techniques to make your work easier. I recommend this book for anyone who is interested in distributed programming in Ruby and wants to learn the basics all the way to advanced process coordination strategies.