MSOpenTech’sRedisonWindowsWestrivetohaveastable,functionallyequivalentandcomparablyperformingversionofRedisonWindows.WehaveachievedperformancenearlyidenticaltothePOSIXversionrunninghead-to-headonidenticalhardwareacrossthenetwork.AsidefromfeaturedifferencesthathelpRedistakeadvantageoftheWindowsinfrastructure,ourversionofRedisshouldworkinmostsituationswiththeidenticalsetupandconfigurationthatonewoulduseonaPOSIXoperatingsystem.HowisRedisonWindowsimplemented?RedisisaCcodebasethatcompilesunderVisualStudio.Mostofthecodecompileswithonlyminorchanges(duetosyntacticaldifferencesbetweencompilersandlow-levelAPIdifferencesonWindows).ThereareafewareaswheretherearesignificantdifferencesinhowefficientWindowsprogramsoperaterelativetoPOSIXprograms.Wehaveencapsulatedmostthesedifferencesinaplatformspecificlibrary.Theareaswheretherearesignificantdifferencesare:•NetworkingAPIs•POSIXFileDescriptors•POSIXfork()•Logging•WindowsServicesAPINetworkingDifferencesTheWindowsnetworkingstackissplitbetweenusermodecodeandkernelmodecode.Transitionsbetweenuserandkernelmodeareexpensiveoperations.ThePOSIXnetworkingAPIsonWindowsutilizeaprogrammingmodelthatincurssignificantperformancelossduetothekernel/usermodetransitions.EfficientWindowsnetworkingcodeinsteadusestheIOCompletionPortmodeltoreducetheimpactofthisbehavior.TheAPIsusedandtheprogrammingmodelforIOCompletionisdifferentenoughthatwewereforcedtoimplementanewnetworkinglayerinRedis.FileDescriptorsInaPOSIXoperatingsystem,alldatasources(files,pipes,sockets,mailslots,etc.)arereferencedincodewithahandlecalledafiledescriptor.Thesearelowvalueintegersthatincrementbyonewitheachsuccessivefiledescriptorcreation.AllPOSIXAPIsthatworkwithfiledescriptorswillfunctionwithouttheprogrammerhavingtoknowwhatkindofdatasourceafiledescriptorrepresents.OnWindows,eachkindofdatasourcehasaseparatekindofHANDLE.APIsthatworkwithoneHANDLEtypewillnotworkwithanotherkindofHANDLE.InordertomakeRedisoperatewithitsassumptionsaboutfiledescriptorvaluesanddatasourceagnosticism,weimpleme...