Moshe Kaplan  Database2011, Jan 13 [email_address] http://blogs.microsoft.co.il/blogs/vprnd http://top-performance.blogspot.com
Presentation Objectives Who is using MySQL? MySQL Limitations How to get over this? Sharding Case Studies Products
Who is Using MySQL?
MySQL Limitations 50-100M Records/Table 50 SELECT Statements/Second
700 Inserts/Sec In Memory Engine 3000 Inserts/Sec InnoDB Engine 700 Inserts/Sec Amazon AWS Standard Large Instance
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
100K New Users/Week
The Network Effect
What Should I Do? Oracle SQL Server $$$
Sharding
Vertical Sharding
Horizontal Sharding Static Hashing Complex growth Simple Mod 10 = 0 Mod 10 = 1 Mod 10 = 2 Mod 10 = 3 Mod 10 = 4 Mod 10 = 5 Mod 10 = 6 Mod 10 = 7 Mod 10 = 8 Mod 10 = 9
Key locations are defined in a directory Simple growth Directory is SPOF Horizontal Sharding
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
Limitations: Reporting
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
‘ s Path to Sharding Single Server Single Master with Multiple Read Slaves Partitioned Sharding
‘ s Path Master-Master replication Each Shard is 50% loaded 40K queries/second
Ad Network Reference Architecture
Sharding Management http://dev.mysql.com/tech-resources/articles/mysql_5.0_psea1.html Storage Engine MySQL Proxy
Grizzard http://readwriteweb.com.br/search/scala-framework/
ScaleBase
The Bottom Line: Grow ∞
Startup your Engines  Thank you Moshe Kaplan: mokplan@gmail.com http://top-performance.blogspot.com

Database2011 MySQL Sharding

Editor's Notes

  • #7 The world is changing more and more fast You have to minimize NRE You must support unexpected demand You must provide top service (people now leaves cell operator after single incident, rather then 5, 10 years ago Firms a vulnerable – Citi worth 20Bill $ instead of 200 Bill a year ago Break and Mortar bookstores 15 years ago and Amazon…. Will it happen again to banks, insurance, real estate agencies… IS YOUR MARKET THE NEXT FOR PENETRATION – Finance? Real Estate? How to win a rival that is not existing yet? http://www.johnmwillis.com/ibm/cloud-computing-and-the-enterprise/ -
  • #17 Sharded database – OLTP Little/No reporting OLAP – must be implemented for reporting Loads data from sharded DBs Custom mechanism Any commercial
  • #26 Start with nothing: storage, FW, LB, Server and grow… Can buy servers for more than hour