Home
%3CLINGO-SUB%20id%3D%22lingo-sub-693710%22%20slang%3D%22en-US%22%3EDirect%20Server%20Return%20(DSR)%20in%20a%20nutshell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-693710%22%20slang%3D%22en-US%22%3E%3CDIV%20class%3D%22lia-message-subject-wrapper%20lia-component-subject%20lia-component-message-view-widget-subject-with-options%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CDIV%20class%3D%22lia-message-body-wrapper%20lia-component-message-view-widget-body%22%3E%0A%3CDIV%20id%3D%22bodyDisplay%22%20class%3D%22lia-message-body%22%3E%0A%3CDIV%20class%3D%22lia-message-body-content%22%3E%0A%3CP%3E%3CEM%3E%3CSTRONG%3ETL%3BDR%3B%3C%2FSTRONG%3E%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3E%3CEM%3EA%20question%20we%20get%20asked%20quite%20a%20bit%20is%3A%20%22What%20is%20Microsoft%20doing%20to%20improve%20Networking%20performance%3F%22%3C%2FEM%3E.%3C%2FP%3E%0A%3CP%3ETo%20answer%20that%20we%20have%20today%E2%80%99s%20blog%20post%2C%20which%20is%20about%20load%20balancing%20performance%20enhancements%20in%20SDN%20networks%20for%20Windows%20Containers%20and%20Kubernetes%20Networks%2C%20especially%20for%20services.%3C%2FP%3E%0A%3CP%3EOne%20of%20these%20enhancements%20is%20Direct%20Server%20Return%20(DSR)%20routing%20for%20overlay%20and%20l2bridge%20networks.%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1767504680%22%20id%3D%22toc-hId-1787913527%22%20id%3D%22toc-hId-1787913527%22%3EWhat%20it%20is%3C%2FH2%3E%0A%3CP%3EDSR%20is%20an%20implementation%20of%20asymmetric%20network%20load%20distribution%20in%20load%20balanced%20systems%2C%20meaning%20that%20the%20request%20and%20response%20traffic%20use%20a%20different%20network%20path.%3C%2FP%3E%0A%3CP%3EThe%20use%20of%20different%20network%20paths%20helps%20avoid%20extra%20hops%20and%20reduces%20the%20latency%20by%20which%20not%20only%20speeds%20up%20the%20response%20time%20between%20the%20client%20and%20the%20service%20but%20also%20removes%20some%20extra%20load%20from%20the%20load%20balancer.%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CBR%20%2F%3EUsing%20DSR%20is%20a%20transparent%20way%20to%20achieve%20increased%20network%20performance%20for%20your%20applications%20with%20little%20to%20no%20infrastructure%20changes.%3C%2FP%3E%0A%3CP%3EWhile%20DSR%20will%20improve%20your%20application%E2%80%99s%20network%20performance%2C%20there%20are%20a%20couple%20of%20things%20to%20keep%20in%20mind%20when%20enabling%20DSR%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EPersistence%20is%20limited%20to%20source%20IP%20or%20destination%20IP%20(no%20cookie%20persistence)%3C%2FLI%3E%0A%3CLI%3ESSL%20offloading%20on%20the%20load%20balancer%20is%20not%20going%20work%20as%20they%20need%20to%20see%20both%20inbound%20and%20outbound%20traffic.%3C%2FLI%3E%0A%3CLI%3EThere%20might%20be%20some%20ARP%20issues%20with%20some%20operating%20systems%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EBoth%20the%20outbound%20and%20inbound%20packets%20pass%20through%20the%20filtering%2Fload%20balancing%20layer%20and%20the%20root%20name%20space%20to%20reach%20their%20destination%20Service%20VIP%20resulting%20in%20delays%20due%20to%20the%20time%20it%20takes%20to%20process%20the%20packet%20in%20each%20layer%20both%20ways.%3C%2FP%3E%0A%3CP%3EIn%20the%20below%20diagram%20you%20can%20see%20the%20typical%20non-DSR%20flow.%20As%20you%20can%20see%20both%20the%20inbound%20as%20well%20as%20the%20outbound%20packets%20between%20POD1%20and%20POD2%20are%20traversing%20through%20all%20components%20of%20the%20network.%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EPacket%20leaves%20POD1%20addressed%20from%20192.168.1.3%3A5555%20to%20the%20lService%20VIP%20address%2010.0.0.10%3A53%3C%2FLI%3E%0A%3CLI%3EPacket%20enters%20VMswitch%20at%20Port%203%20and%20a%20SNAT%20rule%20is%20applied%20changing%20the%20destination%20address%20to%20192.168.0.5%3A6666%20to%20route%20the%20package%20through%20the%20ROOT%20namespace.%3C%2FLI%3E%0A%3CLI%3EThe%20packet%20is%20then%20routed%20back%20to%20192.168.1.4%3A53%20through%20the%20VMSwitch%20Port%204%20carrying%20the%20source%20address%20192.168.0.5%20of%20the%20ROOT%20Namespace.%3C%2FLI%3E%0A%3CLI%3EThe%20return%20path%20follows%20the%20steps%20in%20reverse%20order%20and%20the%20packet%20will%20have%20to%20travel%20through%20the%20ROOT%20Namespace%20again%20to%20get%20back%20to%20the%20original%20source.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%3E%3CSPAN%20class%3D%22lia-message-image-wrapper%20lia-message-image-actions-narrow%20lia-message-image-actions-below%22%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%2F118161iD6804A5B84D64C19%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22nonDSRFlow1280.gif%22%20title%3D%22nonDSRFlow1280.gif%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3ENon%20DSR%20enabled%20flow%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%3ENon%20DSR%20enabled%20flow%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EIn%20DSR%20enabled%20configurations%20only%20the%20outbound%20packets%20from%20the%20%E2%80%9Cclient%E2%80%9D%20to%20the%20server%20pass%20through%20the%20load%20balancing%20layer%20and%20are%20changed%20to%20convey%20the%20%E2%80%9Creal%E2%80%9D%20address%3Aport%20of%20the%20client%20to%20the%20server%20which%20in%20turn%20will%20use%20that%20on%20the%20return%20path%20to%20forward%20the%20packet%20directly%20to%20the%20%E2%80%9Cclient%E2%80%9D%20bypassing%20the%20Root%20Namespace%20steps%20and%20saving%20time%20along%20the%20way.%3C%2FP%3E%0A%3CP%3EThe%20diagram%20below%20illustrates%20the%20flow%20of%20packets%20in%20a%20DSR%20enabled%20network.%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EPacket%20leaves%20POD1%20addressed%20from%20192.168.1.3%3A5555%20to%20the%20load%20balancer%20address%2010.0.0.10%3A53%3C%2FLI%3E%0A%3CLI%3EPacket%20enters%20VMswitch%20at%20Port%203%20and%20rule%20is%20applied%20changing%20the%20destination%20address%20192.168.1.4%3A53%20which%20is%20POD2%3CBR%20%2F%3EAn%20example%20of%20an%20LBNAT%20rule%20is%20below%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3ERULE%20%3A%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Friendly%20name%20%3A%20LB_DSR_E5B0F_10.231.111.97_13.0.0.13_8000_80_6%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Priority%20%3A%20100%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Flags%20%3A%201%20terminating%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Type%20%3A%20lbnat%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Conditions%3A%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Protocols%20%3A%206%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Destination%20IP%20%3A%2013.0.0.13%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Destination%20ports%20%3A%208000%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Flow%20TTL%3A%20240%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Rule%20Data%3A%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Decrementing%20TTL%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Fixing%20MAC%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Modifying%20destination%20IP%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Modifying%20destination%20port%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Creating%20a%20flow%20pair%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Map%20space%20%3A%2082F1AFA2-1B42-4A38-81C5-B414B7541171%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Count%20of%20DIP%20Ranges%3A%202%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20DIP%20Range(s)%20%3A%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7B%2010.0.0.15%20%3A%2080%20%7D%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7B%2010.0.0.14%20%3A%2080%20%7D%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20FlagsEx%20%3A%200%3C%2FPRE%3E%0A%3COL%20start%3D%223%22%3E%0A%3CLI%3EThe%20packet%20drops%20to%20the%20Forwarding%20layer%20in%20VFP%20where%20the%20MAC%20address%20is%20updated%3C%2FLI%3E%0A%3CLI%3EForwarding%20rules%20look%20up%20the%20destination%20MAC%20address%20in%20the%20DSR%20cache%3C%2FLI%3E%0A%3CLI%3EPacket%20is%20forwarded%20to%20Port%204%20of%20the%20VMswitch%20with%20the%20POD1%20IP%20address%20as%20the%20source%20address%20and%20POD2%20as%20the%20destination%20address%3C%2FLI%3E%0A%3CLI%3EPacket%20reaches%20the%20service%20in%20POD2%20at%20192.168.1.4%3A53%3C%2FLI%3E%0A%3CLI%3EOn%20the%20return%20path%20the%20packet%20bypasses%20the%20Root%20Namespace%20and%20mux%20and%20is%20routed%20directly%20from%20Port%204%20to%20Port%203%20of%20the%20VMSwitch%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%3E%3CSPAN%20class%3D%22lia-message-image-wrapper%20lia-message-image-actions-narrow%20lia-message-image-actions-below%22%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%2F118163iABE4EC74B4134953%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22DSRFlow1280.gif%22%20title%3D%22DSRFlow1280.gif%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EDSR%20enabled%20flow%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%3EDSR%20enabled%20flow%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--784652281%22%20id%3D%22toc-hId--764243434%22%20id%3D%22toc-hId--764243434%22%3EHow%20to%20try%20it%20out%3C%2FH2%3E%0A%3CP%3ETo%20enable%20DSR%20in%20Windows%20Container%20networking%20you%20need%20to%20know%20the%20feature%20is%20in%20preview%20and%20you%20will%20need%20to%20run%20a%20recent%20Windows%20Server%20Insider%20build%20(%26gt%3B18915).%3C%2FP%3E%0A%3CP%3EWhen%20starting%20kube-proxy%20provide%20the%20--enable-ds%20switch%20set%20to%20true%20and%20an%20additional%20%E2%80%93feature-gate%20WinDSR%20set%20to%20true.%3C%2FP%3E%0A%3CP%3ETo%20do%20that%20you%20will%20have%20to%20use%20overlay%20networking%20as%20outlined%20in%20this%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FNetworking-Blog%2FIntroducing-Kubernetes-Overlay-Networking-for-Windows%2Fba-p%2F363082%22%20target%3D%22_blank%22%20rel%3D%22noopener%22%3Eblog%20post%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eby%20David%20Schott.%3C%2FP%3E%0A%3CP%3EEnabling%20DSR%2C%20follow%20the%20instructions%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fvirtualization%2Fwindowscontainers%2Fkubernetes%2Fkube-windows-services%3Ftabs%3DManagementIP%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehere%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ein%20the%20manual%20approach%20section%20with%20two%20%26nbsp%3Bchanges%3A%3C%2FP%3E%0A%3CPRE%3EPS%20C%3A%5Ck%26gt%3B%20nssm%20install%20kube-proxy%20C%3A%5Ck%5Ckube-proxy.exe%0APS%20C%3A%5Ck%26gt%3B%20nssm%20set%20kube-proxy%20AppDirectory%20c%3A%5Ck%0APS%20C%3A%5Ck%26gt%3B%20nssm%20set%20kube-proxy%20AppParameters%20--v%3D4%20--proxy-mode%3Dkernelspace%20--feature-gates%3D%22WinOverlay%3Dtrue%2CWinDSR%3Dtrue%E2%80%9D%20--hostname-override%3D%20--kubeconfig%3Dc%3A%5Ck%5Cconfig%20--network-name%3Dvxlan0%20--source-vip%3D%20--enable-dsr%3Dtrue%20--log-dir%3D%20--logtostderr%3Dfalse%0APS%20C%3A%5Ck%26gt%3B%20nssm%20set%20kube-proxy%20DependOnService%20Kubelet%0APS%20C%3A%5Ck%26gt%3B%20nssm%20start%20kube-proxy%0A%3C%2FPRE%3E%0A%3CH1%20id%3D%22toc-hId-1154671559%22%20id%3D%22toc-hId-1175080406%22%20id%3D%22toc-hId-1175080406%22%3EVerify%20that%20DSR%20is%20working%20as%20expected%3C%2FH1%3E%0A%3CP%3EVerification%20involves%20a%20few%20steps.%20These%20steps%20can%20also%20help%20in%20general%20troubleshooting%20of%20the%20Windows%20networking%20components.%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EOn%20the%20Windows%20work%20node%20download%20collectlogs.ps1%20from%20here%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fmicrosoft%2FSDN%2Ftree%2Fmaster%2FKubernetes%2Fwindows%2Fdebug%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2Fmicrosoft%2FSDN%2Ftree%2Fmaster%2FKubernetes%2Fwindows%2Fdebug%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3ERun%20the%20script%20in%20an%20elevated%20PowerShell%20session%3C%2FLI%3E%0A%3CLI%3EThis%20will%20generate%20a%20few%20output%20txt%20files.%3C%2FLI%3E%0A%3CLI%3EOpen%20policy.txt.%3C%2FLI%3E%0A%3CLI%3EBelow%20is%20part%20of%20a%20policy%20entry.%20Each%20policy%20will%20have%20a%20block%20like%20that.%3CBR%20%2F%3ECheck%20the%20IsDSR%20setting%20if%20it%20is%20set%20to%20TRUE%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CPRE%3E%22ID%22%3A%222A34FF08-3F32-4C75-A6E9-F44D966324C1%22%2C%0A%20%22ILB%22%3Afalse%2C%0A%20%22InternalPort%22%3A6443%2C%0A%20%22IsDSR%22%3Atrue%2C%0A%20%22IsPolicy%22%3Atrue%2C%0A%20%22LocalRoutedVip%22%3Afalse%2C%0A%20%22Protocol%22%3A6%2C%0A%20%22SourceVIPMappingRe%22%3A1%2C%0A%20%22SourceVip%22%3A%22%22%2C%0A%20%22State%22%3A3%2C%0A%20%22TCPPortAllocate%22%3Atrue%2C%0A%20%22Tag%22%3A%22VFP%20ELB%20Policy%22%2C%0A%20%22UDPPortAllocate%22%3Afalse%2C%0A%20%22VIP_0%22%3A%2210.96.0.1%22%3C%2FPRE%3E%0A%3CP%3EIf%20you%20see%20that%20on%20every%20policy%2C%20then%20DSR%20has%20been%20enabled%20successfully%3C%2FP%3E%0A%3CH1%20id%3D%22toc-hId--1397485402%22%20id%3D%22toc-hId--1377076555%22%20id%3D%22toc-hId--1377076555%22%3EIn%20Closing%3C%2FH1%3E%0A%3CP%3ESince%20DSR%20load%20balancing%20for%20Kubernetes%20on%20Windows%20is%20brand%20new%2C%20we%E2%80%99d%20love%20to%20hear%20any%20feedback%20in%20trying%20it%20out%20at%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fkubernetes%2Fcommunity%2Fblob%2Fmaster%2Fsig-windows%2FREADME.md%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3ESIG-Windows%3C%2FA%3E%26nbsp%3Bor%20in%20the%20comments%20below!%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThanks%20for%20reading%20this%20far%3C%2FP%3E%0A%3CP%3EMike%20Kostersitz%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E*Special%20thanks%20to%20our%20Kalya%20Subramanian%2C%20Pradip%20Dhara%2C%20Madhan%20Raj%20Mookkandy%2C%20Buck%20Buckley%20and%20in%20our%20engineering%20team%20for%20designing%20and%20implementing%20DSR%20in%20overlay%20networking%20for%20Windows%20containers%2C%20as%20well%20as%20providing%20materials%20to%20help%20create%20content%20for%20this%20blog!%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%20size%3D%222%22%3EEditor's%20notes%3A%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%20size%3D%222%22%3E8%2F26%2F19%3A%20few%20fixes%20to%20content%20and%20typo%20corrections.%3C%2FFONT%3E%3C%2FP%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-693710%22%20slang%3D%22en-US%22%3E%3CP%3E%3CEM%3E%3CSTRONG%3ETL%3BDR%3B%3C%2FSTRONG%3E%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3E%3CEM%3EA%20question%20we%20get%20asked%20quite%20a%20bit%20is%3A%20%22What%20is%20Microsoft%20doing%20to%20improve%20Networking%20performance%3F%22%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3ETo%20answer%20that%20we%20have%20today%E2%80%99s%20blog%20post%2C%20which%20is%20about%20load%20balancing%20performance%20enhancements%20in%20SDN%20networks%20for%20Windows%20Containers%20and%20Kubernetes%20Networks%2C%20especially%20for%20services.%3C%2FP%3E%0A%3CP%3EOne%20of%20these%20enhancements%20is%20Direct%20Server%20Return%20(DSR)%20routing%20for%20overlay%20and%20l2bridge%20networks.%3C%2FP%3E%3C%2FLINGO-TEASER%3E
Microsoft
 

TL;DR;

A question we get asked quite a bit is: "What is Microsoft doing to improve Networking performance?".

To answer that we have today’s blog post, which is about load balancing performance enhancements in SDN networks for Windows Containers and Kubernetes Networks, especially for services.

One of these enhancements is Direct Server Return (DSR) routing for overlay and l2bridge networks.

What it is

DSR is an implementation of asymmetric network load distribution in load balanced systems, meaning that the request and response traffic use a different network path.

The use of different network paths helps avoid extra hops and reduces the latency by which not only speeds up the response time between the client and the service but also removes some extra load from the load balancer. 
Using DSR is a transparent way to achieve increased network performance for your applications with little to no infrastructure changes.

While DSR will improve your application’s network performance, there are a couple of things to keep in mind when enabling DSR:

  • Persistence is limited to source IP or destination IP (no cookie persistence)
  • SSL offloading on the load balancer is not going work as they need to see both inbound and outbound traffic.
  • There might be some ARP issues with some operating systems

Both the outbound and inbound packets pass through the filtering/load balancing layer and the root name space to reach their destination Service VIP resulting in delays due to the time it takes to process the packet in each layer both ways.

In the below diagram you can see the typical non-DSR flow. As you can see both the inbound as well as the outbound packets between POD1 and POD2 are traversing through all components of the network.

  1. Packet leaves POD1 addressed from 192.168.1.3:5555 to the lService VIP address 10.0.0.10:53
  2. Packet enters VMswitch at Port 3 and a SNAT rule is applied changing the destination address to 192.168.0.5:6666 to route the package through the ROOT namespace.
  3. The packet is then routed back to 192.168.1.4:53 through the VMSwitch Port 4 carrying the source address 192.168.0.5 of the ROOT Namespace.
  4. The return path follows the steps in reverse order and the packet will have to travel through the ROOT Namespace again to get back to the original source.

nonDSRFlow1280.gifNon DSR enabled flowNon DSR enabled flow

In DSR enabled configurations only the outbound packets from the “client” to the server pass through the load balancing layer and are changed to convey the “real” address:port of the client to the server which in turn will use that on the return path to forward the packet directly to the “client” bypassing the Root Namespace steps and saving time along the way.

The diagram below illustrates the flow of packets in a DSR enabled network.

  1. Packet leaves POD1 addressed from 192.168.1.3:5555 to the load balancer address 10.0.0.10:53
  2. Packet enters VMswitch at Port 3 and rule is applied changing the destination address 192.168.1.4:53 which is POD2
    An example of an LBNAT rule is below

  

RULE :
        Friendly name : LB_DSR_E5B0F_10.231.111.97_13.0.0.13_8000_80_6
        Priority : 100
        Flags : 1 terminating
        Type : lbnat
        Conditions:
            Protocols : 6
            Destination IP : 13.0.0.13
            Destination ports : 8000
        Flow TTL: 240
        Rule Data:
        Decrementing TTL
        Fixing MAC
        Modifying destination IP
        Modifying destination port
        Creating a flow pair
        Map space : 82F1AFA2-1B42-4A38-81C5-B414B7541171
        Count of DIP Ranges: 2
        DIP Range(s) :
                { 10.0.0.15 : 80 }
                { 10.0.0.14 : 80 }
        FlagsEx : 0
  1. The packet drops to the Forwarding layer in VFP where the MAC address is updated
  2. Forwarding rules look up the destination MAC address in the DSR cache
  3. Packet is forwarded to Port 4 of the VMswitch with the POD1 IP address as the source address and POD2 as the destination address
  4. Packet reaches the service in POD2 at 192.168.1.4:53
  5. On the return path the packet bypasses the Root Namespace and mux and is routed directly from Port 4 to Port 3 of the VMSwitch

DSRFlow1280.gifDSR enabled flowDSR enabled flow

How to try it out

To enable DSR in Windows Container networking you need to know the feature is in preview and you will need to run a recent Windows Server Insider build (>18915).

When starting kube-proxy provide the --enable-ds switch set to true and an additional –feature-gate WinDSR set to true.

To do that you will have to use overlay networking as outlined in this blog post by David Schott.

Enabling DSR, follow the instructions here in the manual approach section with two  changes:

PS C:\k> nssm install kube-proxy C:\k\kube-proxy.exe
PS C:\k> nssm set kube-proxy AppDirectory c:\k
PS C:\k> nssm set kube-proxy AppParameters --v=4 --proxy-mode=kernelspace --feature-gates="WinOverlay=true,WinDSR=true” --hostname-override= --kubeconfig=c:\k\config --network-name=vxlan0 --source-vip= --enable-dsr=true --log-dir= --logtostderr=false
PS C:\k> nssm set kube-proxy DependOnService Kubelet
PS C:\k> nssm start kube-proxy

Verify that DSR is working as expected

Verification involves a few steps. These steps can also help in general troubleshooting of the Windows networking components.

  • On the Windows work node download collectlogs.ps1 from here https://github.com/microsoft/SDN/tree/master/Kubernetes/windows/debug
  • Run the script in an elevated PowerShell session
  • This will generate a few output txt files.
  • Open policy.txt.
  • Below is part of a policy entry. Each policy will have a block like that.
    Check the IsDSR setting if it is set to TRUE
"ID":"2A34FF08-3F32-4C75-A6E9-F44D966324C1",
 "ILB":false,
 "InternalPort":6443,
 "IsDSR":true,
 "IsPolicy":true,
 "LocalRoutedVip":false,
 "Protocol":6,
 "SourceVIPMappingRe":1,
 "SourceVip":"",
 "State":3,
 "TCPPortAllocate":true,
 "Tag":"VFP ELB Policy",
 "UDPPortAllocate":false,
 "VIP_0":"10.96.0.1"

If you see that on every policy, then DSR has been enabled successfully

In Closing

Since DSR load balancing for Kubernetes on Windows is brand new, we’d love to hear any feedback in trying it out at SIG-Windows or in the comments below!

 

Thanks for reading this far

Mike Kostersitz

 

*Special thanks to our Kalya Subramanian, Pradip Dhara, Madhan Raj Mookkandy, Buck Buckley and in our engineering team for designing and implementing DSR in overlay networking for Windows containers, as well as providing materials to help create content for this blog!

 

Editor's notes:

8/26/19: few fixes to content and typo corrections.