280 likes | 507 Views
Database and the Cloud IGT Cloud Computing WG 20/4/2009. moshe.kaplan@rocketier.com http://top-performance.blogspot.com. RockeTier Methodology. RockeTier specializes in analyzing and boosting existing software performance and developing efficient high-load systems with a unique methodology:
E N D
Database and the CloudIGT Cloud Computing WG 20/4/2009 moshe.kaplan@rocketier.com http://top-performance.blogspot.com
RockeTier Methodology RockeTier specializes in analyzing and boosting existing software performance and developing efficient high-load systems with a unique methodology: • Detect • Rate • Immediate Effective Relief • Roadmap • Scale up and Scale out
Assumptions • Cloud Computing Virtualization • Virtualization Low end servers • Very large databases High end servers • Therefore: • Very large databases ≠ Cloud Computing
Presentation Objectives • Who is using MySQL? • MySQL Limitations • How to get over this? • Move to another DB and scale up… • Vertical Sharding • Horizontal Sharding • Sharding test case
MySQL Limitations • Table sizes: 50-100M records per table • Reads: 50 queries/second
Why Do I Care? • From 0 to 100 (US mass adaptation) • Phone: 100 yrs • Radio: 40 yrs • TV: 30 yrs • Mobile: 20 yrs • Internet: 10 yrs • Facebook: 2 yrs
What Should I Do? • Oracle • SQL Server • $$$
Horizontal Sharding Mod 10 = 0 Mod 10 = 1 • Static Hashing • Complex growth • Simple Mod 10 = 2 Mod 10 = 3 Mod 10 = 4 Mod 10 = 5 Mod 10 = 6 Mod 10 = 7 Mod 10 = 8 Mod 10 = 9
Horizontal Sharding • Key locations are defined in a directory • Simple growth • Directory is SPOF
Horizontal Sharding • Static hashing with directory mapping • Simple growth • Small Directory still SPOF Mod 1000 = 4
Horizontal Sharding • Each key signed by DB# generated on creation • Simple growth • New key generation is SPOF
Sharding Management • No mature tools in the market • Hibernate Shards – not recommended • Hibernate… • Beta • Required Mechanisms • Distribution of changes in DB schema
Best Practices • $connection = new_db_connection("customer://1234"); • $statement = $connection->prepare( $sql_statement, $params ); • $result = $statement->execute();
Lessons • Vertical Sharding: • User Actions, Users, Comments, Items • Horizontal Sharding • Denormalization • MySQL Replication
Lessons • Vertical Sharding: • User Actions, Users, Comments, Items • Horizontal Sharding • Denormalization • MySQL Replication
Lessons • 100M views per day • The path to Sharding: • Single server • Single master with multiple read slaves • Partitioned • Sharding
Lessons • Master-Master replication • Each Shard is 50% loaded • 40K queries/second
Startup your Engines Thank you moshe.kaplan@rocketier.com http://top-performance.blogspot.com