MySQL Optimization                     Tips to increase performanceSachin KhoslaFounder, Digimantra.com
What’s next ? MySQL – What’s that ? Optimize ? Where and What ? Quick Glance at the famous MySQL Storage Engines Many ...
Let’s Go !Have a question ?   • If it’s a short – Shoot it ?   • If it’s a long – Save it till end of the session :)
As many of you know !•MySQL is a relational database•Community Edition is free of cost•Free GUI tools for Server Administr...
Why Optimize• Cost    • Tuned system = less resources = less investment.    • After tuning the system, you get a real usag...
Who Should Optimize?Ecosystem – Who are responsible in developing that very application.    1.   Designers – The documenti...
Optimized, Really ?• Benchmarking• Profiling• Difference between the Benchmark & ProfilingRef - http://dev.mysql.com/tech-...
MySQL flavors•MyISAM – The ideal son•InnoDB – Clever but expensive*•Memory (Heap)
MyISAM                          InnoDB•Of course, there is no        •Of course, there is nodifference. It’s just you !   ...
Memory (Heap)• Faster, Performance booster• Intermediary table• Use it when you have more select than insert• Table Struct...
Finally, ways to boost performance• Mysql Query Cache• File Cache system• Memcached• Solr / Lucene
Mysql Query Cache• Internal cache system of MySQL• Caches the queries being fired• Never returns stale data• Good when you...
File Cache system• Traditional way of caching with files.• Saves database server ping.• Still accesses the file structure....
Memcached• How is it different than traditional cache ?• Can it improve my site’s application’s performance ?• How ?      ...
Solr / Lucene•Hit highlighting, faceted search, caching, replication,and a web administration interface – Heavy terms ?•In...
Other ways• Query Optimization    • Using Explain    • Show table status (InnoDB / MySQL)    • Show InnoDB status (indexes...
Q&A
Thank you !    www.digimantra.com      Twitter - @realinFB – http://fb.me/sachinkhosla
MySQL Optimization from a Developer's point of view
MySQL Optimization from a Developer's point of view
Upcoming SlideShare
Loading in …5
×

MySQL Optimization from a Developer's point of view

1,684 views

Published on

Optimization from a developer's point of view. Optimization is not only the duty of a DBA but its should be done by all those who are involved in the ecosystem

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
1,684
On SlideShare
0
From Embeds
0
Number of Embeds
30
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

MySQL Optimization from a Developer's point of view

  1. 1. MySQL Optimization Tips to increase performanceSachin KhoslaFounder, Digimantra.com
  2. 2. What’s next ? MySQL – What’s that ? Optimize ? Where and What ? Quick Glance at the famous MySQL Storage Engines Many ways but we talk about Cache systems  Query Cache  File Cache  MemCached  Solr/Lucene
  3. 3. Let’s Go !Have a question ? • If it’s a short – Shoot it ? • If it’s a long – Save it till end of the session :)
  4. 4. As many of you know !•MySQL is a relational database•Community Edition is free of cost•Free GUI tools for Server Administration•Support by the community, forums, manual/docs etc.
  5. 5. Why Optimize• Cost • Tuned system = less resources = less investment. • After tuning the system, you get a real usage stat.• Performance • Performance of the system increases the output :) • Happy developers = Happy end users• Stay in the game • Undoubtedly you want to keep pace with the latest technology • Faster systems showcase helps bring in more business
  6. 6. Who Should Optimize?Ecosystem – Who are responsible in developing that very application. 1. Designers – The documenting guys :) 2. Developers – Geeks :D 3. System/DB Administrators – The machines :P
  7. 7. Optimized, Really ?• Benchmarking• Profiling• Difference between the Benchmark & ProfilingRef - http://dev.mysql.com/tech-resources/articles/pro-mysql-ch6.html
  8. 8. MySQL flavors•MyISAM – The ideal son•InnoDB – Clever but expensive*•Memory (Heap)
  9. 9. MyISAM InnoDB•Of course, there is no •Of course, there is nodifference. It’s just you ! difference. It’s just you !•You need speed and term •You understand, what“transaction” is martian for transactions are and how areyou. they going to effect.•You sure about the size of •Sky is the limit – did youthe data in your database. smell cloud computing,eh?•Data is stored in insertion •Rows are physically orderedorder. (no clustered index) by the primary key
  10. 10. Memory (Heap)• Faster, Performance booster• Intermediary table• Use it when you have more select than insert• Table Structure remains not the data• Fixed length for data types like varchar• No support for text, blob
  11. 11. Finally, ways to boost performance• Mysql Query Cache• File Cache system• Memcached• Solr / Lucene
  12. 12. Mysql Query Cache• Internal cache system of MySQL• Caches the queries being fired• Never returns stale data• Good when you have less or almost no inserts• Be sure to choose an optimum size for cache (query_cache_size)
  13. 13. File Cache system• Traditional way of caching with files.• Saves database server ping.• Still accesses the file structure.• No Big Deal !
  14. 14. Memcached• How is it different than traditional cache ?• Can it improve my site’s application’s performance ?• How ? $mem = new Memcache(); //PECL extn in PHP $mem->connect(‘SERVER_NAME’,’PORT_NO’); //connect $mem->set(‘key’,’data’); //set memcached KV pair $mem->get(‘key’); //get data
  15. 15. Solr / Lucene•Hit highlighting, faceted search, caching, replication,and a web administration interface – Heavy terms ?•In simple terms it’s a server which has indexes of thedatabase and when you send a request to it, it returnyou data in the form of XML/JSON
  16. 16. Other ways• Query Optimization • Using Explain • Show table status (InnoDB / MySQL) • Show InnoDB status (indexes and all )•Table level Optimization • Normalization• DB Server Level • mysqld status • Process monitoring tools
  17. 17. Q&A
  18. 18. Thank you ! www.digimantra.com Twitter - @realinFB – http://fb.me/sachinkhosla

×