文档介绍:Best Practices for Scaling Websites
Randy Shoup
eBay Distinguished Architect
QCon Asia 2009
Challenges at Scale
• eBay manages …
– million active users worldwide
– 120 million items for sale in 50,000 categories
– Over 2 billion page views per day
– eBay users trade over $2000 in goods every
second -- $60 billion per year
– eBay site stores over 2 PB of data
– eBay processes 50 TB of new, incremental data
per day
– eBay Data Warehouse analyzes 50 PB per day
• In a dynamic environment
– 300+ features per quarter
– We roll 100,000+ lines of code every two weeks
• In 39 countries, in 8 languages, 24x7x365
>48 Billion SQL executions/day!
© 2009 eBay Inc.
Architectural Forces at Scale
• Scalability
– Resource usage should increase linearly (or better!) with load
– Design for 10x growth in data, traffic, users, etc.
• Availability
– Resilience to failure (MTBF)
– Rapid recoverability from failure (MTTR)
– Graceful degradation
• Latency
– User experience latency
– Data latency
• Manageability
– Simplicity
– Maintainability
– Diagnostics
• Cost
– Development effort plexity
– Operational cost (TCO)
© 2009 eBay Inc.
Best Practices for Scaling
1. Partition Everything
2. Asynchrony Everywhere
3. Automate Everything
4. Remember Everything Fails
5. Embrace Inconsistency
© 2009 eBay Inc.
Best Practice 1: Partition Everything
• Split every problem into manageable chunks
– By data, load, and/or usage pattern
–“If you can’t split it, you can’t scale it”
• Motivations
– Scalability: can scale horizontally and independently
– Availability: can isolate failures
– Manageability: can decouple different segments and functional areas
– Cost: can use less expensive hardware
© 2009 eBay Inc.
Best Practice 1: Partition Everything
Pattern: Functional Segmentation
– Segment processing into pools, services, and stages
– Segment data along usage boundaries
Pattern: Horizontal Spl