1 / 38

Database Performance What Really Matters?

Database Performance What Really Matters? . Peter Zaitsev , CEO, Percona SCMG Meeting Chester,VA April 17,2 014. About Me & Percona. Founder and CEO of Percona Products and Services for MySQL Ecosystem Support, Consulting, RemoteDBA etc

sutton
Télécharger la présentation

Database Performance What Really Matters?

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Database PerformanceWhat Really Matters? • Peter Zaitsev, • CEO, Percona • SCMGMeeting • Chester,VA • April 17,2014

  2. About Me & Percona • Founder and CEO of Percona • Products and Services for MySQL Ecosystem • Support, Consulting, RemoteDBAetc • Important Focus: Have been helping customers with Performance Problems • MySQL and Beyond

  3. About the Presentation • Share some valuable background and Theory behind Performance Optimization • Look at Load Testing and Benchmarking • How to apply them in practice • How to look for right things • “What really matters”

  4. Group Notes • This presentation is focused on MySQL Users • And other users of “New Generation” technologies • They often have less theoretical background • Forgive me some simplifications and talking about basics

  5. Some background and Theory

  6. Databases do not matter • Users, Business does not care about databases • Really!

  7. What Matters ? • Application Performance • As seen by your Users, Business • Response time for their transactions with the system

  8. What Impacts Performance? • Changes to the transaction volume • More users • Changes to transaction mix/type • Do not forget non-business transactions • Data Volume • Changes to application features • Environment Changes • RAID running slow to degraded mode

  9. Database Performance – Part of The Picture • Database Performance – Part of the Picture • Look at complete Application not Database alone • Database may be the bottleneck • Or it might be something else

  10. Bottleneck Solutions • Even when Database is the Bottleneck solutions might lay elsewhere

  11. Application Architecture • Caching • Queuing • Concurrency Management • Data Distribution (sometimes) • Use of Data Replicas (sometimes) • Async and Parallel Processing (sometimes)

  12. Application Defines • Schema and Queries • Same Application Operation can be done using different Schema and Queries • Some Approaches • Normalization/Denormalization • Summary Tables • Indexing • Using Special Purpose Systems • Column Store; Full Text Search; Massively Parallel Processing; Graph etc

  13. The Rule for Query Optimization Do not look just optimizing the query, look at the larger picture how to optimize the whole operation

  14. Learning from the Industry • Technology has a lot to learn from different industries • Application Request processing is quite similar to manufacturing • Request processing takes multiple stages • Having input and output data • Utilizing Resources in the meanwhile • Resources on Service Level • Resources on Physical Level

  15. Lessons from Manufacturing • “The Goal” by Dr. EliyahuM. Goldratt • “Identify And Protect Constraint” • Bottleneck • Minimize Work in Progress

  16. Lessons from Call Center • Queuing Theory • Response Time = Wait Time + Service Time • Requests come as “Random Arrivals” • The high utilization means long Wait time • And poor response time

  17. The Hockey Stick • High Utilization yields disproportional increase in response time

  18. Throughput • Theoretical possible Throughput assumes uniform arrivals • Or unlimited queue size • Will not be reached; resource will stay idle some time • Do not drive for complete resource usage • Ie 100% CPU usage • Even at what you consider peak load

  19. Database Performance Testing

  20. Benchmarks • Type of Benchmark • Pure Database • Easy to setup. Might be misleading • Complete System • Much Harder to set up. More valuable results • Workload and Data • Simulated (are we getting it right?) • Replaying real world workload • How close we can emulate it ?

  21. Synthetic Benchmarks • Most of published benchmark results are synthetic • Sysbench, TPC-C, LinkBenchetc • This is what gives you comparable result • Beware: These results are highly irrelevant • Your application is different

  22. How are Benchmarks set up • Most typical • Fixed concurrency “number of connections” • Send requests in as fast as possible • In Real World • “Injection Rate” – amount users on the system • Concurrency is dynamic • More connections may be created as needed • “Think Time” between issuing queries

  23. Results from Benchmarks • Throughput is reported • Transactions per minute, per second • What users care ? • Response time, stable response time • You can’t measure response time when you try to saturate your system fully • Issuing requests as fast as possible

  24. Response Time • Saturated Load – Higher Concurrency – Higher Response Time

  25. Time Stability • Those graphs correspond to about same average throughput • Which is better ? • How would you do capacity planning ?

  26. SSDs – New Pain in the… • Conventionally – no history • You reboot the system and get repeatable workload all the time • Exceptions: SAN/NAS, Virtualization, Cloud • Flash is complicated Black Box • Performance is not repeatable – depends on unknown state • Peak Writes different from Sustained Writes • Like Write cache but different scale

  27. Helpful Tools • Sysbench has “Injection type benchmark” • http://bit.ly/x4mZ0d • Percona Playback • http://www.percona.com/doc/percona-playback/ • Look at the log file, reissue queries at the intervals and threads as it happened in real run

  28. Concurrency • There is always optimal concurrency from “throughput” point of view • WIP is expensive

  29. Concurrency and Response time • Though Experiment • 1CPU; 100 tasks requiring 1 sec of CPU time each • Run them concurrently ? • Queue them and run one after another?

  30. Restricting Concurrency • Sysbench “Injection Benchmark” • Setting the cap on amount of threads

  31. Side Load • Almost no one does Benchmrks/Load Testing with side load • Can cause serve issues • Your Batch Jobs ? • Backups ? • RAID background consistency check ?

  32. Real Performance Issues • Persistent Problems • Are easy. Well caught by conventional load testing • Not enough resources; bad query • Transient Problems • Something happens; System performs poorly for 10 seconds; few minutes • Very typical hard to catch

  33. Concurrency is often the cause

  34. Real World • You will not catch all Real World issues even with best benchmark/load testing • Proper monitoring is a must • Look at the Application Response time over time • Gather related system metrics for analyses • Database included but not just database

  35. Do not focus on average • Look at 1%, 5% of worst transactions • Some of your users will be impacted before the problem is there for average user • What causes these to be slow ? • The answer can be different • Disk IO; Database locks etc;

  36. Drill Down • Can you Drill down from your Application Transaction to the other subsystem • Why specific request was slow and what made it slow? • NewRelic, AppDynamics are some of such tools available

  37. Summary • Take a view of the full system • Understand your Bottleneck • Solution might be in the different place than the problem • Do Right benchmarks and Load Testing • But do not expect them to catch all performance situations

  38. Thank You! Peter Zaitsev pz@percona.com www.percona.com

More Related