logo资料库

Web Scalability for Startup Engineers.pdf

第1页 / 共464页
第2页 / 共464页
第3页 / 共464页
第4页 / 共464页
第5页 / 共464页
第6页 / 共464页
第7页 / 共464页
第8页 / 共464页
资料共464页,剩余部分请下载后查看
Title Page
Copyright Page
About the Author
Dedication
Contents at a Glance
Contents
Acknowledgments
Introduction
Chapter 1 Core Concepts
What Is Scalability?
Evolution from a Single Server to a Global Audience
Single-Server Configuration
Making the Server Stronger: Scaling Vertically
Isolation of Services
Content Delivery Network: Scalability for Static Content
Distributing the Traffic: Horizontal Scalability
Scalability for a Global Audience
Overview of a Data Center Infrastructure
The Front Line
Web Application Layer
Web Services Layer
Additional Components
Data Persistence Layer
Data Center Infrastructure
Overview of the Application Architecture
Front End
Web Services
Supporting Technologies
Summary
Chapter 2 Principles of Good Software Design
Simplicity
Hide Complexity and Build Abstractions
Avoid Overengineering
Try Test-Driven Development
Learn from Models of Simplicity in Software Design
Loose Coupling
Promoting Loose Coupling
Avoiding Unnecessary Coupling
Models of Loose Coupling
Don’t Repeat Yourself (DRY)
Copy and Paste Programming
Coding to Contract
Draw Diagrams
Use Case Diagrams
Class Diagrams
Module Diagrams
Single Responsibility
Promoting Single Responsibility
Examples of Single Responsibility
Open-Closed Principle
Dependency Injection
Inversion of Control (IOC)
Designing for Scale
Adding More Clones
Functional Partitioning
Data Partitioning
Design for Self-Healing
Summary
Chapter 3 Building the Front-End Layer
Managing State
Managing HTTP Sessions
Managing Files
Managing Other Types of State
Components of the Scalable Front End
DNS
Load Balancers
Web Servers
Caching
Auto-Scaling
Deployment Examples
AWS Scenario
Private Data Center
Summary
Chapter 4 Web Services
Designing Web Services
Web Services as an Alternative Presentation Layer
API-First Approach
Pragmatic Approach
Types of Web Services
Function-Centric Services
Resource-Centric Services
Scaling REST Web Services
Keeping Service Machines Stateless
Caching Service Responses
Functional Partitioning
Summary
Chapter 5 Data Layer
Scaling with MySQL
Replication
Data Partitioning (Sharding)
Scaling with NoSQL
The Rise of Eventual Consistency
Faster Recovery to Increase Availability
Cassandra Topology
Summary
Chapter 6 Caching
Cache Hit Ratio
Caching Based on HTTP
HTTP Caching Headers
Types of HTTP Cache Technologies
Scaling HTTP Caches
Caching Application Objects
Common Types of Object Caches
Scaling Object Caches
Caching Rules of Thumb
Cache High Up the Call Stack
Reuse Cache Among Users
Where to Start Caching?
Cache Invalidation Is Difficult
Summary
Chapter 7 Asynchronous Processing
Core Concepts
Synchronous Example
Asynchronous Example
Shopping Analogy
Message Queues
Message Producers
Message Broker
Message Consumers
Messaging Protocols
Messaging Infrastructure
Benefits of Message Queues
Enabling Asynchronous Processing
Easier Scalability
Evening Out Traffic Spikes
Isolating Failures and Self-Healing
Decoupling
Message Queue–Related Challenges
No Message Ordering
Message Requeueing
Race Conditions Become More Likely
Risk of Increased Complexity
Message Queue–Related Anti-Patterns
Treating the Message Queue as a TCP Socket
Treating Message Queue as a Database
Coupling Message Producers with Consumers
Lack of Poison Message Handling
Quick Comparison of Selected Messaging Platforms
Amazon Simple Queue Service
RabbitMQ
ActiveMQ
Final Comparison Notes
Introduction to Event-Driven Architecture
Request/Response Interaction
Direct Worker Queue Interaction
Event-Based Interaction
Summary
Chapter 8 Searching for Data
Introduction to Indexing
Modeling Data
NoSQL Data Modeling
Wide Column Storage Example
Search Engines
Introduction to Search Engines
Using a Dedicated Search Engine
Summary
Chapter 9 Other Dimensions of Scalability
Scaling Productivity through Automation
Testing
Build and Deployment
Monitoring and Alerting
Log Aggregation
Scaling Yourself
Overtime Is Not a Way to Scale
Managing Yourself
Scaling Agile Teams
Adding More People
Procedures and Innovation
Culture of Alignment
Summary
Appendix References
Books
White Papers
Talks
Links
Index
About the Author Artur Ejsmont is a passionate software engineer and agile leader, currently working for Yahoo! in Sydney. Artur has been working with web applications for over 10 years with a lot of focus on agile, startup-like environments; he loves the Lean Startup model. Artur has worked on websites serving 1M+ pages per hour, both in Europe and Australia. He has also served as a university lecturer and is passionate about sharing his knowledge with others. Artur actively contributes to the tech community as a technical writer, blogger, and public speaker. About the Technical Editors Bill Wilder is CTO at Finomial Corporation, an occasional conference speaker, an inconsistent blogger, and leader (since 2009) of Boston Azure. He is recognized by Microsoft as an Azure MVP and is the author of the book Cloud Architecture Patterns (O’Reilly Media, 2012). He can be found on Twitter @codingoutloud. TJ Wilder is a college student in his junior year at the University of Massachusetts at Amherst, majoring in computer science with a minor in mathematics. He has been programming since he was 12 but has taken occasional breaks since then to eat, sleep, and sing. Having interned at DraftKings.com when it was a startup, he looks forward to putting the book’s advice to work in more startups in the future. Dr. Danny Coward is a chief architect and web architect at Oracle. Coward is the sole spec lead for the Java API for Web Sockets for Java EE and Java SE/JavaFX and sole author of the WebSocket technical documentation at Oracle. Coward’s work leading WebSocket at Oracle make him the leading expert on Java WebSocket programming. Coward has a decade of experience as a Java developer, where he now seeks to direct and simplify complex technologies to fulfill business objectives. Coward has specialized experience in all aspects of Java software—from Java ME to Java EE to the founding of the JavaFX technology.
Copyright © 2015 by McGraw-Hill Education. All rights reserved. Except as permitted under the United States Copyright Act of 1976, no part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior written permission of the publisher, with the exception that the program listings may be entered, stored, and executed in a computer system, but they may not be reproduced for publication. ISBN: 978-0-07-184366-9 MHID: 0-07-184366-3 The material in this eBook also appears in the print version of this title: ISBN: 978-0-07- 184365-2, MHID: 0-07-184365-5. eBook conversion by codeMantra Version 1.0 All trademarks are trademarks of their respective owners. Rather than put a trademark symbol after every occurrence of a trademarked name, we use names in an editorial fashion only, and to the benefit of the trademark owner, with no intention of infringement of the trademark. Where such designations appear in this book, they have been printed with initial caps. McGraw-Hill Education eBooks are available at special quantity discounts to use as premiums and sales promotions or for use in corporate training programs. To contact a representative, please visit the Contact Us page at www.mhprofessional.com. Information has been obtained by McGraw-Hill Education from sources believed to be reliable. However, because of the possibility of human or mechanical error by our sources, McGraw-Hill Education, or others, McGraw-Hill Education does not guarantee the accuracy, adequacy, or completeness of any information and is not responsible for any errors or omissions or the results obtained from the use of such information. TERMS OF USE This is a copyrighted work and McGraw-Hill Education and its licensors reserve all rights in and to the work. Use of this work is subject to these terms. Except as permitted under the Copyright Act of 1976 and the right to store and retrieve one copy of the work, you may not decompile, disassemble, reverse engineer, reproduce, modify, create derivative works based upon, transmit, distribute, disseminate, sell, publish or sublicense the work or any part of it without McGraw-Hill Education’s prior consent. You may use the work for your own noncommercial and personal use; any other use of the work is strictly prohibited. Your right to use the work may be terminated if you fail to comply with these terms. THE WORK IS PROVIDED “AS IS.” McGRAW-HILL EDUCATION AND ITS LICENSORS MAKE NO GUARANTEES OR WARRANTIES AS TO THE ACCURACY, ADEQUACY OR COMPLETENESS OF OR RESULTS TO BE OBTAINED FROM USING THE WORK, INCLUDING ANY INFORMATION THAT CAN BE ACCESSED THROUGH THE WORK VIA HYPERLINK OR OTHERWISE, AND EXPRESSLY DISCLAIM ANY WARRANTY, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO IMPLIED WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. McGraw-Hill Education and its licensors do not warrant or guarantee that the functions contained in the work will meet your requirements or that its operation will be uninterrupted or error free. Neither McGraw-Hill Education nor its licensors shall be liable to you or anyone else for any inaccuracy, error or omission, regardless of cause, in the work or for any damages resulting therefrom. McGraw-Hill Education has no responsibility for the content of any information accessed through the work. Under no circumstances shall McGraw-Hill Education and/or its licensors be liable for any indirect, incidental, special, punitive, consequential or similar damages that result from the use of or inability to use the work, even if any of them has been advised of the possibility of such damages. This limitation of liability shall apply to any claim or cause whatsoever whether such claim or cause arises in contract, tort or otherwise.
I dedicate this book to all of you passionate geeks. The future of mankind is truly in your hands now.
Contents at a Glance Chapter 1Core Concepts Chapter 2Principles of Good Software Design Chapter 3Building the Front-End Layer Chapter 4Web Services Chapter 5Data Layer Chapter 6Caching Chapter 7Asynchronous Processing Chapter 8Searching for Data Chapter 9Other Dimensions of Scalability AppendixReferences Index
分享到:
收藏