devops for databases - microsoft€¦ · devops for databases with examples in ms sql server....
TRANSCRIPT
DevOpsforDatabasesWithexamplesinMSSQLServer.
SergeyOlontsevSQLServerMVP,[email protected]@SergeyOlontsevhttp://olontsev.ru/http://SergeyOlontsev.com/
OlontsevAcademy©2017
SergeyOlontsevSoftwareExpert,KasperskyLab
SQLServer12+years.ETL,HighLoad andBigData,performancetuning.
[email protected]@SergeyOlontsevhttp://olontsev.ru/http://SergeyOlontsev.com/
OlontsevAcademy©2017
DevOps
OlontsevAcademy©2017
CI&CDContinuousIntegration(CI) isadevelopmentpracticethatrequiresdeveloperstointegratecodeintoasharedrepositoryseveraltimesaday.Eachcheck-inisthenverifiedbyanautomatedbuild,allowingteamstodetectproblemsearly.
Byintegratingregularly,youcandetecterrorsquickly,andlocatethemmoreeasily.
ContinuousDeployment(CD) iscloselyrelatedtoContinuousIntegrationandreferstothereleaseintoproductionofsoftwarethatpassestheautomatedtests.
OlontsevAcademy©2017
Databasevs.Application
OlontsevAcademy©2017
DatabaseStructure&Codecreate table [dbo].[Orders] (
[OrderId] int not null,[CustomerId] int not null
);go
create procedure [dbo].[GetOrders]asbegin
set nocount on;
select[OrderId],[CustomerId]
from [dbo].[Orders];end;go
OlontsevAcademy©2017
DBA
OlontsevAcademy©2017
DatabaseConfiguration&OtherStuff
• Securitypermissions• Serverconfiguration• Serverlevelobjects(linkedservers,jobs,custom
errors,etc.)• DatabaseIndexes&MaintenancePlans• Backups
OlontsevAcademy©2017
InfrastructureasCode
OlontsevAcademy©2017
DatabaseTesting
UnitIntegrationPerformance
OlontsevAcademy©2017
WhatisTDD?
Test-firstdevelopmentJWriteenough codetopasstests
Unfortunately,notsowidelyusedbydatabasedevelopers.
OlontsevAcademy©2017
SomeConcepts
Alltestsshouldbeautomatedandeasilyre-runnablebyanydeveloperinyourteam.
Probably“one-clicksolution”orevenfullyautomatedone.EitherintegratedinyourIDE(VisualStudio)orarecreatedusingthirdpartyframework
Itcouldbeevenstoredproceduresorpowershell scriptswrittenbyyou.
OlontsevAcademy©2017
Benefits
• Easyandquickcodecheckingforcorrectbehaviorinspecifiedusecases.
• Simpleensuringthatnothingisbrokenwhenaddingnewfeatureorchanginglogic.
• Helpsyoueasilychangecodewrittenbyotherteammembers.
OlontsevAcademy©2017
Whystillnotsoused?
• Lackofknowledge.• Notimeordesiretolearnanewtool.• Ittakesalotmoretimetowritetestsandpreparethe
infrastructure.
OlontsevAcademy©2017
PerformanceConsiderations
• Yourtestsarejustcodethatrunsinsideyourdatabase.• Trynottoclearandinserttestdatabeforeeachtest.• Choosetoolsthatallowyoutoreusetestscode(for
example,executingaseriesofstoredproceduresonebyone).
OlontsevAcademy©2017
UnitTesting
OlontsevAcademy©2017
NotaPerfectApproach
• Youcannotimagineallthescenariosthatcouldhappenintherealworld.Butyou’lldefinitelyreducetheamountofbugs.
• Createintegrationtestingsolutionstocheckhowyoursystemworksasawhole.
• Loadtestingwillhelpyoutochecktheperformanceandbehaviorofcriticalqueries.
OlontsevAcademy©2017
ContinuousIntegration
• Eachcommittriggersanautomaticallydeploymentandfulltestcircle.
• Don’tcommitsmallchangestothecommonrepository.
• Runsimpletestsonyourlocalmachinefirst.• AvailableinTFS,TeamCity,etc.
OlontsevAcademy©2017
PerformanceTesting– TheWrongWay
OlontsevAcademy©2017
PerformanceTesting– TheRightWay
OlontsevAcademy©2017
NewVersion
OlontsevAcademy©2017
GeneratingDeploymentScripts
SSDTDemo
OlontsevAcademy©2017
DevCon 2013
OlontsevAcademy©2017
DeploymentPipeline
OlontsevAcademy©2017
Tools
OlontsevAcademy©2017
OneKeyDifference
OlontsevAcademy©2017
Questions?