Technische Universita¨t Berlin Master Thesis Window aggregate sharing for out-of-order stream processing SubmittedtotheFacultyIV,ElectricalEngineeringandComputerScienceDatabaseSystems andInformationManagementGroupinpartialfulfillmentoftherequirementsforthedegreeof MasterofScienceinComputerScienceaspartoftheERASMUSMUNDUSprogramme IT4BI AlejandroRodr´ıguezCue´llar Matriculation#: 0376308 Supervisors: Prof. Dr. VolkerMarkl Advisors: Dr. AsteriosKatsifodimos,JonasTraub 31/07/2016 Erkla¨rung (Declaration of Academic Honesty) Hiermit erkla¨re ich, dass ich die vorliegende Arbeit selbststa¨ndig und eigenha¨ndig sowie ohne unerlaubte fremde Hilfe und ausschließlich unter Verwendung der aufgefu¨hrten Quellen und Hilfsmittelangefertigthabe. I hereby declare to have written this thesis on my own and without forbidden help of others, usingonlythelistedresources. Datum AlejandroRodr´ıguezCue´llar Contents ListofFigures vi ListofTables vii 1 EnglishAbstract 1 2 DeutscherAbstract 2 3 Introduction 3 3.1 Amotivatingexample . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 3.2 Treemainchallenges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 3.3 Contributions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 3.4 Thesisoutline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 4 Backgroundandrelatedwork 8 4.1 Streaming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 4.1.1 Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 4.2 Out-of-orderstreamprocessing . . . . . . . . . . . . . . . . . . . . . . . . . . 12 4.2.1 Eventtimevs. processingtimevs. ingestiontime . . . . . . . . . . . . 12 4.2.2 Latency,correctnessandcost . . . . . . . . . . . . . . . . . . . . . . . 13 4.2.3 Sortingandslack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 4.2.4 Lambdaarchitecture . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 4.2.5 Punctuationsandwatermarks . . . . . . . . . . . . . . . . . . . . . . . 16 4.2.6 TheGoogledataflowmodel . . . . . . . . . . . . . . . . . . . . . . . 17 4.3 Windowing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 4.3.1 Fixedwindows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 4.3.2 Slidingwindows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 4.3.3 Sessionwindows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 4.3.4 User-definedwindows . . . . . . . . . . . . . . . . . . . . . . . . . . 23 4.3.5 Windowingbyprocessingtimevseventtime . . . . . . . . . . . . . . 23 4.3.6 Aggregationfunctions . . . . . . . . . . . . . . . . . . . . . . . . . . 25 4.4 Aggregatesharing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 4.4.1 Out-of-orderstreamprocessing,aggregatesharingandaggregatefunction 30 5 Aggregatesharingforout-of-orderstreams 31 5.1 Approachoverview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 5.1.1 Designprincipals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 5.2 Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 5.2.1 Discretizer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 5.2.2 WindowOperator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 5.2.3 Aggregatestoreinternals . . . . . . . . . . . . . . . . . . . . . . . . . 43 5.2.4 Triggerandwatermark . . . . . . . . . . . . . . . . . . . . . . . . . . 45 5.2.5 Aggregatesharingforsessionwindows . . . . . . . . . . . . . . . . . 46 5.3 Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 5.3.1 API,model,andengine . . . . . . . . . . . . . . . . . . . . . . . . . . 48 5.3.2 Development . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 5.3.3 Challenges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 6 Evaluation 53 6.1 Datasets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 6.1.1 Simulationofout-of-orderstreams . . . . . . . . . . . . . . . . . . . . 53 6.1.2 Externaldataset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 iii Contents 6.2 Evaluationsetup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 6.3 Experimentalevaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 6.3.1 Out-of-orderlevel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 6.3.2 Scalingthenumberofqueries . . . . . . . . . . . . . . . . . . . . . . 62 6.3.3 Scalingthenumberofqueriesandout-of-orderlevel . . . . . . . . . . 65 6.3.4 Sessionwindowsevaluation . . . . . . . . . . . . . . . . . . . . . . . 68 6.4 Analyticalcomparison . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 7 Conclusion 72 8 Futurework 72 References i AlejandroRodr´ıguezCue´llar: Windowaggregatesharingforout-of-orderstreamprocessing iv Contents Appendix vi A Experiments A.1 A.1 Exampleexperimentresults . . . . . . . . . . . . . . . . . . . . . . . . . . . . A.1 AlejandroRodr´ıguezCue´llar: Windowaggregatesharingforout-of-orderstreamprocessing v List of Figures 1 Tra�cmonitoringRiodeJaneiro,Brazil[39] . . . . . . . . . . . . . . . . . . 5 2 Waze,aGPSnavigationapplication . . . . . . . . . . . . . . . . . . . . . . . 6 3 Streamprocessingforquery1 . . . . . . . . . . . . . . . . . . . . . . . . . . 6 4 Streamprocessingexample6(DAG) . . . . . . . . . . . . . . . . . . . . . . . 11 5 Eventtimevs. processingtime[2] . . . . . . . . . . . . . . . . . . . . . . . . 13 6 Exampleofout-of-orderhandlingthroughsortingandslack. . . . . . . . . . . 15 7 Lambdaarchitecture[24] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 8 Fixed,sliding,sessionanduserdefinedwindows . . . . . . . . . . . . . . . . . 20 9 Sessionwindowprocessing . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 10 AggregatesharingforQ1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 11 PartialsforPairs,PanesandCutty: in-order . . . . . . . . . . . . . . . . . . . 30 12 PartialsforPairs,PanesandCutty: out-of-order . . . . . . . . . . . . . . . . . 31 13 Architecturebasedon[36] . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 14 WindowOperator(WO-0)withoutaggregatesharing . . . . . . . . . . . . . . 37 15 Aggregatesharingforwindowoperator1(WO-1): . . . . . . . . . . . . . . . 38 16 ProcessdataiteminWO-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 17 Aggregatesharingforwindowoperator2(WO-2) . . . . . . . . . . . . . . . . 43 18 Aggregatestore: pre-aggregatetree . . . . . . . . . . . . . . . . . . . . . . . . 44 19 WO-2sessionwindowcase1 . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 20 WO-2sessionwindowcase3 . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 21 WO-2sessionwindowcase3 . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 22 Di↵erentAPI,engineandmodelcombinations[44] . . . . . . . . . . . . . . . 50 23 UMLFlinkstreaming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 24 UMLofthesolutionimplementedforWO-2 . . . . . . . . . . . . . . . . . . . 52 25 Throughputperwindowoperatorandout-of-orderlevel . . . . . . . . . . . . . 59 26 Numberofreducecalls(logscale)perwindowoperatorandout-of-orderlevel . 60 27 Latencyperwindowoperatorandout-of-orderlevel . . . . . . . . . . . . . . . 61 28 Memoryconsumptionperwindowoperatorandout-of-orderlevel . . . . . . . 61 29 Throughputperwindowoperatorandnumberofqueries. . . . . . . . . . . . . 63 30 Numberofreducecalls(logscale)perwindowoperatorandout-of-orderlevel . 63 31 Latencyperwindowoperatorandnumberofqueries . . . . . . . . . . . . . . . 64 32 Memoryconsumptionperwindowoperatorandnumberofqueries . . . . . . . 65 33 ThroughputofWO-2perout-of-orderlevelandnumberofqueries . . . . . . . 66 34 Number of calls to the reduce function (log scale) of WO-2 per out-of-order levelandnumberofqueries . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 35 LatencyofWO-2perout-of-orderlevelandnumberofqueries . . . . . . . . . 68 36 Sessionwindowexperiments . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 37 Sessionwindowsvspartials . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 38 Aggregatesharingforwindowoperator3(WO-3) . . . . . . . . . . . . . . . . 73 vi List of Tables 1 Eventtimevs. processingtime[2] . . . . . . . . . . . . . . . . . . . . . . . . 24 2 Experiment’smeasurements: dimensionsandmeasures . . . . . . . . . . . . . 57 3 Windowoperators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 4 Complexitycomparisonofwindowaggregatesharingtechniques[36] . . . . . 71 5 Exampleresultsfortheout-of-orderleveltest . . . . . . . . . . . . . . . . . . A.2 vii List of Examples Example: 1 Smartcities: RiodeJaneiro,Brazil . . . . . . . . . . . . . . . . . . . . . 4 Example: 2 Streamsource . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Example: 3 Filteroperator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Example: 4 Mapoperator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Example: 5 Mergeoperator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Example: 6 Streamprocessing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Example: 7 Skewbetweeneventtimeandprocessingtime . . . . . . . . . . . . . . . 13 Example: 8 Punctuation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 Example: 9 Heartbeats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 Example: 10 Fixedwindows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Example: 11 Eventtimewindowing . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 Example: 12 Processingtimewindowing . . . . . . . . . . . . . . . . . . . . . . . . . 24 Example: 13 Partials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 Example: 14 Storingaggregates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 Example: 15 AggregatesharingforQ1 . . . . . . . . . . . . . . . . . . . . . . . . . . 27 Example: 16 Viewmaterialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 Example: 17 Cuttyandlatearrivals . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 Example: 18 Tuple-basedwindows . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 Example: 19 Trigger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 Example: 20 Watermark . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 Example: 21 Scenario . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 viii List of Queries Query1 Slidingwindow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Query2 Fixedwindow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Query3 Sessionwindow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 Query4 Userdefinedwindow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 Query5 Viewmaterialization1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 Query6 Viewmaterialization2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 Query7 Tuple-basedwindow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 ix
Description: