Your SlideShare is downloading. ×
MySQL-and-virtualization
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

MySQL-and-virtualization

918
views

Published on

Talk presented at PLMCE - https://www.percona.com/live/mysql-conference-2013/sessions/mysql-and-virtualization

Talk presented at PLMCE - https://www.percona.com/live/mysql-conference-2013/sessions/mysql-and-virtualization

Published in: Technology

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
918
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
15
Comments
0
Likes
1
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. Introduction Virtualization MySQL Symbiosis Instrumentation/Debugging Instrumentation II Application ConclusioMySQL and VirtualizationPercona Live MySQL Conference and Expo 2013Raghavendra Prabhuraghavendra.prabhu@percona.comPercona23rd April, 2013Raghavendra Prabhu PerconaMySQL Virtualization
  • 2. Introduction Virtualization MySQL Symbiosis Instrumentation/Debugging Instrumentation II Application ConclusioOutlineIntroductionVirtualizationMySQLSymbiosisInstrumentation/DebuggingInstrumentation IIApplicationConclusionRaghavendra Prabhu PerconaMySQL Virtualization
  • 3. Introduction Virtualization MySQL Symbiosis Instrumentation/Debugging Instrumentation II Application ConclusioOverviewWhyWhy notPerformance v/s EfficiencyOvercommit!High AvailabilityTesting/InstrumentationRaghavendra Prabhu PerconaMySQL Virtualization
  • 4. Introduction Virtualization MySQL Symbiosis Instrumentation/Debugging Instrumentation II Application ConclusioPopular solutionsXen, KVM, VirtualBoxWhy KVMMassive reuse of kernel and userspaceCompatibility in case of para-virtMost applies to Xen as wellImportant differenceRaghavendra Prabhu PerconaMySQL Virtualization
  • 5. Introduction Virtualization MySQL Symbiosis Instrumentation/Debugging Instrumentation II Application ConclusioNative against EmulationEmulation: TCGValgrindKVMKernel moduleVT-x (Intel), AMD-VGuest - Host contextExit - Enter latencyLazy approachPara-virtualizationRaghavendra Prabhu PerconaMySQL Virtualization
  • 6. Introduction Virtualization MySQL Symbiosis Instrumentation/Debugging Instrumentation II Application ConclusioDevelopmentQEMUMost activeIn-kernelNative clientMore hypervisorsKVM API - ioctl /dev/kvmRaghavendra Prabhu PerconaMySQL Virtualization
  • 7. Introduction Virtualization MySQL Symbiosis Instrumentation/Debugging Instrumentation II Application ConclusioConsiderationsPerformanceScaling - Horizontal or VerticalEggs and the BasketMoore’s lawCostSaturationRaghavendra Prabhu PerconaMySQL Virtualization
  • 8. Introduction Virtualization MySQL Symbiosis Instrumentation/Debugging Instrumentation II Application ConclusioMemoryKSMHow it works and is usedHow it can be used: MADV_MERGEABLEMemory Ballooning: VirtioOvercommitMemory statistics: QOMCachingAffects I/OWrite{back,through}, none, directsync and unsafeSnapshot mode & commit: cache=unsafeRaghavendra Prabhu PerconaMySQL Virtualization
  • 9. Introduction Virtualization MySQL Symbiosis Instrumentation/Debugging Instrumentation II Application ConclusioMemory IIKSM for MySQLMultiple buffer poolsShared storage - VirtFSWith NUMAPinning + KSM = !ksmtuned and numadBallooning: In host’s shoesWhereMigration & Upgrade - Hot/ColdWith QGAFeedback from MySQL: Para-virtualized process!CacheInnoDB + cache=none = true O_DIRECT: for NFS=writethrough: app fails to grok fsync=writeback: speed and benefits of noneRaghavendra Prabhu PerconaMySQL Virtualization
  • 10. Introduction Virtualization MySQL Symbiosis Instrumentation/Debugging Instrumentation II Application ConclusioCPUProcessor pinningCgroups: BetterApplies to othersDynamicHotplugOvercommitting - smpContext switchesRaghavendra Prabhu PerconaMySQL Virtualization
  • 11. Introduction Virtualization MySQL Symbiosis Instrumentation/Debugging Instrumentation II Application ConclusioNetworkTypesVDETAP and BridgeOpenvswitchDumpMulticast with UDPPerformancevirtio-netPara-virtualized constructMulti-queuevhost-netZero-copy transmit: DMANo Qemu: kernel and KVMNot just networkRaghavendra Prabhu PerconaMySQL Virtualization
  • 12. Introduction Virtualization MySQL Symbiosis Instrumentation/Debugging Instrumentation II Application ConclusioSecurityMasqueradingIsolationNamespacesRandom NumbersWhy?Hardware / Virtio RNGResource exhaustion: DDoSOOM: CgroupsSeccomp sandbox: Safety is only an illusion!Guest to host vulnerabilitiesEncryptionRaghavendra Prabhu PerconaMySQL Virtualization
  • 13. Introduction Virtualization MySQL Symbiosis Instrumentation/Debugging Instrumentation II Application ConclusioI/O and StorageThe weakest linkVirtiovirtio-blk-pci data planeSeparate I/O threadPCI PassthroughPCI devices in generalIOMMU (AMD) & VT-d (Intel)SR-IOV: multiple devices without havingVFIO: in userspaceNo longer exclusiveMore secure: very importantInterrupts closer to guestRaghavendra Prabhu PerconaMySQL Virtualization
  • 14. Introduction Virtualization MySQL Symbiosis Instrumentation/Debugging Instrumentation II Application ConclusioI/O and Storage IIVirtFSFilesystem passthrough9p protocolPossibilitiesFragmentationHow: Hole punchingFallocate, pre-allocation QcowThin provisioningQcow lazy provisioningDevice mapper targetThrottling: Errant guests!block_set_io_throttleRaghavendra Prabhu PerconaMySQL Virtualization
  • 15. Introduction Virtualization MySQL Symbiosis Instrumentation/Debugging Instrumentation II Application ConclusioI/O and Storage IIIBackendsRawQcowBlock device attachmentPerformance close to bare metalGlusterFSSheepdogDistributed StorageiSCSINBDNetworked storageShared disk imageRaghavendra Prabhu PerconaMySQL Virtualization
  • 16. Introduction Virtualization MySQL Symbiosis Instrumentation/Debugging Instrumentation II Application ConclusioI/O and Storage IVSchedulerDeadlineCFQ - quantum and sliceDiscardPass discard requests to host filesystemFully asyncAIOpthread v/s nativeSwapSwappinessLess preferred to Ballooning and KSMPoor with EPTRaghavendra Prabhu PerconaMySQL Virtualization
  • 17. Introduction Virtualization MySQL Symbiosis Instrumentation/Debugging Instrumentation II Application ConclusioOthersTransparent Huge PagesIssues?Possible fixes - MADV_NOHUGEPAGEHow can it helpivshmemFastest message passingRaghavendra Prabhu PerconaMySQL Virtualization
  • 18. Introduction Virtualization MySQL Symbiosis Instrumentation/Debugging Instrumentation II Application ConclusioReliabilityWhat everyone wants: Uninterrupted Sleep - ‘D’ stateWhat they usually get: Nagios alertsIts like InsuranceWhat can be doneBackupsBackup the original imageBlockdev snapshotguestfs-fsfreeze-{freeze,thaw} and FTWRLRaghavendra Prabhu PerconaMySQL Virtualization
  • 19. Introduction Virtualization MySQL Symbiosis Instrumentation/Debugging Instrumentation II Application ConclusioReliability IIHigh AvailabilitySystem uptime v/s Application uptimeDifferenceMigrationLive migration: RequirementOnline block streaming/commitDrive MirroringLive block copySnapshotsVM Snapshots: complete stateQcow2 snapshotsRaghavendra Prabhu PerconaMySQL Virtualization
  • 20. Introduction Virtualization MySQL Symbiosis Instrumentation/Debugging Instrumentation II Application ConclusioUpgradesDowntimeBallooning the buffer poolMigrationPreserves connectionsOpenvSwitchRaghavendra Prabhu PerconaMySQL Virtualization
  • 21. Introduction Virtualization MySQL Symbiosis Instrumentation/Debugging Instrumentation II Application ConclusioTestingClusterPXCTopologiesArmy of nodesForest: Cluster of clustersData centers in microcosmMemoryNUMAPage cache and Memory PressureDump guest memory: coreExamine onlineRaghavendra Prabhu PerconaMySQL Virtualization
  • 22. Introduction Virtualization MySQL Symbiosis Instrumentation/Debugging Instrumentation II Application ConclusioFault injectionNMI and MCEPulling the power cord!FilesystemInteresting casesExt4XFSPCI AERRaghavendra Prabhu PerconaMySQL Virtualization
  • 23. Introduction Virtualization MySQL Symbiosis Instrumentation/Debugging Instrumentation II Application ConclusioOthersJenkins and VagrantWatchdog“Houston, we have a problem”With MySQL: Turtles all the waysystemdACPI tablesRaghavendra Prabhu PerconaMySQL Virtualization
  • 24. Introduction Virtualization MySQL Symbiosis Instrumentation/Debugging Instrumentation II Application Conclusioperf-kvmperf toolsuiteStrace?CaveatsRaghavendra Prabhu PerconaMySQL Virtualization
  • 25. Introduction Virtualization MySQL Symbiosis Instrumentation/Debugging Instrumentation II Application ConclusioGDB monitorRemote Target and Single SteppingKernel developmentbzImage and initrdRaghavendra Prabhu PerconaMySQL Virtualization
  • 26. Introduction Virtualization MySQL Symbiosis Instrumentation/Debugging Instrumentation II Application ConclusioQemu Monitor (QMP/HMP)BallooningThrottlePCI Hot-addExamining memoryJSON APIEndless possibilities with scriptingPython scripts in repoInfo commandsRaghavendra Prabhu PerconaMySQL Virtualization
  • 27. Introduction Virtualization MySQL Symbiosis Instrumentation/Debugging Instrumentation II Application ConclusioTracingFtraceLatencyVirtio I/ODtraceWith systemtapLTTngSimpleStderrDprintfRaghavendra Prabhu PerconaMySQL Virtualization
  • 28. Introduction Virtualization MySQL Symbiosis Instrumentation/Debugging Instrumentation II Application ConclusioDevelopmentQCOWBacking file hierarchyblock streamAdvantagesCopy on readLazy RefcountsEncryption and CompressionRaghavendra Prabhu PerconaMySQL Virtualization
  • 29. Introduction Virtualization MySQL Symbiosis Instrumentation/Debugging Instrumentation II Application ConclusioDevelopment IICaveatsRaw v/s Qcow: PerformanceRendering Qcow unusableFilesystem passthroughShare datadirCommon code-tree / development directoriesPass the entire root R/O!Lightweight SnapshotUseful to have newer FHS with /usrRaghavendra Prabhu PerconaMySQL Virtualization
  • 30. Introduction Virtualization MySQL Symbiosis Instrumentation/Debugging Instrumentation II Application ConclusioWrappersScriptinglibvirtvirsh / virt-managerOpenstackProxmoxCandySpiceVNCoVirtVDSMRaghavendra Prabhu PerconaMySQL Virtualization
  • 31. Introduction Virtualization MySQL Symbiosis Instrumentation/Debugging Instrumentation II Application ConclusioThoughts?QuestionsUsage and ExperienceRaghavendra Prabhu PerconaMySQL Virtualization
  • 32. Introduction Virtualization MySQL Symbiosis Instrumentation/Debugging Instrumentation II Application ConclusioAppendixBest practices: http://goo.gl/LY3tfVirtio Introduction: http://goo.gl/B9bCAKVM Kernel API: http://goo.gl/5A4Malinux-kvm.org: http://goo.gl/yWPiUInternals blog: http://goo.gl/z07cyQemu wiki: http://goo.gl/IGoKaRedHat Virtualization docs: http://goo.gl/rXRKcDocs from Qemu git tree: http://goo.gl/qD7njKSM internals: http://goo.gl/ypyhkRaghavendra Prabhu PerconaMySQL Virtualization
  • 33. Introduction Virtualization MySQL Symbiosis Instrumentation/Debugging Instrumentation II Application ConclusioMeRaghavendra Prabhuhttp://wnohang.net/aboutSoftware Engineer at Percona and Product Lead of PXChttps://launchpad.net/percona-xtradb-clusterSlides downloadable at http://goo.gl/jsultRaghavendra Prabhu PerconaMySQL Virtualization