Joining Punctuated Streams Luping Ding, Nishant Mehta, Elke A. Rundensteiner and George T. Heineman Department of Computer Science Worcester Polytechnic Institute {lisading, nishantm, rundenst, heineman}@cs.wpi.edu 2018/9/18 EDBT 2004
Outline Motivation Punctuation Preliminaries Our Join Approach: PJoin Experimental Study Related Work Conclusion 2018/9/18 EDBT 2004
Challenges in Joining Continuous Data Streams Potentially unbounded growing join state, e.g., Symmetric Hash Join [WA93] -> To bound runtime join state Uneven workload caused by time-varying data arrival characteristics -> To adjust execution behavior according to runtime circumstances B A probe insert 2018/9/18 EDBT 2004
Tackling Challenges To bound runtime join state Exploiting semantic constraints to timely remove stale data from join state, e.g., sliding window [KNV03, GO03, HFA+03], k-constraint [BW02], punctuations [TMS+03]. To adjust execution at runtime Developing adaptive join execution logic, e.g., XJoin [UF00], Ripple Join [HH99]. 2018/9/18 EDBT 2004
no more tuples for students whose age are less than or equal to 18! Punctuation Punctuation is predicate on stream elements that evaluates to false for every element following the punctuation. ID Name Age no more tuples for students whose age are less than or equal to 18! 9961234 Edward 17 9961235 Justin 19 9961238 Janet 18 * * (0, 18] 9961256 Anna 20 … 2018/9/18 EDBT 2004
Query optimization enabled by punctuation Guide stateful operators to purge stale data from state e.g., join, duplicate elimination, … Unblock blocking operators to produce partial result intermittanly e.g., group-by, set difference, … 2018/9/18 EDBT 2004
Group-byitem_id (sum(…)) An Example Open Stream item_id | seller_id | open_price | timestamp 1080 | jsmith | 130.00 | Nov-10-03 9:03:00 <1080, *, *, *> 1082 | melissa | 20.00 | Nov-10-03 9:10:00 <1082, *, *, *> … Query: For each item that has at least one bid, return its bid-increase value. Select O.item_id, Sum (B.bid_price - O.open_price) From Open O, Bid B Where O.item_id = B.item_id Group by O.item_id Bid Stream item_id | bidder_id | bid_price | timestamp 1080 | pclover | 175.00 | Nov-14-03 8:27:00 1082 | smartguy | 30.00 | Nov-14-03 8:30:00 1080 | richman | 177.00 | Nov-14-03 8:52:00 <1080, *, *, *> … Open Stream The query asks for the bid-increase value for each item that has at least one bid. Joinitem_id Group-byitem_id (sum(…)) Out1 (item_id) Out2 (item_id, sum) Bid Stream No more bids for item 1080! 2018/9/18 EDBT 2004
Punctuation-Related Rules [TMS+03] Purge rule for join operator tA TSA(T), purge(tA) if setMatch(tA, PSB(T)) tB TSB(T), purge(tB) if setMatch(tB, PSA(T)) Propagate rule for join operator pAPSA(T), propagate(pA) if tATSA(T), match(tA, pA) pBPSB(T), propagate(pB) if tBTSB(T), match(tB, pB) TSA(T): all tuples that arrived before time T from stream A PSA(T): all punctuations that arrived before time T from stream A 2018/9/18 EDBT 2004
Obtaining Punctuations Punctuations are supplied by stream providers. Derive punctuations from application semantics: Key-to-foreign-key join: derive punctuation following each tuple at Key side Clustered data arrival: derive punctuation whenever different value is encountered Other application-specific semantics, e.g., bidding time constraint for each item in online auction application: derive punctuation whenever bidding time period for particular item expires 2018/9/18 EDBT 2004
Our Join Approach: PJoin 1st punctuation-exploiting join implementation Binary hash-based equi-join Optimized for reducing memory overhead Optimized for increasing data output rate Fine-tunable execution logic Targeting various optimization goals minimum memory overhead maximum tuple output rate Reacting to dynamic stream environment Component-based execution logic to enable fine-grained tuning. Event-driven component scheduling to enable intra-operator adaptivity. 2018/9/18 EDBT 2004
PJoin Execution Logic 2 … … 1 3 4 … … Join State (Memory-Resident Portion) State of Stream A (Sa) State of Stream B (Sb) Hash Table Hash Table Purge Cand. Pool Purge Cand. Pool 3 5 9 3 … … Punct. Set (PSa) Punct. Set (PSb) 1 3 <10 4 Hash(ta) = 1 Join State (Disk-Resident Portion) The main point here is to introduce the component. Hash Table Hash Table Tuple ta 3 5 9 3 … … Stream B Stream A 2018/9/18 EDBT 2004
PJoin Execution Logic … … … … Join State (Memory-Resident Portion) State of Stream A (Sa) State of Stream B (Sb) Hash Table Hash Table Purge Cand. Pool Purge Cand. Pool 3 5 9 … … Punct. Set (PSa) Punct. Set (PSb) 3 <10 Hash(pa) = 1 Join State (Disk-Resident Portion) The main point here is to introduce the component. Hash Table Hash Table Punctuation pa 3 5 9 3 … … Stream B Stream A 2018/9/18 EDBT 2004
PJoin Design Observations Design decision Join operation typically involve multiple subtasks Subtasks are executed at different frequencies Each subtask can be finer-tuned to target different optimization goals Design decision Break join execution logic into components Equip each component with various execution strategies Employ event-driven inter-component scheduling to allow flexible join execution logic configuration 2018/9/18 EDBT 2004
Join-Related Components Memory Join: join new tuple with in-memory state State Relocation: move part of in-memory state to disk Disk Join: join on-disk states Scheduling strategy Memory Join runs as main thread State Relocation is executed when memory is full Disk Join is scheduled when input queues are empty (depending on activation threshold) 2018/9/18 EDBT 2004
State Purge Eager purge Lazy purge purge condition: when a punctuation is received. Pros: guarantee minimum join state Cons: CPU overhead under frequent punctuations Lazy purge purge condition: when certain number of new punctuations are received; or when state is full Pros: reduce CPU overhead in searching for stale tuples Cons: stale tuples may stay for a longer time, thus affecting probe efficiency 2018/9/18 EDBT 2004
Punctuation Propagation Concerns Correctness: before propagate a punctuation, guarantee that no more result tuples matching this punctuation will be generated in future. Efficiency: detect propagable punctuations at cost of fewer state scans 2018/9/18 EDBT 2004
Punctuation Index Hash Table HTA Punctuation Set PSA Hash Bucket 1 pid count predicate indexed attributes timestamp pid 105 101 null 3 50 < Y < 100 true 101 null null 102 4 100 < Y < 200 true 102 102 Hash Bucket m attributes timestamp pid null 101 102 null 102 2018/9/18 EDBT 2004
Two Steps Punctuation Index building Eager build: build index once a punctuation is received Lazy build: build index when propagation is invoked Propagation Push mode: propagate punctuations when propagate threshold is reached Pull mode: propagate punctuations upon request from down-stream operators 2018/9/18 EDBT 2004
Event-driven Framework Runtime parameter monitoring and feedback mechanism Runtime changeable component coupling mode Memory Join Monitor Event Event Event Event Event State Relocation Disk Join State Purge Punctuation Index Build Punctuation Propagation 2018/9/18 EDBT 2004
Configuration Example Memory Join Monitor StreamEmpty+ Activation Threshold PurgeThreshold- Reach PropagateCount- Reach StateFull State Relocation Disk Join State Purge Punctuation Index Build Punctuation Propagation 2018/9/18 EDBT 2004
Event-Listener Registry Events Conditions Listeners StreamEmptyEvent Activation Threshold is reached Disk Join PurgeThreshold-ReachEvent - State Purge StateFullEvent C1* C2* State Relocation PropagateCount-ReachEvent Index Build, Propagation C1*: Punctuations exist that haven’t been used to purge state yet. C2*: No punctuations exist that haven’t been used to purge state. 2018/9/18 EDBT 2004
Experimental Study Experimental System Experiments CAPE : Continuous XQuery Processing System Stream benchmark: generate synthetic data streams by controlling arrival characteristics of data and punctuations 2.4GHz Intel(R) Pentium-IV CPU, 512MB RAM, Windows XP Experiments Compare PJoin with XJoin, a constraint-unaware operator Compare trade-offs between different state purge strategies Study PJoin under asymmetric punctuation inter-arrival rates Measurements: memory overhead and tuple output rate 2018/9/18 EDBT 2004
PJoin vs. XJoin: Memory Overhead Tuple inter-arrival: 2 milliseconds Punctuation inter-arrival: 40 tuples/punctuation 2018/9/18 EDBT 2004
PJoin vs. XJoin: Tuple Output Rate Tuple inter-arrival: 2 milliseconds Punctuation inter-arrival: 30 tuples/punctuation 2018/9/18 EDBT 2004
State Purge Strategies: Memory Overhead Tuple inter-arrival: 2 milliseconds Punctuation inter-arrival: 10 tuples/punctuation 2018/9/18 EDBT 2004
State Purge Strategies: Tuple Output Rate Tuple inter-arrival: 2 milliseconds Punctuation inter-arrival: 10 tuples/punctuation 2018/9/18 EDBT 2004
Asymmetric Punctuation Inter-arrival Rates: Memory Overhead Tuple inter-arrival: 2 milliseconds A Punctuation inter-arrival: 10 tuples/punctuation 2018/9/18 EDBT 2004
Asymmetric Punctuation Inter-arrival Rates: Tuple Output Rate Tuple inter-arrival: 2 milliseconds A Punctuation inter-arrival: 10 tuples/punctuation 2018/9/18 EDBT 2004
Observations Memory requirement for PJoin state almost insignificant compare to XJoin’s. Increase in join state of XJoin leading to increasing probe cost, thus affecting tuple output rate. Eager purge is best strategy for minimizing join state. Lazy purge with appropriate purge threshold provides significant advantage in increasing tuple output rate. 2018/9/18 EDBT 2004
Related Work Continuous Query Systems Aurora [Brandeis, Brown, MIT], TelegraphCQ [Berkeley], STREAM [Stanford], NiagaraCQ [Wisconsin] Constraint-exploiting join solutions Window joins [Wisconsin, Waterloo, Purdue] k-Constraint exploiting algorithm [Stanford] Punctuation fundamentals, purge and propagate rules [OGI]. Adaptive join solutions XJoin [Maryland] Ripple Join [Berkeley] 2018/9/18 EDBT 2004
Conclusion Contributions Future work Implement first punctuation-exploiting join solution Propose eager and lazy strategies for purging join state using punctuations. Propose eager and lazy strategies for propagating punctuations. Design event-driven framework for flexible join configuration Future work Support sliding window semantics Handle n-ary joins 2018/9/18 EDBT 2004
[ACC+03] D. Abadi et al. “Aurora: A New Model and Architecture for Data Stream Management”. VLDB Journal, 2003. [CCD+03] S. Chandrasekaran et al. “TelegraphCQ: Continuous Dataflow Processing for an Uncertain World”. CIDR, 2003. [MWA+03] R. Motwani et al. “Query Processing, Resource Management, and Approximation in a Data Stream Management System”. CIDR 2003. [WA93] A. N. Wilschut et al. “Dataflow Query Execution in a Parallel Main-memory Environment”. Distributed and Parallel Databases, 1993. [KNV03] J. Kang et al. “Evaluating Window Joins over Unbounded Streams”. ICDE, 2003. [GO03] L. Golab et al. “Processing Sliding Window Multi-joins in Continuous Queries over Data Streams”. VLDB, 2003. [HFA+03] M. Hammad et al. “Scheduling for Shared Window Joins over Data Streams”. VLDB, 2003. [BW02] S. Babu et al. “Exploiting k-Constraints to Reduce Memory Overhead in Continuous Queries over Data Streams”. Technical report, 2002. [TMS+03] P. Tucker et al. “Exploiting Punctuation Semantics in Continuous Data Streams”. IEEE TKDE, 2003. [UF00] T. Urhan et al. “A Reactively Scheduled Pipelined Join Operator”. IEEE Data Engineering Bulletin, 2000. [HH99] P. Hass et al. “Ripple Joins for Online Aggregation”. ACM SIGMOD, 1999. [MSH+02] S. Madden et al. “Continuously Adaptive Continuous Queries over Streams”. ACM SIGMOD, 2002. [IFF+99] Z.G. Ives et al. “An Adaptive Query Execution System for Data Integration”. ACM SIGMOD, 1999. 2018/9/18 EDBT 2004
Related Links Raindrop Project at WPI CAPE Project at WPI http://davis.wpi.edu/dsrg/Raindrop/ CAPE Project at WPI http://davis.wpi.edu/dsrg/CAPE/ WPI Database Systems Research Group http://davis.wpi.edu/dsrg/ 2018/9/18 EDBT 2004