Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Scaling, Tuning and Maintaining the Monolith

Scaling, Tuning and Maintaining the Monolith

Scaling, Tuning and Maintaining the Monolith

Avatar for Ross McFadyen

Ross McFadyen

January 25, 2017

Other Decks in Programming

Transcript

  1. About the Speaker Ross McFadyen Technical Lead and Solution Architect

    at Digirati Previously worked for CitNow and was responsible for Database infrastructure @elrossco22
  2. So who actually uses MySQL at scale • Twitter -

    main datastore for tweets (500+ million per day before moving away from MySQL) • Facebook – (13 Million queries per second, 3.5 million rows changed per second)
  3. Why scaling is more important than ever Twitter 2007 –

    5000 tweets per day 2008 – 300,000 tweets per day 2009 – 250,0000 tweets per day 2010 - 35,000,000 tweets per day 2011 – 200,000,000 tweets per day 2012 - 500,000,000 tweets per day Facebook 2004 – 1 Million monthly users 2005 – 6 Million monthly users 2006 - 12 Million monthly users 2007 – 58 Million monthly users 2008 – 145 Million monthly users 2009 – 360 Million monthly users 2010 – 608 Million monthly users 2011 – 845 Million monthly users 2012 – 1,056 Million monthly users 2013 – 1,230 Million monthly users
  4. Identifying performance problems So we have an application and it

    runs pretty well and then suddenly we find ourselves with performance issues because we’ve grown our workload and userbase
  5. Maintaining MySQL More and more often the role of “developer”

    or “engineer” encompasses the tasks for scaling and keeping the service running.
  6. Complex tasks made simple Example: Database Migrations As our database

    grows tasks become more complex as they take longer to perform Scenario: As part of our previous optimizations efforts we’d like to add a new INDEX/KEY to one of our tables Problem: We have 10 million rows and adding the INDEX will cause a full table lock for an unforeseeable amount of time
  7. Online Schema Changes 1.) create a new table with the

    same structure plus your new index 2.) create a trigger to migrate hot data (new records to your new table) 3.) Insert select from old table to new table 4.) switch the names of the tables (our new table becomes our production table Or
  8. pt-align pt-archiver pt-config-diff pt-deadlock-logger pt-diskstats pt-duplicate-key-checker pt-fifo-split pt-find pt-fingerprint pt-fk-error-logger

    pt-heartbeat pt-index-usage pt-ioprofile pt-kill pt-mext pt-mysql-summary pt-online-schema-change pt-pmp pt-query-digest pt-show-grants pt-sift pt-slave-delay pt-slave-find pt-slave-restart pt-stalk pt-summary pt-table-checksum pt-table-sync pt-table-usage pt-upgrade pt-variable-advisor pt-visual-explain Percona Toolkit