MySQL In the Cloud - Percona · MySQL In the Cloud Migration, Best Practices, High Availability,...
Transcript of MySQL In the Cloud - Percona · MySQL In the Cloud Migration, Best Practices, High Availability,...
©2017Percona1
PeterZaitsev
MySQLIntheCloudMigration,BestPractices,HighAvailability,Scaling
CEOLosAngelesMySQLMeetupJune12th,2017
©2017Percona2
Letmestart….
WithsomeQuestions!
©2017Percona3
QuestionOne
HowManyofyouarerunningMySQLInthe
Cloud?
©2017Percona4
QuestionTwo
AreyourunningitinPublicCloud?Private
Cloud?Both?
©2017Percona5
QuestionThree?
AreyouusingDBaaSsuchasAmazonRDSorGoogleCloudSQLorrunningyourown?
©2017Percona6
QuestionFour
AreyouusingContainers?(SuchasDocker)
©2017Percona7
LetsCoversomeBasics
©2017Percona8
Whatis“Cloud”
DynamicProgrammableInfrastructure
©2017Percona9
PublicandPrivate
Public
•InfrastructureSharedwithotherUsers
•AmazonAWStypicalexample
Private
•InfrastructurePrivateforcompany
•OpenStackinstallationtypicalexample
©2017Percona10
AllofthoseXaaS• WorksinInfrastructurelevel:“Compute”,“Storage”,“Network”
• Examples:AWSEC2,S3,EBS
IaaS(Infrastructureasaservice)
• ProvidesDatabaseService(InstancesorClusters)touse• Examples:AmazonRDS,GoogleSpanner
DBaaS(Databaseasaservice)
• Providesfullplatformforyourapplicationdevelopment• Examples:Heroku,AmazonElasticBeanstalk,OpenShift
PaaS(Platformasaservice)
©2017Percona11
RegionsandAvailabilityZones
Region
• SpecifiesGeographicRegion• Hierarchy- NorthAmerica–West– California
• HighLatencybetweenRegions
• CompleteIsolation
AvailabilityZone
• Islocatedintheregion• Reasonablyisolatedfromeachother
• MediumLatencybetweenAZ
©2017Percona12
MakingitVisual
Source:https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html
©2017Percona13
TopCloudProviders
©2017Percona14
Technologiestobeawareof
©2017Percona15
DecisionstoMake
©2017Percona16
Shouldyoumovetothecloud?
Thisisdecisionyourarelyhave
Programmableinfrastructureisthefuture
Virtualizationoverheadisgoingdown
SomecloudsproviderssupportBareMetal
©2017Percona17
Public?Private?Hybrid
PublicCloud
• Agility• Scalability• Costs• SmallandMediumBusinesses
PrivateCloud
• Control• Costs• LegacyIntegration
• SomeEnterpriseCompanies
HybridCloud
• InfrastructureusingBoth
• Cangetbenefitsofboth
• Atthecostofextracomplexity
©2017Percona18
SinglevendorvsMultiVendor
SingleVendor
•Useallfeaturesvendorhastooffer
•DangerofVendorLockIn
MultiVendor
•Havetouse“lowestcommondenominator”
•AvoidVendorLockIn
©2017Percona19
DBaaS
DBaaS(ieAmazonRDS)
• Easier• Takesoffsomeoperationalpains
• LessFlexible• MoreExpensive• MoreLock-In
IaaS(ieEC2+EBS+S3)
• Hardertorollyourown• Operationsonyourown(oryourpartner)
• MoreFlexible• LessExpensive• LessLock-In
©2017Percona20
OpenSourceintheCloud
OpenSourceCompatibleisnotsameasOpen
Source
©2017Percona21
Migration
©2017Percona22
KeepitSimple
Donottrydoingupgradeatthesametimeasmigration
Exactlysameminorversionisoptimal
Samemajorversion- must
©2017Percona23
MovingtoIaaSCloud
GeneralPracticesasinDatacenterMigrationsapply
EasytouseBinaryBackups
Slave_compressed_protocolorcompressioninVPN
SupportutilitiesmayneedtobemodifiedforEBS/S3
©2017Percona24
MovingtoDBaaS• Mysqldump• Mysqlpump• Mydumper
Needtousedatabasedumptocopy
• CALLmysql.rds_set_external_masterCansetexternalslave
(AmazonRDS)
• Donothavedirectaccesstophysicalbox• Donothaverootuser
MonitoringBackupmayneedrevision
©2017Percona25
NewWithAmazonRDSAurora
CanusePerconaXtrabackup’sBackupto
seedtheclusterhttp://amzn.to/2pk6Iq7
©2017Percona26
MovingfromDBaaS
LogicalDatabasedumpaswell
ReplicationsupportedforMigrationonly
ConfigureBinaryLogRetentionmysql.rds_set_configuration
©2017Percona27
BestPractices
©2017Percona28
BeingCostEfficient
Knowyourcloudvendorpricingpolicies
Lookbeyond“compute”pricing
BestPrice/Performanceconfigurationinthecloudislikelytobedifferent
AWS:ReserveInstances
AWS:SpotInstances
©2017Percona29
GuaranteeversusBurst
Guaranteed
•Performanceresourceis“guaranteed”tohaveinworstcasescenario
•Thisiswhatyoucanplanfor
Burst
•Performanceresourcecanprovide
•Typicallynotguaranteed•Typicallylimitedinlengthtopreventabuse
©2017Percona30
Network
UnderstandApplication-DatabaseNetworkLatency
SameAZOptimal;SameRegionMusthave
10GbNetwork
Understandnetwork“jitter”
Latencyiscriticalformostapplications
Bandwidthcanbeimportantfordumpsandbatchjob
©2017Percona31
CPU
Samewheneveryou’reinthecloudornot
MySQLusessinglethreadforsinglequery
Multi-Coregivesgoodscalabilityfor“Web”workloads
©2017Percona32
Memory
Usemainlyasacache
VeryimportantforPerformance
©2017Percona33
StorageInstanceLocal
Storage
• Mayormaynotbeavailable
• NotHighlyavailable
• MaybeinexpensiveandhighPerformance
CloudBlockStorage
• Reliable• Remote• SeparatelyPrices• EBSonAWS
File/ObjectStorage
• StoreFiles/Objects• Nointeractiveblocklevelaccess
• S3onAWS
©2017Percona34
ThingstoNote
Youcan’tgetanycombination
EBSPerformancedependsontheinstancesize
ProvisionedIOPsforOptimalPerformance
Glacierstorageforoldbackups
©2017Percona35
OperatingSystem
ConsiderCloudOptimizedLinuxVersions
AtveryleastuseRecentLinuxVersions
“CloudOnly”Linuxmightbeinconvenientfordevelopment
©2017Percona36
MySQLVersionandConfiguration
UseRecentVersion
DonotcountongoodDefaults
©2017Percona37
DBaaS
Thereisessentiallysamesystemsunderneath!
MostofsamepracticesApply
©2017Percona38
DBaaS isnotalwaysfaster
Source:https://twindb.com/rds-vs-aurora-vs-ec2-benchmark/
©2017Percona39
HighAvailability
©2017Percona40
YourChoices
Rollyourown
UseDBaaS
©2017Percona41
ThingstoConsider
Youhavelesscontrolorvisibilityintotheinfrastructure
ThingsasIPtake–overmightnotwork
©2017Percona42
LoadBalancers
CloudLoadBalancer(ElasticLoadBalanceratAWS)
HAProxy
ProxySQL
©2017Percona43
MaintainingcopiesofData
MySQLReplication
MySQLGroupReplication
PerconaXtraDBReplication(PXC)andGalera
©2017Percona44
WhyPerconaXtraDB ClusterintheCloud
Read/Writetoanynodeworksgreatwithsimpleloadbalancers
AutomaticProvisioningandAutoScaling
Canrunwithlocalinstancestorage
CandeployacrossmultipleAZ
©2017Percona45
Scaling
©2017Percona46
ScalabilityintheCloud
“Better”
•DuetocloudoptimizedoptionslikeAmazonAurora
“Worse”
•Duetorestrictedhardwarechoices
©2017Percona47
ScalingHow
ScaleUp
•VerticalScaling•ScalewiththeHarwareSize– CPUs,Memory,Storage
ScaleOut
•HorizontalScaling•Scalebyaddingnodes
©2017Percona48
BadreputationofScalingUp…but
•3-5TBdatabasesize•100K+queries/sec•5M+rowsread/sec•100Krowsmodified/sec
ReasonablecommodityMySQL
ServerCanhandle
©2017Percona49
ScalingWhat?
Reads
Writes
DataSize
©2017Percona50
ScalingReads
Replication
Caching
MovingsomeloadfromMySQL
©2017Percona51
ScalingWrites
NewMySQLVersions
ParallelReplication
TokuDB
FunctionalPartitioning
Sharding
©2017Percona52
NewinSharding
ProxySQL
Vitess
©2017Percona53
ScalingDataSize
FunctionalPartitioningandSharding
DataArchiving
TokuDBforCompression
OftenOperationsdrivethisneedsnotAppPerformance
©2017Percona54
PerconaLiveEuropeCallforPapers&RegistrationareOpen!
ChampioningOpenSourceDatabases▪MySQL,MongoDB,OpenSourceDatabases▪TimeSeriesDatabases,PostgreSQL,RocksDB▪Developers,Business/CaseStudies,Operations▪September25-27th,2017▪RadissonBlu RoyalHotel,Dublin,Ireland
SubmitYourProposalbyJuly17th!www.percona.com/live/e17
DATABASE PERFORMANCEMATTERS
DatabasePerformanceMattersDatabasePerformanceMattersDatabasePerformanceMattersDatabasePerformanceMattersDatabasePerformanceMatters