SPECIAL OFFERS
Keep up with new releases and promotions. Sign up to hear from us.
Rough Cuts are manuscripts that are developed but not yet published, available through Safari. Rough Cuts provide you access to the very latest information on a given topic and offer you the opportunity to interact with the author to influence the final publication.
This is a working draft of a pre-release book. It is available before the published date as part of the Rough Cuts service.
“A must have title for the well-rounded Ruby programmer building advanced Rails applications and large systems!”OBIE FERNANDEZ, Series Editor
Complete, Hands-On Guide to Building Advanced Distributed Applications with Ruby
Distributed programming techniques make applications easier to scale, develop, and deploy—especially in emerging cloud computing environments. Now, one of the Ruby community’s leading experts has written the first definitive guide to distributed programming with Ruby.
Mark Bates begins with a simple distributed application, and then walks through an increasingly complex series of examples, demonstrating solutions to the most common distributed programming problems.
Bates presents the industry’s most useful coverage of Ruby’s standard distributed programming libraries, DRb and Rinda. Next, he introduces powerful third-party tools, frameworks, and libraries designed to simplify Ruby distributed programming, including his own Distribunaut.
If you’re an experienced Ruby programmer or architect, this hands-on tutorial and practical reference will help you meet any distributed programming challenge, no matter how complex.
Coverage includes
• Writing robust, secure, and interactive applications using DRb—and managing its drawbacks
• Using Rinda to build applications with improved flexibility, fault tolerance, and service discovery
• Simplifying DRb service management with RingyDingy
• Utilizing Starfish to facilitate communication between distributed programs and to write MapReduce functions for processing
large data sets
• Using Politics to customize the processes running on individual server instances in a cloud computing environment
• Providing reliable distributed queuing with the low-overhead Starling messaging server
• Implementing comprehensive enterprise messaging with RabbitMQ and Advanced Message Queuing Protocol (AMQP)
• Offloading heavyweight tasks with BackgrounDRb and DelayedJob
Foreword ix
Preface xi
Part I Standard Library 1
Chapter 1 Distributed Ruby (DRb) 3
Hello World 4
Proprietary Ruby Objects 10
Security 17
Access Control Lists (ACLs) 18
DRb over SSL 21
ID Conversion 28
Built-in ID Converters 29
Building Your Own ID Converter 33
Using Multiple ID Converters 34
Conclusion 35
Endnotes 36
Chapter 2 Rinda 37
“Hello World” the Rinda Way 38
Understanding Tuples and TupleSpaces 44
Writing a Tuple to a TupleSpace 44
Reading a Tuple from a TupleSpace 45
Taking a Tuple from a TupleSpace 48
Reading All Tuples in a TupleSpace 52
Callbacks and Observers 53
Understanding Callbacks 54
Implementing Callbacks 55
Security with Rinda 59
Access Control Lists (ACLs) 59
Using Rinda over SSL 61
Selecting a RingServer 63
Renewing Rinda Services 70
Using a Numeric to Renew a Service 71
Using nil to Renew a Service 72
Using the SimpleRenewer Class 72
Custom Renewers 73
Conclusion 75
Endnotes 76
Part II Third-Party Frameworks and Libraries 77
Chapter 3 RingyDingy 79
Installation 79
Getting Started with RingyDingy 80
“Hello World” the RingyDingy Way 81
Building a Distributed Logger with RingyDingy 82
Letting RingyDingy Shine 84
Conclusion 86
Chapter 4 Starfish 87