The dRuby Book: Distributed and Parallel Computing with Ruby

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

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.

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.

Author(s): Masatoshi Seki
Publisher: Pragmatic Bookshelf
Year: 2012

Language: English
Pages: 280

Cover......Page 1
Table of Contents......Page 6
Foreword......Page 9
For the English Edition......Page 10
Preface......Page 11
Environment......Page 12
What's in This Book......Page 13
Conventions Used in This Book......Page 15
Part I—Introducing dRuby......Page 16
Hello, World......Page 17
Building the Reminder Application......Page 21
Moving Ahead......Page 28
Understanding Distributed Object Systems......Page 29
Design Principles of dRuby......Page 34
dRuby in the Real World......Page 38
Moving Ahead......Page 40
Part II—Understanding dRuby......Page 42
Generating Templates with ERB......Page 43
Integrating WEBrick::CGI and ERB with dRuby......Page 52
Putting Them Together......Page 60
Adding an Error Page......Page 65
Changing Process Allocation......Page 66
Moving Ahead......Page 68
Passing Objects Among Processes......Page 69
Passing by Reference Automatically......Page 79
Handling Unknown Objects with DRbUnknown......Page 84
Moving Ahead......Page 87
dRuby and Multithreading......Page 88
Understanding the Thread Class......Page 90
Thread-Safe Communication Using Locking, Mutex, and MonitorMixin......Page 97
Passing Objects via Queue......Page 115
Moving Ahead......Page 119
Part III—Process Coordination......Page 120
Introducing Linda and Rinda......Page 121
How Rinda Works......Page 123
Basic Distributed Data Structures......Page 134
Toward Applications......Page 144
Moving Ahead......Page 146
Adding a Timeout in a Tuple......Page 147
Adding Notifications for New Events......Page 151
Expressing a Tuple with Hash......Page 154
Removing Tuples Safely with TupleSpaceProxy......Page 156
Finding a Service with Ring......Page 158
Examples of Ring Applications......Page 165
Moving Ahead......Page 173
Computing in Parallel with rinda_eval......Page 174
Concurrency in rinda_eval......Page 176
Persisting a Tuple with PTupleSpace......Page 183
Moving Ahead......Page 188
Introducing Drip......Page 190
Drip Compared to Queue......Page 191
Drip Compared to Hash......Page 196
Browsing Data with Key......Page 199
Design Goals of the API......Page 203
Moving Ahead......Page 204
Running the App......Page 205
Examining Each Component......Page 207
Crawling Interval and Synchronization with Indexer......Page 213
Resetting Data......Page 214
Using RBTree for Range Search......Page 215
Adding a Web UI......Page 221
Moving Ahead......Page 225
Part IV—Running dRuby and Rinda in a Production Environment......Page 226
Dealing with GC......Page 227
Using DRbIdConv to Prevent GC......Page 231
Moving Ahead......Page 233
dRuby's Attitude Toward Security......Page 235
Accessing Remote Services via SSH Port Forwarding......Page 240
Summary......Page 247
Bibliography......Page 248
Index......Page 249