Sink a lovely, butthenresolveoursynchronouslyandbeforeanyotherioeventssetimmediate.
Instead, existseyesthefulleventloopthatwetoldyouthatwe'vetoldyou, youknow, andhavenotthrownincitymeets a time a Verabecausethat's anotherrivalcomplication.
Soagain, theartistpieceoffinformation.
Thatthingthatwhen a newbiestartsworkingwithnote, istoknowwhen a chunkofcodeisexecutedrelativetooneanother.
Sogoingbacktothequestionouttothebugmultiple a synchronousactivity.
Howdowedothis?
Because, youknow, wehavemultiplethingshappening.
Howdowehave a badbugonthatishappeningOnlywhen I'm callingthreedifferentroutesatthesametimeandthemoonisaligningandMarcie's overthere?
I don't know.
It's reallygetscomplicated.
Andher I don't understandwhatwhatishappeninginhereisveryhard.
Soitgoesbackto a problemthatsomethingthatyou'remissinginbasket, whichistheconceptofftheirsynchronouscontext.
Solet's lookat a bad, verybasic, httpServerofwritteninNotre.
Yes.
Andyoucanseethatwedoourhttp, createserverandwe'repassing a functionthisfunction.
Infact, whenwereceiveanhttprequestfrom a browser, youhave a newlogicalsequencecontextthatisbeingcreated, whichmeans, youknow, thisisyourtransaction.
Andthereasoncomesinthewaythat I thinkawait, I think, a waytospecifiedand, youknow, foreverywaythatyoudo, Oh, youlocate a bunchofpromisesthatarenotnecessarilyneeded.
Andlet's doanotherexamplejustcalling a firstratefiveoneoftheperimetersoff?
NoJs.
Sowegobackhereandwearerunningourfiles.
Example.
Ondhe I cameplacingtop, butit's not a reallygoodidea.
So a lotoffightsinthere, Sowe'rerunningitandgeneratingsomebunchofthings.
Andyetwe g o umit's a magicsprinkling.
I don't know.
Herewego.
Nowyoucanseethereisanother a slightlydifferentones.
Thisisfullylenient.
Lightenhuman.
Okay, youcanseeinthisblobinthisblock, there's a lotofbrownactivity, whichis a readingofffiles, a bunchofschedulingactivity, whichisthepurpleandthensomegreenone, whichisdata.
Sowehavetheseblocksoffbrownactivityherethatyoucanseeandyouknow, thefirstlastweekonthe 1st 1 Andthe 1st 1 isour F onefunction, andyoucanseeOh, maybewe'rereading a file.
Sothisisschedulingourreadofthefire.
Thenwehavethisnextblockafterwards, whichisinfact, a combinationoff.
Threedifferent a synchronousactivitiesbecauseno, yes, inordertoreadthatfileisactuallyaccessingthefilesystemthreetimes.
Andit's completelyinitforyoutojustcall a fastrefile.
Butit's segmented, anditmakesthingsinterleaguesothatyoucanusemultiplesignalsactivityatthesametimeandisdoingtreatandtheydoingthreethingsandhe's callingdysfunctionreadfileafteropen, whichistotally a notecoursing, andwe'renotshouldnotreallyworrytoomuchabout, andnowwehavethefirstwehavethefirstfileandthenthesecondfileandthenthethirdfile.
Sointheend, untilthismeansthatthegarbagecollectorwouldstealmyCPUcyclesperfectonwillstealmyCPUcyclefromtheJavaScriptcriticalpath, whichis, um, whichis a littlebitof a trickything.
So, um, thenetresultisthatlateinan O.
J s application, leightonseeandthroughputaretightlyconnected.
Sothemomentyouseeanincreasingleighton, see, youwillseealsolikely a decreaseintrouble, mainlybecausethey'relinkedtogether, bythewaythenoteworksandthefactthattypicallyitcantake a hugeamountofFeiconcurrencycomparedtootherplatformson D's isoneofthethingsthatyouknowhavingdoinggetus a jobtogothroughandputtingnoJessapplicationinproduction.