mysql in the cloud - percona€¦ · mysql in the cloud migraon, best prac
TRANSCRIPT
©2017Percona1
DimitriVanoverbeke(creditstoPeterZaitsev)
MySQLIntheCloudMigra<on,BestPrac<ces,HighAvailability,Scaling
Solu<onEngineerPerconaUniversityGhentJune22thof2017
©2017Percona2
WhoamISolu>onengineerwithinPercona!www.twiCer.com/dim0(Personalviewsandpoten>allyNSFW)
©2017Percona3
Letmestart….
WithsomeQues>ons!
©2017Percona4
Ques>onOne
HowManyofyouarerunningMySQL
IntheCloud?
©2017Percona5
Ques>onTwo
AreyourunningitinPublicCloud?PrivateCloud?
Both?
©2017Percona6
Ques>onThree?
AreyouusingDBaaSsuchasAmazonRDSorGoogleCloudSQL?
©2017Percona7
Ques>onFour
AreyouusingContainers?
©2017Percona8
LetsCoversomeBasics
©2017Percona9
Whatis“Cloud”
DynamicProgrammableInfrastructure
©2017Percona10
PublicandPrivate
Public
• InfrastructureSharedwithotherUsers
• AmazonAWStypicalexample
Private
• InfrastructurePrivateforcompany
• OpenStackinstalla<ontypicalexample
©2017Percona11
AllofthoseXaaS
• WorksinInfrastructurelevel:“Compute”,“Storage”,“Network”
• Examples:AWSEC2,S3,EBS
IaaS(Infrastructureasaservice)
• ProvidesDatabaseService(InstancesorClusters)touse• Examples:AmazonRDS,GoogleSpanner
DBaaS(Databaseasaservice)
• Providesfullpla[ormforyourapplica<ondevelopment• Examples:Heroku,AmazonElas<cBeanstalk,OpenShi\
PaaS(Placormasaservice)
©2017Percona12
RegionsandAvailabilityZones
Region
• SpecifiesGeographicRegion• Hierarchy-Europe–West–Ireland
• HighLatencybetweenRegions
• CompleteIsola<on
AvailabilityZone
• Islocatedintheregion• Reasonablyisolatedfromeachother
• MediumLatencybetweenAZ
©2017Percona13
MakingitVisual
Source:haps://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html
©2017Percona14
TopCloudProviders
©2017Percona15
Technologiestobeawareof
©2017Percona16
DecisionstoMake
©2017Percona17
Shouldyoumovetothecloud?
Thisisdecisionyourarelyhave
Programmableinfrastructureisthefuture
Virtualiza>onoverheadisgoingdown
SomecloudsproviderssupportBareMetal
©2017Percona18
Public?Private?Hybrid
PublicCloud
• Agility• Scalability• Costs• SmallandMediumBusinesses
PrivateCloud
• Control• Costs• LegacyIntegra<on
• SomeEnterpriseCompanies
HybridCloud
• InfrastructureusingBoth
• Cangetbenefitsofboth
• Atthecostofextracomplexity
©2017Percona19
SinglevendorvsMul>Vendor
SingleVendor
• Useallfeaturesvendorhastooffer
• DangerofVendorLockIn
Mul>Vendor
• Havetouse“lowestcommondenominator”
• AvoidVendorLockIn
©2017Percona20
DBaaS
DBaaS(ieAmazonRDS)
• Easier• Takesoffsomeopera<onalpains
• LessFlexible• MoreExpensive• MoreLock-In
IaaS(ieEC2+EBS+S3)
• Hardertorollyourown• Opera<onsonyourown(oryourpartner)
• MoreFlexible• LessExpensive• LessLock-In
©2017Percona21
OpenSourceintheCloud
OpenSourceCompa>bleisnotsameasOpen
Source
©2017Percona22
Migra>on
©2017Percona23
KeepitSimple
Donottrydoingupgradeatthesame>measmigra>on
Exactlysameminorversionisop>mal
Samemajorversion-must
©2017Percona24
MovingtoIaaSCloud
GeneralPrac>cesasinDatacenterMigra>onsapply
EasytouseBinaryBackups
Slave_compressed_protocolorcompressioninVPN
Supportu>li>esmayneedtobemodifiedforEBS/S3
©2017Percona25
MovingtoDBaaS• Mysqldump• Mysqlpump• Mydumper
Needtousedatabasedumptocopy
• CALLmysql.rds_set_external_masterCansetexternalslave
(AmazonRDS)
• Donothavedirectaccesstophysicalbox• Donothaverootuser
MonitoringBackupmayneedrevision
©2017Percona26
NewWithAmazonRDSAurora
CanusePerconaXtrabackup’sBackupto
seedtheclusterhCp://amzn.to/2pk6Iq7
©2017Percona27
MovingfromDBaaS
LogicalDatabasedumpaswell
Replica>onsupportedforMigra>ononly
ConfigureBinaryLogReten>onmysql.rds_set_configura3on
©2017Percona28
BestPrac>ces
©2017Percona29
BeingCostEfficient
Knowyourcloudvendorpricingpolicies
Lookbeyond“compute”pricing
BestPrice/Performanceconfigura>oninthecloudislikelytobedifferent
AWS:ReserveInstances
AWS:SpotInstances
©2017Percona30
GuaranteeversusBurst
Guaranteed
• Performanceresourceis“guaranteed”tohaveinworstcasescenario
• Thisiswhatyoucanplanfor
Burst
• Performanceresourcecanprovide
• Typicallynotguaranteed• Typicallylimitedinlengthtopreventabuse
©2017Percona31
Network
UnderstandApplica>on-DatabaseNetworkLatency
SameAZOp>mal;SameRegionMusthave
10GbNetwork
Understandnetwork“jiCer”
Latencyiscri>calformostapplica>ons
Bandwidthcanbeimportantfordumpsandbatchjob
©2017Percona32
CPU
Samewheneveryou’reinthecloudornot
MySQLusessinglethreadforsinglequery
Mul>-Coregivesgoodscalabilityfor“Web”workloads
©2017Percona33
Memory
Usemainlyasacache
VeryimportantforPerformance
©2017Percona34
StorageInstanceLocal
Storage
• Mayormaynotbeavailable
• NotHighlyavailable
• MaybeinexpensiveandhighPerformance
CloudBlockStorage
• Reliable• Remote• SeparatelyPrices• EBSonAWS
File/ObjectStorage
• StoreFiles/Objects
• Nointerac<veblocklevelaccess
• S3onAWS
©2017Percona35
ThingstoNote
Youcan’tgetanycombina>on
EBSPerformancedependsontheinstancesize
ProvisionedIOPsforOp>malPerformance
Glacierstorageforoldbackups
©2017Percona36
Opera>ngSystem
ConsiderCloudOp>mizedLinuxVersions
AtveryleastuseRecentLinuxVersions
“CloudOnly”Linuxmightbeinconvenientfordevelopment
©2017Percona37
MySQLVersionandConfigura>on
UseRecentVersion
DonotcountongoodDefaults
©2017Percona38
DBaaS
Thereisessen>allysamesystemsunderneath!
Mostofsameprac>cesApply
©2017Percona39
DBaaSisnotalwaysfaster
Source:haps://twindb.com/rds-vs-aurora-vs-ec2-benchmark/
©2017Percona40
HighAvailability
©2017Percona41
YourChoices
Rollyourown
UseDBaaS
©2017Percona42
ThingstoConsider
Youhavelesscontrolorvisibilityintotheinfrastructure
ThingsasIPtake–overmightnotwork
©2017Percona43
LoadBalancers
CloudLoadBalancer(Elas>cLoadBalanceratAWS)
HAProxy
ProxySQL
©2017Percona44
MaintainingcopiesofData
MySQLReplica>on
MySQLGroupReplica>on
PerconaXtraDBReplica>on(PXC)andGalera
©2017Percona45
WhyPerconaXtraDBClusterintheCloud
Read/Writetoanynodeworksgreatwithsimpleloadbalancers
Automa>cProvisioningandAutoScaling
Canrunwithlocalinstancestorage
Candeployacrossmul>pleAZ
©2017Percona46
Scaling
©2017Percona47
ScalabilityintheCloud
“BeCer”
• Duetocloudop<mizedop<onslikeAmazonAurora
“Worse”
• Duetorestrictedhardwarechoices
©2017Percona48
ScalingHow
ScaleUp
• Ver<calScaling• ScalewiththeHarwareSize–CPUs,Memory,Storage
ScaleOut
• HorizontalScaling• Scalebyaddingnodes
©2017Percona49
Badreputa>onofScalingUp…but
• 3-5TBdatabasesize• 100K+queries/sec• 5M+rowsread/sec• 100Krowsmodified/sec
ReasonablecommodityMySQL
ServerCanhandle
©2017Percona50
ScalingWhat?
Reads
Writes
DataSize
©2017Percona51
ScalingReads
Replica>on
Caching
MovingsomeloadfromMySQL
©2017Percona52
ScalingWrites
NewMySQLVersions
ParallelReplica>on
TokuDB
Func>onalPar>>oning
Sharding
©2017Percona53
NewinSharding
ProxySQL
Vitess
©2017Percona54
ScalingDataSize
Func>onalPar>>oningandSharding
DataArchiving
TokuDBforCompression
OuenOpera>onsdrivethisneedsnotAppPerformance
©2017Percona55
PerconaLiveEuropeCallforPapers&Registra>onareOpen!
ChampioningOpenSourceDatabases▪ MySQL,MongoDB,OpenSourceDatabases▪ TimeSeriesDatabases,PostgreSQL,RocksDB▪ Developers,Business/CaseStudies,Opera<ons▪ September25-27th,2017▪ RadissonBluRoyalHotel,Dublin,Ireland
SubmitYourProposalbyJuly17th!www.percona.com/live/e17
DATABASE PERFORMANCE MATTERS DatabasePerformanceMaCersDatabasePerformanceMaCersDatabasePerformanceMaCersDatabasePerformanceMaCersDatabasePerformanceMaCers