Home > Store > Programming > Ruby

larger cover

Add To My Wish List

Service-Oriented Design with Ruby and Rails

Register your product to gain access to bonus material or receive a coupon.

  • Description
  • Reviews
  • Sample Content

Product Author Bios

Paul Dix is author of open source libraries to simplify XML parsing (SAXMachine), feed parsing (Feedzirra), and high performance parallel HTTP processing (HTTPMachine), He writes on these and related topics on his blog at pauldix.net. Dix currently works as senior developer at kgb, where he implements these techniques to create a live search and aggregation system that handles millions of resources. He spoke on Collective Intelligence at Scotland on Rails 2008 and Goruco 2008; and on Document Classification at Goruco 2007.

The Complete Guide to Building Highly Scalable, Services-Based Rails Applications

 

Ruby on Rails deployments are growing, and Rails is increasingly being adopted in larger environments. Today, Rails developers and architects need better ways to interface with legacy systems, move into the cloud, and scale to handle higher volumes and greater complexity. In Service-Oriented Design with Ruby and Rails Paul Dix introduces a powerful, services-based design approach geared toward overcoming all these challenges. Using Dix’s techniques, readers can leverage the full benefits of both Ruby and Rails, while overcoming the difficulties of working with larger codebases and teams.

 

Dix demonstrates how to integrate multiple components within an enterprise application stack; create services that can easily grow and connect; and design systems that are easier to maintain and upgrade. Key concepts are explained with detailed Ruby code built using open source libraries such as ActiveRecord, Sinatra, Nokogiri, and Typhoeus. The book concludes with coverage of security, scaling, messaging, and interfacing with third-party services.


Service-Oriented Design with Ruby and Rails will help you

  • Build highly scalable, Ruby-based service architectures that operate smoothly in the cloud or with legacy systems
  • Scale Rails systems to handle more requests, larger development teams, and more complex code bases
  • Master new best practices for designing and creating services in Ruby
  • Use Ruby to glue together services written in any language
  • Use Ruby libraries to build and consume RESTful Web services
  • Use Ruby JSON parsers to quickly represent resources from HTTP services
  • Write lightweight, well-designed API wrappers around internal or external services
  • Discover powerful non-Rails frameworks that simplify Ruby service implementation
  • Implement standards-based enterprise messaging with Advanced Message Queuing Protocol (AMQP)
  • Optimize performance with load balancing and caching
  • Provide for security and authentication

Customer Reviews

13 of 14 people found the following review helpful
5.0 out of 5 stars Great intro to scalable designs for Ruby programmers, September 11, 2010
By 
Amazon Verified Purchase(What's this?)
I'm a little tired right now to give a thorough review, but I wanted to get something down to benefit other potential buyers. First off, let me give some background on myself so you have a point of reference. I've been programming web software and services as a hobby for the last 10 years. My forte has always been with Perl, with a recent desire to try newer languages like Python and Ruby. My particular interest in this book stems from a new project I'm working on that lends itself to a service-oriented design from the get-go. I have no other experience with Ruby or Rails except for short periods of "play time" with Rails when it first became popular, years ago. But I'm *very* experienced with service-oriented and scalable internet architectures (I work for OmniTI), so I expected much of the book to be a rehash of what I'm exposed to on a daily basis anyways.

The author (Paul Dix) immediately throws the reader into a sample web service, typical to any modern REST web... Read more
Help other customers find the most helpful reviews 
Was this review helpful to you? Yes No


12 of 13 people found the following review helpful
5.0 out of 5 stars Along with Metaprogramming Ruby, a must read for Ruby/Rails devs, September 12, 2010
This review is from: Service-Oriented Design with Ruby and Rails (Addison-Wesley Professional Ruby Series) (Paperback)
I never review books on Amazon. But I wrote a review for Metaprogramming Ruby (Feb 2010 Pragmatic Programmers) because it was just such a must-read. And I'm writing one for this, because it's also a must-read. The target audience for this book is the intermediate Rails developer who has his all-in-one app with background processing, and is wondering "what next"? "What if tomorrow users start joining my site by the droves?" "What if I'm written up on TC / Digg / Slashdotted tomorrow?"

If I HAD to give criticism, the only thing I could think of is that this book goes into implementation details for some subjects but not others. For example, it has pages and pages of code to illustrate how to write a service in rails, Sinatra, Rack, but skips over a lot of ops related stuff. If you were going about implementing the ideas in this book, those issues would confront you far before you write your services, do your load balancing and edge caching, etc. I would love for Dix to write... Read more
Help other customers find the most helpful reviews 
Was this review helpful to you? Yes No


4 of 4 people found the following review helpful
5.0 out of 5 stars The best ruby book I've read in a long time, October 27, 2010
Amazon Verified Purchase(What's this?)
This review is from: Service-Oriented Design with Ruby and Rails (Addison-Wesley Professional Ruby Series) (Paperback)
It's rare that I read a ruby book these days and learn something new in every chapter, but I did from this book. The title doesn't do the book justice. The ruby examples use Rack, Sinatra and Rails (including Rails 3 examples) to demonstrate how to quickly build and test REST services and service clients.

It covers everything from high-level architecture decisions, like when to introduce services and how to decide what goes where, to seemingly small details, like dealing with serving pagination links in apis.

The only downside is that it could have gone into more detail about how to run apps with multiple services locally.

I read it cover to cover, and frequently refer to it. I highly recommend it to anyone working on moderate to large Rails apps. It completely demystified SOA for me.
Help other customers find the most helpful reviews 
Was this review helpful to you? Yes No


Share your thoughts with other customers:
 See all 10 customer reviews...

Online Sample Chapter

An Introduction to Service-Oriented Design with Ruby and Rails

Table of Contents

Foreword         xiii

Preface         xv

Acknowledgments         xix

About the Author         xxi

 

Chapter 1: Implementing and Consuming Your First Service         1

What’s a Service? 1

Service Requirements 2

The Ruby Tool Set 2

The User Service Implementation 5

Implementing the Client Library 18

Putting It All Together 26

Conclusion 26

 

Chapter 2: An Introduction to Service-Oriented Design         27

Use of Service-Oriented Design in the Wild 27

Service-Oriented Design Versus Service-Oriented Architecture Versus

RESTful-Oriented Architecture 28

Making the Case for Service-Oriented Design 29

Conclusion 38

 

Chapter 3: Case Study: Social Feed Reader         41

A Typical Rails Application 41

The Rails Social Feed Reader Application 45

Converting to Services 54

Conclusion 58

 

Chapter 4: Service and API Design          59

Partitioning Functionality into Separate Services 59

Versioning Services 64

URIs and Interface Design 66

Successful Responses 68

Error Responses 72

Handling Joins 73

API Complexity 75

Conclusion 78

 

Chapter 5: Implementing Services         79

The Vote Service 79

Models 86

Rails 88

Sinatra 95

Rack 100

Conclusion 106

 

Chapter 6: Connecting to Services         107

Blocking I/O, Threading, and Parallelism 107

Typhoeus 109

Multi-threaded Requests 113

JRuby 115

Logging for Performance 117

Handling Error Conditions 118

Testing and Mocking Service Calls 119

Requests in Development Environments 121

Conclusion 121

 

Chapter 7: Developing Service Client Libraries         123

Packaging 123

Parsing Logic 127

ActiveModel 132

Connection and Request Logic 136

Mocks, Stubs, and Tests 143

Conclusion 146

 

Chapter 8: Load Balancing and Caching         147

Latency and Throughput 147

Load Balancing 148

Caching with Memcached 155

HTTP Caching 162

Conclusion 166

 

Chapter 9: Parsing XML for Legacy Services         167

XML 167

SOAP 177

Conclusion 184

 

Chapter 10: Security         185

Authentication 185

Authorization 201

Encryption 209

Conclusion 214

 

Chapter 11: Messaging         215

What Is Messaging? 215

RabbitMQ and AMQP 217

Synchronous Reads, Asynchronous Writes 227

The CAP Theorem 230

Data Is the API 234

Conclusion 236

 

Chapter 12: Web Hooks and External Services         237

Web Hooks 238

OAuth 245

Integrating with External Services 251

Ensuring Performance and Reliability 258

Conclusion 261

 

Appendix: RESTful Primer         263

Roy Fielding’s REST 263

REST and Resources 265

HTTP and the Uniform Interface 268

Conclusion 275

 

Index          277

Sample Pages

Download the sample pages (includes Chapter 2 and Index)

 
Best Value

Book + eBook Bundle  $89.98  $53.99

Book Price $39.99
eBook Price $14.00
eBook formats included

Buy

This book includes free shipping!

Buy

Book  $49.99  $39.99

Usually ships in 24 hours.

This book includes free shipping!

Buy

eBook (Watermarked)  $39.99  $31.99

Includes EPUB, MOBI, and PDF
About eBook Formats

This eBook includes the following formats, accessible from your Account page after purchase:

ePubEPUBThe open industry format known for its reflowable content and usability on supported mobile devices.

MOBIMOBIThe eBook format compatible with the Amazon Kindle and Amazon Kindle applications.

Adobe ReaderPDFThe popular standard, used most often with the free Adobe® Reader® software.

This eBook requires no passwords or activation to read. We customize your eBook by discretely watermarking it with your name, making it uniquely yours.

Purchase Reward: One Month Free Subscription
By completing any purchase on InformIT, you become eligible for an unlimited access one-month subscription to Safari Books Online.

Get access to thousands of books and training videos about technology, professional development and digital media from more than 40 leading publishers, including Addison-Wesley, Prentice Hall, Cisco Press, IBM Press, O'Reilly Media, Wrox, Apress, and many more. If you continue your subscription after your 30-day trial, you can receive 30% off a monthly subscription to the Safari Library for up to 12 months. That's a total savings of $199.