5 things MySql


Published on

5 things you need to know about MySQL if you don't have a DBA. From OSBridge '09.

Published in: Technology
1 Like
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • Not locked into proprietary space… many options. Based from the same code tree Lib mysql vs lib drizzle – licensing gotcha libmysql gpl libdrizz bsd drizzle Maria Our delta Google patches Percona xtradb
  • Google patches include a better malloc And completely changed locking
  • Choose 5.1 or 5.4 only if you need the featuresets.
  • •❑ inno - row with exception •❑ myi - table -- fast in some cases and search cases ( fast inserts? without lock )•❑federated - replication not multiple master. •❑ blackhole handy for logging without inserting into db or skipping a db for fake muliple master
  • Much performance pain come into play with lock contention
  • Much performance pain come into play with lock contention Names changed to protect the innocent
  • Understand MTR and see if you meet that goal. tarball /dump / cpio not a valid backup
  • •❑ tarball /dump / cpio not a valid backup •❑ replication•❑innohot•❑lvm backup script... lvmbackup? •❑ mysqldump = 100% inno ok. single transaction .•❑xtrabackup -- free innohot
  • LVM and slaves give easy opportunities for creating clones for testing
  • Begin with having your application understand that reads and writes are different
  • API SHOULD KNOW THE DIFF proxy as an option if API not possible. scale writes. write own interfaces? check on it. btree index larger than memory -- writes get _slow_ Memcached – good for short lived data and caching wafflegrid -- patches to mysql -- innodb bufferpool over memcached
  • If you’re worried about swapping, use huge page support for mysql (linux doesn’t swap out huge pages
  • •❑ disk•❑memory•❑up/down•❑cachehit -- baseline defiinition•❑replication •❑ mktablesync•❑mkchecksum
  • 5 things MySql

    1. 1. 5 things you need to know about MySQL (if you don’t have a DBA) sarah novotny – [email_address] MySQL and LAMP services www .BlueGecko . net
    2. 2. <ul><li>changing ecosystem </li></ul><ul><li>versions </li></ul><ul><li>storage engines and locking </li></ul><ul><li>backups </li></ul><ul><li>scaling </li></ul><ul><li>free tools </li></ul>www .BlueGecko . net
    3. 3. <ul><li>changing ecosystem </li></ul><ul><li>MySQL -> </li></ul><ul><li>Sun -> </li></ul><ul><li>Oracle </li></ul><ul><li>Monty Program AB </li></ul><ul><li>OpenDB Alliance </li></ul>www .BlueGecko . net
    4. 4. www .BlueGecko . net
    5. 5. <ul><li>versions </li></ul><ul><li>5.0 – stable. (do i need to say more?) </li></ul><ul><li>5.1 – fresh feature set </li></ul><ul><li> – many open bugs </li></ul><ul><li> – partitioning </li></ul><ul><li> – row base replication </li></ul><ul><li> – mysqlslap </li></ul><ul><li>5.4 – 5.1 ++ google patches </li></ul><ul><li> – scalability improvements -> multicore </li></ul><ul><li> – enhanced monitoring / diagnostic </li></ul><ul><li> – sane defaults for my.cnf out of the box </li></ul>www .BlueGecko . net
    6. 6. www .BlueGecko . net
    7. 7. <ul><li>a short diversion </li></ul><ul><li>from High Performance </li></ul><ul><li>MySQL 2 nd Edition (HPM2e) </li></ul><ul><li>-Baron Schwartz, Peter Zaitsev, </li></ul><ul><li>Vadim Tkachenko, and Jeremy </li></ul><ul><li>Zawodny </li></ul><ul><li>(don’t mistake 1 st Edition for 2 nd. </li></ul><ul><li>1 st is dangerously out of date </li></ul><ul><li>unless you’re running version 4.0) </li></ul>www .BlueGecko . net
    8. 8. <ul><li>storage engines </li></ul><ul><li>innodb </li></ul><ul><li>myisam </li></ul><ul><li>merge </li></ul><ul><li>blackhole </li></ul><ul><li>archive </li></ul><ul><li>federated </li></ul>www .BlueGecko . net
    9. 9. <ul><li>and locking </li></ul><ul><li>innodb </li></ul><ul><li>myisam </li></ul>www .BlueGecko . net
    10. 10. <ul><li>and locking </li></ul>www .BlueGecko . net
    11. 11. <ul><li>backups </li></ul><ul><li>take them </li></ul><ul><li>and test a restore </li></ul>www .BlueGecko . net
    12. 12. <ul><li>backups </li></ul><ul><li>mysqldump is not always a valid backup </li></ul><ul><li>replication is easiest </li></ul><ul><li>(and it gets you a warm standby) </li></ul><ul><li>InnoDB hot backup </li></ul><ul><li>XtraBackup </li></ul><ul><li>mylvmbackup </li></ul>www .BlueGecko . net
    13. 13. <ul><li>backups </li></ul>www .BlueGecko . net
    14. 14. <ul><li>scale </li></ul><ul><li>when it’s time to </li></ul><ul><li>go big, what are </li></ul><ul><li>the options? </li></ul><ul><li>separate reads </li></ul><ul><li>from writes </li></ul>www .BlueGecko . net
    15. 15. <ul><li>scale </li></ul><ul><li>write 1 / read many </li></ul><ul><li>partitioning / sharding </li></ul><ul><li>multimaster / rings </li></ul><ul><li>memcached </li></ul><ul><li>wafflegrid </li></ul>www .BlueGecko . net
    16. 16. <ul><li>another </li></ul><ul><li>short </li></ul><ul><li>diversion </li></ul><ul><li>to swap or </li></ul><ul><li>not to swap </li></ul><ul><li>that is the </li></ul><ul><li>question </li></ul>www .BlueGecko . net
    17. 17. <ul><li>free tools </li></ul><ul><li>Innotop </li></ul><ul><li>maatkit </li></ul><ul><li>MySQL proxy </li></ul><ul><li>monitoring/trending </li></ul><ul><li>cacti templates </li></ul><ul><li>$monitoring_server </li></ul><ul><li> – the one you know </li></ul>www .BlueGecko . net
    18. 18. additional resources <ul><li>irc.freenode.org </li></ul><ul><ul><li>#mysql </li></ul></ul><ul><ul><li>#maatkit </li></ul></ul><ul><li>mysql.com </li></ul><ul><li>HPM2e - Baron Schwartz, Peter Zaitsev, Vadim Tkachenko, and Jeremy Zawodny </li></ul>www .BlueGecko . net
    19. 19. credits <ul><li>flickr </li></ul><ul><li>Make: biosphere - kevino </li></ul><ul><li>MySQL mints - jimwinstead </li></ul><ul><li>5 – losmininos </li></ul><ul><li>storage- shuttercat7 </li></ul><ul><li>clones - adactio </li></ul><ul><li>Bell Labs - sodapop81 </li></ul><ul><li>License plate - severud </li></ul><ul><li>tools – meanestindian </li></ul><ul><li>console - hermzz </li></ul><ul><li>other </li></ul><ul><li>swap image </li></ul><ul><ul><li>http://www.vocw.edu.vn/content/m10106/latest/ </li></ul></ul><ul><li>special thanks to mike hamrick for suggestions on content and slides </li></ul>www .BlueGecko . net
    20. 20. Blue Gecko and contact info <ul><li>[email_address] </li></ul><ul><li>[email_address] </li></ul><ul><li>@sarahnovotny </li></ul><ul><li>@bluegeckodba </li></ul><ul><li>senk on #mysql </li></ul>www .BlueGecko . net Blue Gecko provides Remote DBA services for companies around the world 7x24x365 support including monitoring, performance analysis, proactive maintenance and architectural guidance for small and large datasets.