Your SlideShare is downloading. ×
Internet Briefing 2010: Performance Tuning & Scale-Out mit MySQL
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Internet Briefing 2010: Performance Tuning & Scale-Out mit MySQL

660

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
660
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
5
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Performance Tuning & Scale-Outmit MySQL Erfa-Gruppe Internet Briefing 2. März 2010 Oli Sennhauser Senior MySQL Consultant, FromDual oli.sennhauser@fromdual.com www.fromdual.com 1
  • 2. Inhalt● Allgemeines zu Performance Tuning● MySQL Performance Tuning● Scale-Out Architekturen● Und wie weiter?● Fragen & Antworten www.fromdual.com 2
  • 3. Szenarien● 3 Entwicklungsszenarien: www.fromdual.com 3
  • 4. Die FromDual Performance-WippeUrsachen für schlechtePerformance? www.fromdual.com 4
  • 5. Wo ist der Flaschenhals?● Wir haben 4 Möglichkeiten: ● CPU (Taktrate, Single-Threading, SQL-Queries) ● Memory (RAM, 32/64-bit OS) ● Disk (RAID, SAN, I/O Cache) ● Network (selten und wenn, dann Konfiguration) Virtualisierung? www.fromdual.com 5
  • 6. Wie finde ich den Flaschenhals?● shell> free● shell> vmstat 1● shell> iostat -xk 1● shell> ifconfig● Nagios, Cacti, MySQL Enterprise Monitor, etc.● Windows: Performance Monitor Siehe man-Pages. www.fromdual.com 6
  • 7. Wie messe ich MySQL?● mysql> SHOW PROCESSLIST;● mysql> SHOW GLOBAL STATUS;● mysql> SHOW ENGINE INNODB STATUS;● MySQL Enterprise Montior [1]● MyTop [2], InnoTop [3]● MySQL Activity Report [4] oder: MySQL Monitoring Solutions [5] www.fromdual.com 7
  • 8. Die wichtigsten MySQLDatenbank Parameter [6]● key_buffer_size (MyISAM: 25 – 33% RAM)● innodb_buffer_pool_size (InnoDB: 80% RAM)● innodb_log_file_size (InnoDB: 32 – 256 Mbyte)● innodb_flush_log_at_trx_commit (InnoDB: 2)● sync_binlog (InnoDB: 0 oder >> 1)● query_cache_size (MySQL: 16 – 128 Mbyte)● Database Health Check for MySQL [7] www.fromdual.com 8
  • 9. SQL Query Tuning● Slow Query Log (slow_query_log, slow_query_log_file, long_query_time)● log_queries_not_using_indexes (deprecated!)● mysqldumpslow -s t slow.log → Profile● EXPLAIN SELECT ... FROM ... → Execution Plan der Abfrage (nur SELECT) www.fromdual.com 9
  • 10. Scale-Up vs. Scale-Out Scale-Up● Kosten● MySQL Design Scale-Out● Physikalische Flaschenhälse● „Relaxation of Constraints“ www.fromdual.com 10
  • 11. Was für Komponenten nehme ichidealerweise?● LAMP3 evtl. Java?● „Mainstream“ → Linux (Solaris, Windows)● 64-bit OS und Hardware (Intel, AMD, KEIN Sparc!) und viel RAM!● Dediziertes I/O System (KEIN SAN, KEIN RAID-5!), schnelle Disks, Write Cache.● >= 1 Gbit Netzwerk● KEINE Virtualisierung! www.fromdual.com 11
  • 12. Der MySQL Scale-Out Ansatz Application DB www.fromdual.com 12
  • 13. Der MySQL Scale-Out Ansatz Application ro rtw Master Slave 1 www.fromdual.com 13
  • 14. Der MySQL Scale-Out Ansatz Application ro rtw Slave Reporting Master Slave 3 www.fromdual.com 14
  • 15. Der MySQL Scale-Out Ansatz Application ro rtw Slave Reporting Master Slave 1 Slave 2 Slave 3 Load balancer www.fromdual.com 15
  • 16. Der MySQL Scale-Out Ansatz Application ro rtw Slave Reporting Master Slave Backup Slave 1 Slave 2 Slave 3 ... Load balancer www.fromdual.com 16
  • 17. Weitere Möglichkeiten Irgendwann stehen wir beim Schreib- Durchsatz an...● Stärkeres I/O system● Solid State Drive/Disk (SSD) Bis > 1 Tbyte, €€€, ca. 10-20 x schneller (Marketing: 100x!)● MySQL Cluster In-Memory, Realtime, HP- und HA Datenbank www.fromdual.com 17
  • 18. MySQL Cluster Application Application Application Application Application NDB-API NDB-API Load balancer SQL Node 1 SQL Node 2 SQL Node 3 ...Mgm Node 1Mgm Node 2 Data Node 1 Data Node 2 Sw. Sw. Data Node 3 Data Node 4 www.fromdual.com 18
  • 19. Und wenn das noch nicht reicht?- Sharding! [9] „Horizontales Partitionieren“ der Daten● Separieren● Splitten www.fromdual.com 19
  • 20. Wie bereite ich meine Applikationdarauf vor?● ro / rw Datenbank-Verbindungen● modularisieren / kapseln● Asynchron und lose gekoppelt, Anforderungen lockern, Cachen● Messen, messen, messen...● Verschiedene Lasttest-Szenarios fahren.● Ich muss meine Applikation kennen! www.fromdual.com 20
  • 21. Literatur● Diese Präsentation: http://www.fromdual.com/presentations [1] MySQL Enterprise Montior: http://dev.mysql.com/doc/refman/5.1/en/mem-introduction.html [2] MyTop: http://jeremy.zawodny.com/mysql/mytop/ [3] InnoTop: http://www.xaprb.com/blog/2006/07/02/innotop-mysql-innodb-monitor/ [4] MySQL Activity Report: http://gert.sos.be/en/projects/mysqlar/ [5] MySQL Monitoring Solutions: http://www.shinguz.ch/MySQL/mysql_monitoring.html [6] MySQL Datenbank Parameter: http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html [7] Database Health Check for MySQL: http://www.shinguz.ch/database_health_check/ [8] MySQL Cluster: http://dev.mysql.com/doc/refman/5.1/en/mysql-cluster.html [9] Sharding: http://en.wikipedia.org/wiki/Shard_%28database_architecture%29 www.fromdual.com 21
  • 22. Fragen & Antworten ? und sonst → oli.sennhauser@fromdual.com www.fromdual.com 22

×