Home
%3CLINGO-SUB%20id%3D%22lingo-sub-394847%22%20slang%3D%22en-US%22%3EPart%203%3A%20Intune%E2%80%99s%20Journey%20to%20a%20Highly%20Scalable%20Globally%20Distributed%20Cloud%20Service%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-394847%22%20slang%3D%22en-US%22%3E%3CP%3EOver%20the%20last%20couple%20months%20I%E2%80%99ve%20been%20writing%20about%20Intune%E2%80%99s%20journey%20to%20become%20a%20globally%20scaled%20cloud%20service%20running%20on%20Azure.%26nbsp%3B%20I%E2%80%99m%20treating%20this%20as%20Part%203%20(here%E2%80%99s%20%3CA%20href%3D%22https%3A%2F%2Fwww.microsoft.com%2Fen-us%2Fmicrosoft-365%2Fblog%2F2018%2F06%2F12%2Fhow-we-built-rebuilt-intune-into-a-leading-globally-scaled-cloud-service%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EPart%201%3C%2FA%3E%20and%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FEnterprise-Mobility-Security%2FIntune-s-journey-to-a-highly-scalable-globally-distributed-cloud%2Fba-p%2F289004%22%20target%3D%22_blank%22%20rel%3D%22noopener%22%3EPart%202%3C%2FA%3E)%20of%20a%204-part%20series.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EToday%2C%20I%E2%80%99ll%20explain%20how%20we%20were%20able%20to%20make%20such%20dramatic%20improvements%20to%20our%20%3CSTRONG%3ESLA%E2%80%99s%3C%2FSTRONG%3E%2C%20%3CSTRONG%3Escale%3C%2FSTRONG%3E%2C%20%3CSTRONG%3Eperformance%3C%2FSTRONG%3E%2C%20and%20engineering%20%3CSTRONG%3Eagility%3C%2FSTRONG%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20think%20the%20things%20we%20learned%20while%20doing%20this%20can%20apply%20to%20any%20engineering%20team%20building%20a%20cloud%20service.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FEnterprise-Mobility-Security%2FIntune-s-journey-to-a-highly-scalable-globally-distributed-cloud%2Fba-p%2F289004%22%20target%3D%22_blank%22%20rel%3D%22noopener%22%3ELast%20time%3C%2FA%3E%2C%20I%20noted%20the%20three%20major%20things%20we%20learned%20during%20the%20development%20process%3A%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3E%3CSTRONG%3EEvery%3C%2FSTRONG%3E%20data%20move%20that%20copies%20or%20moves%20data%20from%20one%20location%20to%20another%20%3CSTRONG%3Emust%3C%2FSTRONG%3E%20have%20data%20integrity%20checks%20to%20make%20sure%20that%20the%20copied%20data%20is%20consistent%20with%20the%20source%20data.%20%26nbsp%3BWe%20discovered%20that%20there%20are%20a%20variety%20of%20efficient%2Fintelligent%20ways%20to%20achieve%20this%20without%20requiring%20an%20excessive%20amount%20of%20time%20or%20memory.%26nbsp%3B%3C%2FLI%3E%0A%3CLI%3EIt%20is%20a%20%3CSTRONG%3Every%3C%2FSTRONG%3E%20bad%20idea%20to%20try%20building%20your%20own%20database%20for%20these%20purposes%20(No-SQL%20or%20SQL%2C%20etc)%2C%20unless%20you%20are%20already%20in%20the%20database%20business.%3C%2FLI%3E%0A%3CLI%3EIt%E2%80%99s%20far%20better%20to%20%3CSTRONG%3Eover-provision%3C%2FSTRONG%3E%20than%20%3CSTRONG%3Eover-optimize%3C%2FSTRONG%3E.%20%26nbsp%3BIn%20our%20case%2C%20because%20we%20set%20our%20orange%20line%20thresholds%20low%2C%20we%20had%20sufficient%20time%20to%20react%20and%20re-architect.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3EAfter%20we%20rolled%20out%20our%20new%20architecture%2C%20we%20focused%20on%20evolving%20and%20optimizing%20our%20services%2Fresources%20and%20improving%20agility.%20%26nbsp%3BWe%20came%20up%20with%204%20groups%20of%20goals%20to%20evolve%20quickly%20and%20at%20high%20quality%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EAvailability%2FSLAs%3C%2FLI%3E%0A%3CLI%3EScale%3C%2FLI%3E%0A%3CLI%3EPerformance%3C%2FLI%3E%0A%3CLI%3EEngineering%20agility%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EHere%E2%80%99s%20how%20we%20did%20it%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1681648973%22%20id%3D%22toc-hId-1701995199%22%20id%3D%22toc-hId-1701995199%22%3E%3CFONT%20size%3D%226%22%3E%231%3A%20Availability%2FSLAs%3C%2FFONT%3E%3C%2FH2%3E%0A%3CP%3EThe%20overarching%20goal%20we%20defined%20for%20availability%2FSLA%20(strictly%20speaking%2C%20SLO)%20was%20to%20achieve%20%3CSTRONG%3E4%2B%209%E2%80%99s%20for%20all%20our%20Intune%20services%3C%2FSTRONG%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EBefore%20we%20started%20the%20entire%20process%20describe%20by%20this%20blog%20series%2C%20less%20than%2025%25%20of%20our%20services%20were%20running%20at%204%2B%209%E2%80%99s%2C%20and%2090%25%20were%20running%20at%203%2B%209%E2%80%99s.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EClearly%20something%20needed%20to%20change.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFirst%2C%20a%20carefully%20selected%20group%20of%20engineers%20began%20a%20systematic%20review%20of%20where%20we%20needed%20to%20drive%20SLA%20improvements%20across%20the%20150%2B%20services.%20%26nbsp%3BBased%20on%20what%20we%20learned%20here%2C%20we%20saw%2C%20over%20the%20next%20six%20months%2C%20dramatic%20improvements.%20%26nbsp%3BThis%20review%20uncovered%20a%20variety%20of%20hidden%20issues%20and%20the%20fixes%20we%20rolled%20out%20made%20a%20huge%20difference.%26nbsp%3B%20Here%20are%20a%20few%20of%20the%20%3CSTRONG%3Ebig%3C%2FSTRONG%3E%20ones%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3ERetries%3A%3CBR%20%2F%3E%3C%2FSTRONG%3EOur%20infrastructure%20supported%20a%20rudimentary%20form%20of%20retries%20and%20it%20needed%20some%20additional%20technical%20sophistication%2C%20specifically%20in%20terms%20of%20customized%20request%20timeouts.%20Initially%2C%20there%20was%20no%20way%20to%20cancel%20a%20request%20if%20it%20took%20more%20than%20a%20specified%20set%20time%20for%20a%20specific%20service.%20This%20meant%20that%20a%20request%20could%20never%20really%20be%20retried%2C%20because%20if%20a%20timeout%20happened%2C%20it%20most%20likely%20exceeded%20the%20threshold%20for%20the%20end-end%20operation.%26nbsp%3B%20To%20address%20this%2C%20we%20added%20a%20request%20timeout%20feature%20that%20enabled%20services%20to%20specify%20custom%20limits%20on%20the%20maximum%20time%20a%20request%20can%20take%20before%20being%20canceled.%20This%20allowed%20services%20to%20specify%20appropriate%20time%20limits%20and%20give%20them%20several%20other%20retry%20semantics%20(such%20as%20backoffs%2C%20etc.)%20within%20the%20bounds%20of%20the%20overall%20end-end%20operation.%20This%20was%20a%20%3CSTRONG%3Ehuge%3C%2FSTRONG%3E%20improvement%20and%20it%20reduced%20our%20end-end%20timeouts%20by%20more%20than%20half.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3ECircuit%20breakers%3A%3CBR%20%2F%3E%3C%2FSTRONG%3EIt%20didn%E2%80%99t%20take%20long%20for%20us%20to%20realize%20that%20retries%20can%20cause%20a%20retry%20storm%20and%20result%20in%20timeouts%20becoming%20much%20worse.%20We%20added%20a%20circuit%20breaker%20pattern%20to%20handle%20this.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3ECaching%3A%3C%2FSTRONG%3E%3CBR%20%2F%3EWe%20started%20caching%20responses%20for%20repeated%20requests%20that%20matched%20the%20same%20criteria%20without%20breaking%20security%20boundaries.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EThreading%3A%3C%2FSTRONG%3E%3CBR%20%2F%3EDuring%20cold%20starts%20and%20request%20spikes%2C%20we%20noticed%20that%20the%20underlying%20framework%20(.NET)%20took%20time%20to%20spin%20off%20threads.%20To%20address%20this%2C%20we%20adjusted%20the%20minimum%20worker%20threads%20a%20service%20needs%20to%20maintain%20to%20account%20for%20these%20behaviors%20and%20made%20it%20configurable%20on%20a%20per-service%20basis.%20%26nbsp%3BThis%20almost%20eliminated%20all%20the%20timeouts%20that%20happened%20during%20these%20spikes%20and%2For%20cold%20starts.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EIntelligent%20routing%3A%3C%2FSTRONG%3E%3CBR%20%2F%3EThis%20was%20a%20learning%20algorithm%20that%20determined%20the%20target%20service%20that%20had%20the%20best%20chance%20to%20succeed%20the%20request.%20This%20kind%20of%20routing%20avoided%20a%20hung%20or%20slow%20node%2C%20a%20deadlocked%20process%2C%20a%20slow%20network%20VM%2C%20and%20any%20other%20random%20issues%20experienced%20by%20the%20services.%20%3CSTRONG%3EIn%20a%20distributed%20cloud%20service%20operating%20at%20scale%2C%20these%20kinds%20of%20underlying%20issues%20must%20be%20expected%20and%20are%20more%20of%20a%20norm%20than%20an%20exception%3C%2FSTRONG%3E.%20This%20ended%20up%20being%20a%20critical%20feature%20for%20us%20to%20design%20and%20implement%2C%20and%20it%20made%20a%20%3CSTRONG%3Ehuge%3C%2FSTRONG%3E%20difference%20across%20the%20board%2C%20especially%20when%20it%20came%20to%20reducing%20tail%20latencies.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3ECustomized%20configurations%3A%3C%2FSTRONG%3E%3CBR%20%2F%3EEach%20of%20our%20services%20had%20slightly%20different%20requirement%20or%20behavior%2C%20and%20it%20was%20important%20for%20us%20to%20provide%20knobs%20to%20customize%20certain%20settings%20for%20optimal%20behavior.%20Examples%20of%20such%20customized%20settings%20included%3A%20http%20server%20queue%20lengths%2C%20service%20point%20count%2C%20max%20pending%20accepts%2C%20etc.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EThe%20result%20of%20all%20the%20above%20efforts%20was%20%3CSTRONG%3Ephenomenal%3C%2FSTRONG%3E.%26nbsp%3B%20The%20chart%20below%20demonstrates%20this%20dramatic%20improvement%20after%20the%20changes%20were%20rolled%20out.%3C%2FP%3E%0A%3CP%3EYou%E2%80%99ll%20notice%20that%20we%20started%20with%20less%20than%20%3CSTRONG%3E25%25%3C%2FSTRONG%3E%20of%20services%20at%204%2B%209%E2%80%99s%2C%20and%20by%20the%20time%20we%20rolled%20out%20all%20the%20changes%2C%2095%25%20or%20more%20of%20our%20services%20were%20running%20at%204%2B%209%E2%80%99s!%20%26nbsp%3BToday%2C%20%3CSTRONG%3EIntune%20maintains%204%2B%209%E2%80%99s%20for%20over%2095%25%20of%20our%20services%20across%20all%20our%20clusters%20around%20the%20world%3C%2FSTRONG%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F101780i37CF3A4BEDCFD29B%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22aaa.png%22%20title%3D%22aaa.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--870507988%22%20id%3D%22toc-hId--850161762%22%20id%3D%22toc-hId--850161762%22%3E%3CFONT%20size%3D%226%22%3E%232%3A%20Scale%3C%2FFONT%3E%3C%2FH2%3E%0A%3CP%3EThe%20re-architecture%20process%20enabled%20us%20to%20primarily%20use%20scale%20out%20of%20the%20cluster%20to%20handle%20our%20growth.%20It%20was%20clear%20that%20the%20growth%20we%20were%20experiencing%20required%20us%20to%20additionally%20optimize%20in%20scale-up%20improvements.%20%26nbsp%3BThe%20biggest%20workload%20for%20Intune%20is%20triggered%20when%20a%20device%20checks-in%20to%20the%20service%20in%20order%20to%20receive%20policies%2C%20settings%2C%20apps%2C%20etc.%20%E2%80%93%20and%20we%20chose%20this%20workload%20as%20our%20first%20target.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20scale%20target%20goal%20we%20set%20was%20%3CSTRONG%3E50k%20devices%3C%2FSTRONG%3E%20checking%20in%20within%20a%20short%20period%20(approximately%2010%20minutes)%20for%20a%20given%20cluster.%20%26nbsp%3BFor%20reference%2C%20at%20the%20time%20we%20set%20this%20goal%2C%20our%20scale%20was%20at%20%3CSTRONG%3E3k%20devices%3C%2FSTRONG%3E%20in%20a%2010-minute%20window%20for%20an%20individual%20cluster%20%E2%80%93%20in%20other%20words%20our%20scale%20had%20to%20increase%20by%20about%20%3CSTRONG%3E17x%3C%2FSTRONG%3E.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAs%20with%20the%20SLA%20work%20we%20did%2C%20a%20group%20of%20engineers%20pursued%20this%20effort%20and%20acted%20as%20a%20single%20unit%20to%20tackle%20the%20problem.%20%26nbsp%3BSome%20of%20the%20issues%20they%20identified%20and%20improved%20included%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3EBatching%3A%3CBR%20%2F%3E%3C%2FSTRONG%3ESome%20of%20the%20calls%20were%20made%20in%20a%20sequential%20manner%20and%20we%20identified%20a%20way%20for%20these%20calls%20to%20be%20batched%20together%20and%20sent%20in%20one%20request.%20This%20avoided%20multiple%20round%20trips%20and%20serialization%2Fdeserialization%20costs.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EService%20Instance%20Count%3A%3C%2FSTRONG%3E%3CBR%20%2F%3ESome%20of%20the%20critical%20services%20in%20our%20cluster%20were%20running%20with%20an%20instance%20count.%20We%20realized%20that%20these%20were%20the%20first%20bottlenecks%20that%20prevented%20us%20from%20scaling%20up.%20%26nbsp%3BBy%20simply%20increasing%20the%20instance%20count%20of%20the%20services%20without%20changing%20the%20node%20or%20cluster%20sizes%20we%20completely%20eliminated%20these%20bottlenecks.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3ECaching%3A%3C%2FSTRONG%3E%3CBR%20%2F%3ESome%20of%20the%20properties%20in%20an%20account%2Ftenant%20or%20user%20were%20frequently%20accessed.%20These%20properties%20were%20accessed%20by%20various%20different%20calls%20to%20the%20service(s)%20which%20held%20this%20data.%20We%20realized%20that%20we%20can%20cache%20these%20properties%20in%20the%20token%20that%20a%20request%20carried.%20%26nbsp%3BThis%20eliminated%20the%20need%20for%20many%20calls%20to%20other%20services%20and%20the%20latencies%20or%20resource%20consumptions%20associated%20with%20them.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EReduce%20Calls%3A%3CBR%20%2F%3E%3C%2FSTRONG%3EWe%20developed%20several%20ways%20to%20reduce%20calls%20from%20one%20service%20to%20another.%20For%20example%2C%20we%20used%20a%20Bloom%20Filter%20to%20determine%20if%20a%20change%20happened%2C%20and%20then%20we%20used%20that%20information%20to%20reduce%20a%20load%20of%20about%20%3CSTRONG%3E1%20million%3C%2FSTRONG%3E%20calls%20to%20approximately%20%3CSTRONG%3E10k%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3ELeverage%20SLA%20improvements%3A%3C%2FSTRONG%3E%3CBR%20%2F%3EWe%20leveraged%20many%20of%20the%20improvements%20called%20out%20in%20the%20SLA%20section%20above%2C%20even%20though%20both%20efforts%20were%20operating%20(more%20or%20less)%20in%20parallel%20at%20the%20time.%20We%20also%20leveraged%20the%20customized%20configurations%20to%20experiment%2C%20learn%2C%20and%20test.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EBy%20the%20end%20of%20this%20exercise%2C%20we%20were%20%3CSTRONG%3Esuccessfully%3C%2FSTRONG%3E%20able%20to%20increase%20the%20scale%20from%203k%20devices%20checking-in%20to%20%3CSTRONG%3E70k%2B%20device%20check-ins%3C%2FSTRONG%3E%20%E2%80%93%20an%20increase%20of%20more%20than%20%3CSTRONG%3E23x%3C%2FSTRONG%3E%20--%20and%20we%20did%20this%20%3CSTRONG%3Ewithout%3C%2FSTRONG%3E%20scaling%20out%20the%20cluster!%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-872302347%22%20id%3D%22toc-hId-892648573%22%20id%3D%22toc-hId-892648573%22%3E%3CFONT%20size%3D%226%22%3E%233%3A%20Performance%3C%2FFONT%3E%3C%2FH2%3E%0A%3CP%3EOur%20goal%20for%20performance%20had%20a%20very%20specific%20target%3A%26nbsp%3B%20%3CSTRONG%3ECulture%20change%3C%2FSTRONG%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWe%20wanted%20to%20ensure%20that%20our%20performance%20was%20continuously%20evaluated%20in%20production%20and%20we%20wanted%20to%20be%20able%20to%20catch%20performance%20regressions%20before%20releasing%20to%20production.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETo%20do%20this%2C%20we%20first%20used%20Azure%20profiler%20and%20associated%20flame%20graphs%20to%20perform%20continuous%20profiling%20in%20production.%20%26nbsp%3BThis%20process%20showed%20our%20engineers%20how%20to%20drive%20several%20key%20improvements%2C%20and%20subsequently%2C%20it%20became%20a%20powerful%20daily%20tool%20for%20the%20engineers%20to%20determine%20bottlenecks%20in%20code%2C%20inefficiencies%2C%20high%20CPU%20usage%2C%20etc.%20%26nbsp%3BSome%20of%20the%20improvements%20identified%20by%20the%20engineering%20team%20as%20a%20result%20of%20this%20continuous%20profiling%20include%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3EBlocking%20Calls%3A%3C%2FSTRONG%3E%3CBR%20%2F%3ESome%20of%20the%20calls%20made%20from%20one%20service%20to%20another%20were%20incorrectly%20blocking%20instead%20of%20following%20async%20patterns.%20%26nbsp%3BWe%20fixed%20this%20by%20removing%20the%20blocking%20calls%20and%20making%20it%20asynchronous.%20They%20resulted%20in%20reduced%20timeouts%20and%20thread%20pool%20exhaustions.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3ELocking%3A%3C%2FSTRONG%3E%3CBR%20%2F%3EAnother%20pattern%20we%20noticed%20using%20the%20profiler%20was%20lock%20contention%20between%20threads.%20%26nbsp%3BWe%20were%20clearly%20able%20to%20examine%20these%20via%20code%20that%20used%20the%20profiler%E2%80%99s%20call%20stacks%20to%20fix%20the%20bugs%20and%20remove%20the%20associated%20latencies.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EHigh%20CPU%3A%3C%2FSTRONG%3E%3CBR%20%2F%3EThere%20were%20numerous%20instances%20where%20we%20were%20easily%20able%20to%20catch%20high%20CPU%20situations%20using%20the%20profiles%20and%20quickly%20determine%20root%20causes%20and%20fixes.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3ETail%20latency%3A%3C%2FSTRONG%3E%3CBR%20%2F%3EWhile%20investigating%20certain%20latencies%20associated%20with%20devices%20checking%20in%20or%20our%20portal%20flows%2C%20we%20noticed%20that%20some%20of%20the%20search%20requests%20were%20being%20sent%20across%20to%20all%20the%20partitions%20of%20a%20service.%20In%20many%20cases%2C%20there%20is%20just%20one%20partition%20that%20holds%20this%20data%20and%20the%20search%20can%20be%20performed%20against%20that%20single%20partition%20instead%20of%20fanning%20out%20across%20all%20of%20them.%20%26nbsp%3BWe%20successfully%20made%20optimizations%20to%20do%20a%20search%20directly%20against%20the%20partition%20that%20held%20the%20data%20%E2%80%93%20and%20the%20result%20was%20%3CSTRONG%3Ea%20drop%20in%20latency%20from%20200%20msec%20to%20less%20than%2015%20msec%3C%2FSTRONG%3E%20(see%20chart%20below).%20%26nbsp%3BThe%20end%20result%20was%20improved%20response%20times%20in%20devices%20checking%20in%20and%20faster%20data%20retrievals%20in%20our%20ITPro%20portal.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F101781iC80F02D3188A63D0%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22bbb.jpg%22%20title%3D%22bbb.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOur%20next%20action%20was%20to%20start%20a%20benchmark%20service%20that%20consistently%20and%20constantly%20ran%20high-traffic%20in%20our%20pre-production%20environments.%26nbsp%3B%20Our%20goal%20here%20was%20to%20catch%20performance%20regressions.%26nbsp%3B%20We%20also%20began%20running%20a%20consistent%20traffic%20load%20(that%20is%20equivalent%20to%20production%20loads)%20across%20all%20services%20in%20our%20pre-production%20environments.%20%26nbsp%3BWe%20made%20a%20practice%20of%20considering%20a%20drop%20in%20our%20pre-production%20environment%20as%20a%20major%20blocker%20for%20production%20releases.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ETogether%3C%2FSTRONG%3E%2C%20both%20of%20these%20actions%20become%20a%20norm%20in%20the%20engineering%20organization%2C%20and%20we%20are%20proud%20of%20this%20positive%20culture%20change%20in%20meeting%20the%20performance%20goal.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--1679854614%22%20id%3D%22toc-hId--1659508388%22%20id%3D%22toc-hId--1659508388%22%3E%3CFONT%20size%3D%226%22%3E%234%3A%20Engineering%20Agility%3C%2FFONT%3E%3C%2FH2%3E%0A%3CP%3EAs%20called%20out%20in%20the%20%3CA%20href%3D%22https%3A%2F%2Fwww.microsoft.com%2Fen-us%2Fmicrosoft-365%2Fblog%2F2018%2F06%2F12%2Fhow-we-built-rebuilt-intune-into-a-leading-globally-scaled-cloud-service%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Efirst%20post%20in%20this%20series%3C%2FA%3E%2C%20Intune%20is%20composed%20of%20many%20independent%20and%20decoupled%20Service%20Fabric%20services.%20The%20development%20and%20deployment%20of%20these%20services%2C%20however%2C%20are%20genuinely%20monolithic%20in%20nature.%26nbsp%3B%20They%20deploy%20as%20a%20single%20unit%2C%20and%20all%20services%20are%20developed%20in%20a%20single%20large%20repo%20%E2%80%93%20essentially%2C%20a%20monolith.%26nbsp%3B%20This%20setup%20was%20an%20intentional%20decision%20when%20we%20started%20our%20modern%20service%20journey%20because%20a%20large%20portion%20of%20the%20team%20was%20focusing%20on%20the%20re-architecture%20effort%20and%20our%20cloud%20engineering%20maturity%20was%20not%20yet%20fully%20realized.%26nbsp%3B%20For%20these%20reasons%20we%20chose%20simplicity%20over%20agility.%26nbsp%3B%20As%20we%20dramatically%20developed%20the%20feature%20investments%20we%20were%20making%20(both%20in%20terms%20of%20the%20number%20of%20features%20and%20the%20number%20of%20engineers%20working%20them)%2C%20we%20started%20experiencing%20agility%20issues.%26nbsp%3B%20The%20solution%20was%20decoupling%20the%20services%20in%20the%20monolith%20from%20development%2C%20deployment%2C%20and%20maintenance%20perspectives.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETo%20do%20this%20we%20set%20three%20primary%20goals%20for%20improving%20agility%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EBuilding%20a%20service%20should%20complete%20within%20minutes%20(this%20was%20down%20from%207%2B%20hrs)%3C%2FLI%3E%0A%3CLI%3EPull%20requests%20should%20complete%20in%20minutes%20(down%20from%201%2B%20day)%3C%2FLI%3E%0A%3CLI%3EDeployments%20to%20our%20pre-prod%20environments%20should%20occur%20several%20times%20per%20day%20(down%20from%20once%20or%20twice%20per%20week)%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAs%20indicated%20above%2C%20our%20agility%20was%20initially%20hurting%20us%20when%20it%20came%20to%20rapidly%20delivering%20features.%20%26nbsp%3BPull%20requests%20(PR)%20would%20sometimes%20take%20days%20to%20complete%20due%20to%20the%20aforementioned%20monolithic%20nature%20of%20the%20build%20environments%20%E2%80%93%20this%20meant%20that%20any%20change%20anywhere%20by%20anyone%20in%20Intune%20would%20impact%20everyone%E2%80%99s%20PR.%20%26nbsp%3BOn%20any%20given%20day%2C%20the%20churn%20was%20so%20high%20that%20it%20was%20extremely%20hard%20to%20get%20stable%20builds%20and%20fast%20builds%20or%20PRs.%20%26nbsp%3BThis%2C%20in%20turn%2C%20impacted%20our%20ability%20to%20deploy%20this%20massive%20build%20to%20our%20internal%20dogfood%20environments.%20%26nbsp%3BIn%20the%20best%20case%2C%20we%20were%20able%20to%20deploy%20once%20or%20twice%20per%20week.%26nbsp%3B%20This%2C%20obviously%2C%20was%20not%20something%20we%20wanted%20to%20sustain.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWe%20made%20an%20investment%20in%20developing%20and%20decoupling%20the%20monolithic%20services%20and%20improve%20our%20agility.%20%26nbsp%3BOver%20a%20period%20of%202%2B%20years%2C%20we%20invested%20two%20major%20improvements%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3E%26nbsp%3B%3C%2FSTRONG%3E%3CSTRONG%3EMove%20to%20individual%20GIT%20repos%3A%3CBR%20%2F%3E%3C%2FSTRONG%3EServices%20moved%20from%20a%20proprietary%20source%20depot%20monolith%20branch%20to%20their%20own%20individual%20GIT%20repos.%20This%20decoupled%20development%2C%20PRs%2C%20unit%20and%20component%20tests%2C%20and%20builds.%20%26nbsp%3BThe%20change%20resulted%20in%20build%20times%20getting%20completed%20in%20around%20%3CSTRONG%3E30%20minutes%3C%2FSTRONG%3E%20%E2%80%93%20a%20huge%20difference%20from%20the%20previous%20%3CSTRONG%3E7-8%20hours%3C%2FSTRONG%3E%20or%20more.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3ECarve%20out%20of%20Micro%20Services%20from%20Monolith%3A%3CBR%20%2F%3E%3C%2FSTRONG%3EServices%20were%20carved%20out%20of%20the%20Service%20Fabric%20application%20and%20packaged%20into%20their%20own%20application%2C%20and%20they%20were%20turned%20into%20their%20own%20independent%20deployable%20unit.%20We%20referred%20to%20such%20an%20application%20as%20a%20%3CSTRONG%3Emicro%20service%3C%2FSTRONG%3E.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAs%20this%20investment%20progressed%20and%20evolved%2C%20we%20started%20seeing%20huge%20benefits.%20The%20following%20demonstrate%20some%20of%20these%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3EBuild%2FPR%20Times%3C%2FSTRONG%3E%3A%3CBR%20%2F%3EFor%20microservices%2C%20we%20reduced%20the%20time%20that%20a%20service%20typically%20completes%20a%20build%20to%20within%2030%20minutes%20from%20the%20previous%207%2B%20hours.%20Similarly%2C%20the%20monolith%20saw%20an%20improvement%20to%202-3%20hours%20from%20the%207%20hours.%20A%20similar%20improvement%20happened%20in%20PR%20times%20as%20well%2C%20to%20a%20few%20minutes%20for%20micro%20services%20(from%201%2B%20day).%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EDeployments%20to%20Pre-prod%20Dogfood%20Environments%3A%3CBR%20%2F%3E%3C%2FSTRONG%3EWith%20the%20monolith%2C%20successful%20deployments%20to%20pre-production%20dogfood%20environments%20would%20take%20us%20minimum%20of%201%20day%20and%2C%20in%20some%20extreme%20cases%2C%20up%20to%20a%20week.%20With%20the%20investments%20above%2C%20we%20are%20now%20able%20to%20complete%20several%20deployments%20per%20day%20across%20the%20monolith%20and%20micro%20services.%20%26nbsp%3BThis%20is%20primarily%20because%20of%20faster%20deployment%20times%20(due%20to%20the%20parallel%20deployments%20of%20micro%20services)%20and%20the%20number%2Fvolume%20of%20services%20that%20have%20been%20removed%20from%20the%20monolith%20into%20their%20own%20micro%20services.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20chart%20below%20demonstrates%20one%20such%20an%20example.%26nbsp%3B%20The%20black%20line%20shows%20that%20we%20went%20from%20single%20digits%20to%201000%E2%80%99s%20of%20deployments%20per%20month%20in%20production%20environments.%20%26nbsp%3BIn%20pre-production%20dogfood%20environments%2C%20this%20was%20even%20higher%20%E2%80%93%20typically%20reaching%2010%E2%80%99s%20of%20deployments%20per%20day%20across%20all%20the%20services%20in%20a%20single%20cluster.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20816px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F101782i91AAD1C41E775FEA%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22ccc.png%22%20title%3D%22ccc.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%226%22%3E%3CSTRONG%3EChallenges%3C%2FSTRONG%3E%3A%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3EToday%2C%20Intune%20is%20part%20monolith%20and%20part%20micro%20services.%20%26nbsp%3BEventually%2C%20we%20expect%20to%20compose%2040-50%20micro%20services%20from%20the%20existing%20monolith.%20%26nbsp%3BThere%20are%20challenges%20in%20managing%20micro%20services%20due%20to%20the%20way%20they%20are%20independently%20created%20and%20managed%20and%20we%20are%20developing%20tooling%20to%20address%20some%20of%20the%20micro%20service%20management%20issues.%20%26nbsp%3BFor%20example%2C%20binary%20dependencies%20between%20micro%20services%20is%20an%20issue%20because%20of%20versioning%20issues.%20%26nbsp%3BTo%20address%20this%2C%20we%20developed%20a%20dependency%20tool%20to%20identify%20conflicting%20or%20missing%20binary%20dependencies%20between%20micro%20services.%20%26nbsp%3BAutomation%20is%20also%20important%20if%20a%20critical%20fix%20needs%20to%20be%20rolled%20out%20across%20all%20micro%20services%20in%20order%20to%20mitigate%20a%20common%20library%20issue.%26nbsp%3B%20Without%20proper%20tooling%2C%20it%20can%20also%20be%20very%20hard%20and%20time%20consuming%20to%20propagate%20the%20fix%20to%20all%20micro%20services.%20%26nbsp%3BSimilarly%2C%20we%20are%20developing%20tooling%20to%20determine%20all%20the%20resources%20required%20by%20a%20micro%20service%2C%20as%20well%20as%20all%20the%20resource%20management%20aspects%2C%20such%20as%20key%20rotation%2C%20expiration%2C%20etc.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH1%20id%3D%22toc-hId-259469226%22%20id%3D%22toc-hId-279815452%22%20id%3D%22toc-hId-279815452%22%3E%3CFONT%20size%3D%226%22%3ELearnings%3C%2FFONT%3E%3C%2FH1%3E%0A%3CP%3EThere%20were%203%20learnings%20from%20this%20experience%20that%20are%20applicable%20to%20any%20large-scale%20cloud%20service%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EIt%20is%20critically%20important%20to%20%3CSTRONG%3Eset%20realistic%20and%20achievable%20goals%3C%2FSTRONG%3E%20for%20SLA%20and%20scale%20%E2%80%93%20and%20then%20be%20persistent%20and%20diligent%20in%20driving%20towards%20achieving%20these%20goals.%20The%20best%20outcomes%20happen%20when%20a%20set%20of%20engineers%20from%20across%20the%20org%20work%20together%20as%20a%20unit%20towards%20a%20common%20goal.%20%26nbsp%3BOnce%20you%20have%20this%20in%20place%2C%20make%20incremental%20changes%3B%20the%20cumulative%20effect%20of%20all%20the%20small%20changes%20pays%20significant%20dividends%20over%20time.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EContinuous%20profiling%3C%2FSTRONG%3E%20is%20a%20critical%20element%20of%20cloud%20service%20performance.%20It%20helps%20in%20reducing%20resource%20consumption%2C%20tail%20latencies%2C%20and%20it%20indirectly%20benefits%20all%20runtime%20aspects%20of%20a%20service.%3C%2FLI%3E%0A%3CLI%3EMicro%20services%20help%20in%20improving%20agility.%20Proper%20tooling%20to%20handle%20patches%2C%20deployments%2C%20dependencies%2C%20and%20resource%20management%20are%20%3CSTRONG%3Ecritical%3C%2FSTRONG%3E%20to%20deploy%20and%20operate%20micro%20services%20in%20a%20high-scale%20distributed%20cloud%20service.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH1%20id%3D%22toc-hId-2002279561%22%20id%3D%22toc-hId-2022625787%22%20id%3D%22toc-hId-2022625787%22%3E%3CFONT%20size%3D%226%22%3EConclusion%3C%2FFONT%3E%3C%2FH1%3E%0A%3CP%3EThe%20improvements%20that%20came%20about%20from%20this%20stage%20of%20our%20cloud%20journey%20have%20been%20incredibly%20encouraging%2C%20and%20we%20are%20proud%20of%20operating%20our%20services%20with%20high%20SLA%20and%20performance%20while%20also%20rapidly%20increasing%20the%20scale%20of%20our%20traffic%20and%20services.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20next%20stage%20of%20our%20evolution%20will%20be%20covered%20in%20Part-4%20of%20this%20series%3A%26nbsp%3B%20A%20look%20at%20our%20efforts%20to%20make%20the%20Intune%20service%20even%20more%20reliable%20and%20efficient%20by%20ensuring%20that%20the%20rollout%20of%20new%20features%20produce%20minimal-to-no%20impact%20to%20existing%20feature%20usage%20by%20customers%20%E2%80%93%20all%20while%20continuing%20to%20improve%20our%20engineering%20agility.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-394847%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EEnterprise%20Mobility%20%2B%20Security%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMicrosoft%20Intune%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMobile%20Device%20and%20App%20Management%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EModern%20Desktop%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EUnified%20Endpoint%20Management%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-401315%22%20slang%3D%22en-US%22%3ERe%3A%20Part%203%3A%20Intune%E2%80%99s%20Journey%20to%20a%20Highly%20Scalable%20Globally%20Distributed%20Cloud%20Service%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-401315%22%20slang%3D%22en-US%22%3E%3CP%3EThis%20is%20truly%20inspiring%20stuff%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-401239%22%20slang%3D%22en-US%22%3ERe%3A%20Part%203%3A%20Intune%E2%80%99s%20Journey%20to%20a%20Highly%20Scalable%20Globally%20Distributed%20Cloud%20Service%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-401239%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%20for%20providing%20this%20helpful%20insight.%20Interested%20to%20read%20about%20monitoring%20options%20to%20be%20alerted%20of%20incidents%20impacting%20the%20service%20or%20our%20tenant.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-400545%22%20slang%3D%22en-US%22%3ERe%3A%20Part%203%3A%20Intune%E2%80%99s%20Journey%20to%20a%20Highly%20Scalable%20Globally%20Distributed%20Cloud%20Service%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-400545%22%20slang%3D%22en-US%22%3E%3CP%3EImprovements%20in%20building%20and%20PRs%20are%20impressive%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-449868%22%20slang%3D%22en-US%22%3ERe%3A%20Part%203%3A%20Intune%E2%80%99s%20Journey%20to%20a%20Highly%20Scalable%20Globally%20Distributed%20Cloud%20Service%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-449868%22%20slang%3D%22en-US%22%3E%3CP%3EGood%20stuff%3C%2FP%3E%3C%2FLINGO-BODY%3E
Microsoft

Over the last couple months I’ve been writing about Intune’s journey to become a globally scaled cloud service running on Azure.  I’m treating this as Part 3 (here’s Part 1 and Part 2) of a 4-part series.

 

Today, I’ll explain how we were able to make such dramatic improvements to our SLA’s, scale, performance, and engineering agility.

 

I think the things we learned while doing this can apply to any engineering team building a cloud service.

 

Last time, I noted the three major things we learned during the development process:

  1. Every data move that copies or moves data from one location to another must have data integrity checks to make sure that the copied data is consistent with the source data.  We discovered that there are a variety of efficient/intelligent ways to achieve this without requiring an excessive amount of time or memory. 
  2. It is a very bad idea to try building your own database for these purposes (No-SQL or SQL, etc), unless you are already in the database business.
  3. It’s far better to over-provision than over-optimize.  In our case, because we set our orange line thresholds low, we had sufficient time to react and re-architect.

After we rolled out our new architecture, we focused on evolving and optimizing our services/resources and improving agility.  We came up with 4 groups of goals to evolve quickly and at high quality:

  • Availability/SLAs
  • Scale
  • Performance
  • Engineering agility

Here’s how we did it:

 

#1: Availability/SLAs

The overarching goal we defined for availability/SLA (strictly speaking, SLO) was to achieve 4+ 9’s for all our Intune services.

 

Before we started the entire process describe by this blog series, less than 25% of our services were running at 4+ 9’s, and 90% were running at 3+ 9’s.

 

Clearly something needed to change.

 

First, a carefully selected group of engineers began a systematic review of where we needed to drive SLA improvements across the 150+ services.  Based on what we learned here, we saw, over the next six months, dramatic improvements.  This review uncovered a variety of hidden issues and the fixes we rolled out made a huge difference.  Here are a few of the big ones:

  • Retries:
    Our infrastructure supported a rudimentary form of retries and it needed some additional technical sophistication, specifically in terms of customized request timeouts. Initially, there was no way to cancel a request if it took more than a specified set time for a specific service. This meant that a request could never really be retried, because if a timeout happened, it most likely exceeded the threshold for the end-end operation.  To address this, we added a request timeout feature that enabled services to specify custom limits on the maximum time a request can take before being canceled. This allowed services to specify appropriate time limits and give them several other retry semantics (such as backoffs, etc.) within the bounds of the overall end-end operation. This was a huge improvement and it reduced our end-end timeouts by more than half.
  • Circuit breakers:
    It didn’t take long for us to realize that retries can cause a retry storm and result in timeouts becoming much worse. We added a circuit breaker pattern to handle this.
  • Caching:
    We started caching responses for repeated requests that matched the same criteria without breaking security boundaries.
  • Threading:
    During cold starts and request spikes, we noticed that the underlying framework (.NET) took time to spin off threads. To address this, we adjusted the minimum worker threads a service needs to maintain to account for these behaviors and made it configurable on a per-service basis.  This almost eliminated all the timeouts that happened during these spikes and/or cold starts.
  • Intelligent routing:
    This was a learning algorithm that determined the target service that had the best chance to succeed the request. This kind of routing avoided a hung or slow node, a deadlocked process, a slow network VM, and any other random issues experienced by the services. In a distributed cloud service operating at scale, these kinds of underlying issues must be expected and are more of a norm than an exception. This ended up being a critical feature for us to design and implement, and it made a huge difference across the board, especially when it came to reducing tail latencies.
  • Customized configurations:
    Each of our services had slightly different requirement or behavior, and it was important for us to provide knobs to customize certain settings for optimal behavior. Examples of such customized settings included: http server queue lengths, service point count, max pending accepts, etc.

The result of all the above efforts was phenomenal.  The chart below demonstrates this dramatic improvement after the changes were rolled out.

You’ll notice that we started with less than 25% of services at 4+ 9’s, and by the time we rolled out all the changes, 95% or more of our services were running at 4+ 9’s!  Today, Intune maintains 4+ 9’s for over 95% of our services across all our clusters around the world.

 

aaa.png

 

#2: Scale

The re-architecture process enabled us to primarily use scale out of the cluster to handle our growth. It was clear that the growth we were experiencing required us to additionally optimize in scale-up improvements.  The biggest workload for Intune is triggered when a device checks-in to the service in order to receive policies, settings, apps, etc. – and we chose this workload as our first target.

 

The scale target goal we set was 50k devices checking in within a short period (approximately 10 minutes) for a given cluster.  For reference, at the time we set this goal, our scale was at 3k devices in a 10-minute window for an individual cluster – in other words our scale had to increase by about 17x

 

As with the SLA work we did, a group of engineers pursued this effort and acted as a single unit to tackle the problem.  Some of the issues they identified and improved included:

  • Batching:
    Some of the calls were made in a sequential manner and we identified a way for these calls to be batched together and sent in one request. This avoided multiple round trips and serialization/deserialization costs.
  • Service Instance Count:
    Some of the critical services in our cluster were running with an instance count. We realized that these were the first bottlenecks that prevented us from scaling up.  By simply increasing the instance count of the services without changing the node or cluster sizes we completely eliminated these bottlenecks.
  • Caching:
    Some of the properties in an account/tenant or user were frequently accessed. These properties were accessed by various different calls to the service(s) which held this data. We realized that we can cache these properties in the token that a request carried.  This eliminated the need for many calls to other services and the latencies or resource consumptions associated with them.
  • Reduce Calls:
    We developed several ways to reduce calls from one service to another. For example, we used a Bloom Filter to determine if a change happened, and then we used that information to reduce a load of about 1 million calls to approximately 10k
  • Leverage SLA improvements:
    We leveraged many of the improvements called out in the SLA section above, even though both efforts were operating (more or less) in parallel at the time. We also leveraged the customized configurations to experiment, learn, and test.

 

By the end of this exercise, we were successfully able to increase the scale from 3k devices checking-in to 70k+ device check-ins – an increase of more than 23x -- and we did this without scaling out the cluster!

 

#3: Performance

Our goal for performance had a very specific target:  Culture change.

 

We wanted to ensure that our performance was continuously evaluated in production and we wanted to be able to catch performance regressions before releasing to production.

 

To do this, we first used Azure profiler and associated flame graphs to perform continuous profiling in production.  This process showed our engineers how to drive several key improvements, and subsequently, it became a powerful daily tool for the engineers to determine bottlenecks in code, inefficiencies, high CPU usage, etc.  Some of the improvements identified by the engineering team as a result of this continuous profiling include:

  • Blocking Calls:
    Some of the calls made from one service to another were incorrectly blocking instead of following async patterns.  We fixed this by removing the blocking calls and making it asynchronous. They resulted in reduced timeouts and thread pool exhaustions.
  • Locking:
    Another pattern we noticed using the profiler was lock contention between threads.  We were clearly able to examine these via code that used the profiler’s call stacks to fix the bugs and remove the associated latencies.
  • High CPU:
    There were numerous instances where we were easily able to catch high CPU situations using the profiles and quickly determine root causes and fixes.
  • Tail latency:
    While investigating certain latencies associated with devices checking in or our portal flows, we noticed that some of the search requests were being sent across to all the partitions of a service. In many cases, there is just one partition that holds this data and the search can be performed against that single partition instead of fanning out across all of them.  We successfully made optimizations to do a search directly against the partition that held the data – and the result was a drop in latency from 200 msec to less than 15 msec (see chart below).  The end result was improved response times in devices checking in and faster data retrievals in our ITPro portal.

bbb.jpg

 

Our next action was to start a benchmark service that consistently and constantly ran high-traffic in our pre-production environments.  Our goal here was to catch performance regressions.  We also began running a consistent traffic load (that is equivalent to production loads) across all services in our pre-production environments.  We made a practice of considering a drop in our pre-production environment as a major blocker for production releases.

 

Together, both of these actions become a norm in the engineering organization, and we are proud of this positive culture change in meeting the performance goal.

 

#4: Engineering Agility

As called out in the first post in this series, Intune is composed of many independent and decoupled Service Fabric services. The development and deployment of these services, however, are genuinely monolithic in nature.  They deploy as a single unit, and all services are developed in a single large repo – essentially, a monolith.  This setup was an intentional decision when we started our modern service journey because a large portion of the team was focusing on the re-architecture effort and our cloud engineering maturity was not yet fully realized.  For these reasons we chose simplicity over agility.  As we dramatically developed the feature investments we were making (both in terms of the number of features and the number of engineers working them), we started experiencing agility issues.  The solution was decoupling the services in the monolith from development, deployment, and maintenance perspectives.

 

To do this we set three primary goals for improving agility:

  • Building a service should complete within minutes (this was down from 7+ hrs)
  • Pull requests should complete in minutes (down from 1+ day)
  • Deployments to our pre-prod environments should occur several times per day (down from once or twice per week)

 

As indicated above, our agility was initially hurting us when it came to rapidly delivering features.  Pull requests (PR) would sometimes take days to complete due to the aforementioned monolithic nature of the build environments – this meant that any change anywhere by anyone in Intune would impact everyone’s PR.  On any given day, the churn was so high that it was extremely hard to get stable builds and fast builds or PRs.  This, in turn, impacted our ability to deploy this massive build to our internal dogfood environments.  In the best case, we were able to deploy once or twice per week.  This, obviously, was not something we wanted to sustain.

 

We made an investment in developing and decoupling the monolithic services and improve our agility.  Over a period of 2+ years, we invested two major improvements:

  •  Move to individual GIT repos:
    Services moved from a proprietary source depot monolith branch to their own individual GIT repos. This decoupled development, PRs, unit and component tests, and builds.  The change resulted in build times getting completed in around 30 minutes – a huge difference from the previous 7-8 hours or more.
  • Carve out of Micro Services from Monolith:
    Services were carved out of the Service Fabric application and packaged into their own application, and they were turned into their own independent deployable unit. We referred to such an application as a micro service.

 

As this investment progressed and evolved, we started seeing huge benefits. The following demonstrate some of these:

  • Build/PR Times:
    For microservices, we reduced the time that a service typically completes a build to within 30 minutes from the previous 7+ hours. Similarly, the monolith saw an improvement to 2-3 hours from the 7 hours. A similar improvement happened in PR times as well, to a few minutes for micro services (from 1+ day).
  • Deployments to Pre-prod Dogfood Environments:
    With the monolith, successful deployments to pre-production dogfood environments would take us minimum of 1 day and, in some extreme cases, up to a week. With the investments above, we are now able to complete several deployments per day across the monolith and micro services.  This is primarily because of faster deployment times (due to the parallel deployments of micro services) and the number/volume of services that have been removed from the monolith into their own micro services.

 

The chart below demonstrates one such an example.  The black line shows that we went from single digits to 1000’s of deployments per month in production environments.  In pre-production dogfood environments, this was even higher – typically reaching 10’s of deployments per day across all the services in a single cluster.

 

ccc.png

 

Challenges:

Today, Intune is part monolith and part micro services.  Eventually, we expect to compose 40-50 micro services from the existing monolith.  There are challenges in managing micro services due to the way they are independently created and managed and we are developing tooling to address some of the micro service management issues.  For example, binary dependencies between micro services is an issue because of versioning issues.  To address this, we developed a dependency tool to identify conflicting or missing binary dependencies between micro services.  Automation is also important if a critical fix needs to be rolled out across all micro services in order to mitigate a common library issue.  Without proper tooling, it can also be very hard and time consuming to propagate the fix to all micro services.  Similarly, we are developing tooling to determine all the resources required by a micro service, as well as all the resource management aspects, such as key rotation, expiration, etc.

 

Learnings

There were 3 learnings from this experience that are applicable to any large-scale cloud service:

 

  1. It is critically important to set realistic and achievable goals for SLA and scale – and then be persistent and diligent in driving towards achieving these goals. The best outcomes happen when a set of engineers from across the org work together as a unit towards a common goal.  Once you have this in place, make incremental changes; the cumulative effect of all the small changes pays significant dividends over time.
  2. Continuous profiling is a critical element of cloud service performance. It helps in reducing resource consumption, tail latencies, and it indirectly benefits all runtime aspects of a service.
  3. Micro services help in improving agility. Proper tooling to handle patches, deployments, dependencies, and resource management are critical to deploy and operate micro services in a high-scale distributed cloud service.

 

Conclusion

The improvements that came about from this stage of our cloud journey have been incredibly encouraging, and we are proud of operating our services with high SLA and performance while also rapidly increasing the scale of our traffic and services.

 

The next stage of our evolution will be covered in Part-4 of this series:  A look at our efforts to make the Intune service even more reliable and efficient by ensuring that the rollout of new features produce minimal-to-no impact to existing feature usage by customers – all while continuing to improve our engineering agility.

4 Comments
Super Contributor

Improvements in building and PRs are impressive

Occasional Visitor

Thanks for providing this helpful insight. Interested to read about monitoring options to be alerted of incidents impacting the service or our tenant. 

Occasional Visitor

This is truly inspiring stuff

Contributor

Good stuff