- ホーム
- > 洋書
- > 英文書
- > Computer / Languages
Full Description
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 youBuild 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
Contents
Foreword xiii Preface xvAcknowledgments xixAbout the Author xxiChapter 1: Implementing and Consuming Your First Service 1What's a Service? 1Service Requirements 2The Ruby Tool Set 2The User Service Implementation 5Implementing the Client Library 18Putting It All Together 26Conclusion 26Chapter 2: An Introduction to Service-Oriented Design 27Use of Service-Oriented Design in the Wild 27Service-Oriented Design Versus Service-Oriented Architecture VersusRESTful-Oriented Architecture 28Making the Case for Service-Oriented Design 29Conclusion 38Chapter 3: Case Study: Social Feed Reader 41A Typical Rails Application 41The Rails Social Feed Reader Application 45Converting to Services 54Conclusion 58Chapter 4: Service and API Design 59Partitioning Functionality into Separate Services 59Versioning Services 64URIs and Interface Design 66Successful Responses 68Error Responses 72Handling Joins 73API Complexity 75Conclusion 78Chapter 5: Implementing Services 79The Vote Service 79Models 86Rails 88Sinatra 95Rack 100Conclusion 106Chapter 6: Connecting to Services 107Blocking I/O, Threading, and Parallelism 107Typhoeus 109Multi-threaded Requests 113JRuby 115Logging for Performance 117Handling Error Conditions 118Testing and Mocking Service Calls 119Requests in Development Environments 121Conclusion 121Chapter 7: Developing Service Client Libraries 123Packaging 123Parsing Logic 127ActiveModel 132Connection and Request Logic 136Mocks, Stubs, and Tests 143Conclusion 146Chapter 8: Load Balancing and Caching 147Latency and Throughput 147Load Balancing 148Caching with Memcached 155HTTP Caching 162Conclusion 166Chapter 9: Parsing XML for Legacy Services 167XML 167SOAP 177Conclusion 184Chapter 10: Security 185Authentication 185Authorization 201Encryption 209Conclusion 214Chapter 11: Messaging 215What Is Messaging? 215RabbitMQ and AMQP 217Synchronous Reads, Asynchronous Writes 227The CAP Theorem 230Data Is the API 234Conclusion 236Chapter 12: Web Hooks and External Services 237Web Hooks 238OAuth 245Integrating with External Services 251Ensuring Performance and Reliability 258Conclusion 261Appendix: RESTful Primer 263Roy Fielding's REST 263REST and Resources 265HTTP and the Uniform Interface 268Conclusion 275Index 277