Upload
elfreda-hodge
View
214
Download
2
Tags:
Embed Size (px)
Citation preview
Dept. of Electrical Engineering and Computer Science,Northwestern University
Context-Aware Optimization of Continuous Query Maintenance
for Trajectories
Context-Aware Optimization of Continuous Query Maintenance
for Trajectories
For the Degree Master of Science
Hui DingDecember, 2005
Dept. of Electrical Engineering and Computer Science,
Northwestern University
OutlineOutline
1. Motivation1. Motivation
2. System Architecture2. System Architecture
3. Context-Aware Optimization3. Context-Aware Optimization
4. Experimental Evaluation4. Experimental Evaluation
3. Conclusion3. Conclusion
Dept. of Electrical Engineering and Computer Science,
Northwestern University
MotivationMotivation• Location-Based Services has become an enabling techn
ology for many novel classes of applications– Transportation planning– Context-Aware Tourist Information Provider– Digital Battlefield
• The key problem is the efficient management of:– Transient (location, time)
information of the moving objects– Various types of
spatio-temporal queries
pertaining to the objectsLocationupdate
Database Server
Moving Objects
Spatial Queries
Business Rules
Locationupdate
Dept. of Electrical Engineering and Computer Science,
Northwestern University
Motivation: Continuous Query Reevaluation
Motivation: Continuous Query Reevaluation
• Moving Object Database (MOD) differs from traditional database in that the data stored changes over time, due to the dynamic nature of moving objects
• Accordingly, the queries on such database may be instantaneous as well as continuous
• Consider the following query:
A
B
I-90
Andi: Give me the 4-star hotels within 5 miles on my way I-90 north
Dept. of Electrical Engineering and Computer Science,
Northwestern University
Motivation: Modeling Moving Objects in the Database
Motivation: Modeling Moving Objects in the Database
Moving objects can be modeled as follows:sequence of (location,time)updates (e.g., GPS-based)
Electronic maps + traffic distributionElectronic maps + traffic distributionpatterns + set of (to be visited) pointspatterns + set of (to be visited) points
=> => full trajectory
(location,time, Velocity Vector )updates
now ->
A trajectory is a piece-wise lA trajectory is a piece-wise linear function f: T -> (x, y) rinear function f: T -> (x, y) represented as a sequence epresented as a sequence of points (x1, y1, t1), (x2, yof points (x1, y1, t1), (x2, y2, t2), …, (xn, yn, tn)2, t2), …, (xn, yn, tn)
Realistic description:Realistic description:transportation vehicles, patrtransportation vehicles, patrol cars, delivery trucks, indiol cars, delivery trucks, individuals travel between homviduals travel between home and work…e and work…
Continuous Queries are Maintained on the trajectories!
Dept. of Electrical Engineering and Computer Science,
Northwestern University
Motivation: Reevaluating Continuous queries on trajectories
Motivation: Reevaluating Continuous queries on trajectories
• Traffic disturbances (accident, road work, fire, storm, etc.) , insertion/deletion of certain trajectory, modification to the query pattern
Q: It’s 12:30pm now, retrieve the public transportation buses within half a mile around NU campus between 2:00pm and 2:30pm, and send me the answer at 1:15pm.
=> answer set of query invalid, => re-evaluation necessary.
For example, a bus is delayed by an accident at 1:40pm and cannot be on campus between 2:00pm and 2:30pm
Dept. of Electrical Engineering and Computer Science,
Northwestern University
Motivation: ScenarioMotivation: Scenario
• Disturbance zone affects some moving objects’ trajectories in the future
• Queries need re-evaluation
• Our goal: optimize the response time it takes for re-evaluation
Dept. of Electrical Engineering and Computer Science,
Northwestern University
Motivation: Problem Statement -- Optimize the Reactive
Maintenance of Continuous Queries
Motivation: Problem Statement -- Optimize the Reactive
Maintenance of Continuous Queries
• Q3 need not be re-evaluated since its answer not affected
• Tr5 and Tr6 need not be considered when reevaluating Q1 and Q2 (not affected by disturbance!)
• Tr4 need not be considered since it is not relevant to pending queries
Dept. of Electrical Engineering and Computer Science,
Northwestern University
System ArchitectureSystem Architecture
Stored Procedures
Main Memory
CacheTable
Moving Object Table
Answers andAnswer Updates
TrafficAbnormality
PostQuery
DatabaseDist.Zone
ZoneID
...Time
Duration
Traffic Abnormality Table
DatabaseQueryRegion
QueryID
...CurrentAnswer
Query Table
Traj.Shape ...
PendingQuery
... ......
TrajID
DatabaseQuery Optimizer
SDO_GEOMETRY type
Linear ReferencingSystem
Index EngineQuery Operators
GeometryEngine
Triggers
Context Parser andExtraction
User Interface
...
Traj.Shape ...
PendingQuery
TrajID
Traj.Shape ...
PendingQuery
TrajID
Dept. of Electrical Engineering and Computer Science,
Northwestern University
System Architecture :Main Components
System Architecture :Main Components
Database Tables
Database Triggers Query Trigger TR_Q:
ON UPDATE TO MOT
IF A_Q Affected
Update A_Q
Queries Table (QT)
Traj.Shape
. . . PendingQuery
. . . . . . . . . . . .
TrajID
Moving Object TableDatabaseQuery
RegionQuery
ID...
CurrentAnswer
Query TableDatabaseDist.
ZoneZone
ID...
TimeDuration
Traffic Abnormality Table
Moving Objects table (MOT)Traffic Abnormalities Table (TAT)
ON INSERT/UPDATE TO TAT
IF trajectories in MOT affected
UPDATE MOT.traj_shape
Traffic monitoring Trigger TR_TAT:
Dept. of Electrical Engineering and Computer Science,
Northwestern University
System Architecture: Queries Considered in Our System
System Architecture: Queries Considered in Our System
• Range Query– Retrieve the moving objects within a given region
during a time interval
• Within Distance Query– Retrieve the moving objects within a given distance
to a querying object
• KNN Query– Retrieve the K nearest neighbors to the querying
object
Dept. of Electrical Engineering and Computer Science,
Northwestern University
Context-Aware Optimization:Guideline
Context-Aware Optimization:Guideline
• Carefully avoid context-switching cost– System level– Intra-query level
• Intelligently reduce disk access and computation volume– Utilizing spatio-temporal context information e
mbedded in the queries/moving objects
Dept. of Electrical Engineering and Computer Science,
Northwestern University
Context-Aware Optimization: System-level Context-awarenessContext-Aware Optimization: System-level Context-awareness
• minimize the context-switching among OS processes (semantics of individual trigger execution)
Set-level vs. Instance-level query re-evaluation
Traji d1Traji d2Traji d3Traji d4Traji d5
fl ags
fl ags
fl ags
fl ags
fl ags
………
………
Queryi d1
Queryi d2
Queryi d3
……
……
……
……
Moving Object TableQuery Table
Re-eval uateaf ter al l
are updated
Traji d1Traji d2Traji d3Traji d4Traji d5
fl ags
fl ags
fl ags
fl ags
fl ags
………
………
Queryi d1
Queryi d2
Queryi d3
……
……
……
……
Moving Object Table Query TableRe-evaluateafter Update
Re-evaluate afterUpdate
Re-evaluate afterUpdate
Re-evaluate afterUpdate
Re-evaluate afterUpdate
Dept. of Electrical Engineering and Computer Science,
Northwestern University
Context-Aware Optimization: System-level Context-awarenessContext-Aware Optimization: System-level Context-awareness“Before” vs. “After” trigger for query re-evaluation
Traji d1Traji d2Traji d3Traji d4Traji d5
fl ags
fl ags
fl ags
fl ags
fl ags
………
………
Movi ng Obj ects Tabl e
Traji d6Traji d7 fl ags
fl ags
Database
Check foraffected
trajectories
LoadTrajectories for
Updates
Update Queryanswer
?Before After
Dept. of Electrical Engineering and Computer Science,
Northwestern University
Context-Aware Optimization:Intra-query level Context-Awareness
Context-Aware Optimization:Intra-query level Context-Awareness
• Chances of performance tuning: the three steps of reevaluation1. Between affected moving objects and unaffected queries
2. Between affected queries and unaffected moving objects
3. Between affected moving objects and affected queries
Report TrafficAbnormality
Moving Object Trajectories
Pending Queries
UpdatedTrajectories
Affected?
UpdatedQueries
Affected?
3
2 1
Dept. of Electrical Engineering and Computer Science,
Northwestern University
Context-Aware Optimization: Query Indexing
Context-Aware Optimization: Query Indexing
• When reevaluating unaffected queries against affected trajectories, index on the pending queries is used to limit search space
• Construct Minimum Bounding Box on the fly and use it to retrieve queries that need to be reevaluated
• For Within Distance query and KNN query, index is maintained on the segments of the queries instead of the trajectories to improve selectivity
R1
WD1
WD2
K NN1
K NN2
R2
Dept. of Electrical Engineering and Computer Science,
Northwestern University
Context-Aware Optimization: Query Ordering
Context-Aware Optimization: Query Ordering
• When reevaluating affected queries against unaffected trajectories, we use query ordering to take advantage of the operating system cache
• The space ordering is imposed by using space-filling curve
R3
R1
R2
R4
Dept. of Electrical Engineering and Computer Science,
Northwestern University
Context-Aware Optimization: Join++ -- Spatio-Temporal PeculiaritiesContext-Aware Optimization: Join++ -- Spatio-Temporal Peculiarities
• When reevaluating affected queries against affected trajectories, we proposed a spatio-temporal join algorithm to reduce the amount of computation required
Tra
ffic
A
bno
rmal
ity
Pen
ding
Q
uerie
sM
ovin
g O
bjec
t T
raje
ctor
ies
Updat
e Q
uery
Updat
e T
raje
ctor
y
Spl
itT
raje
ctor
y
Update GridLists forQueries
Sort UpdatedTrajectorySegments
Spatio-Temporal Join
Dept. of Electrical Engineering and Computer Science,
Northwestern University
Context-Aware Optimization:Spatio-temporal Join ExampleContext-Aware Optimization:
Spatio-temporal Join Example
Q1
Q2
Q3
Tr1
Tr2
Tr3 Tr4
Tr5Tr6
(0, 10)
05
10
10
16 20
25
40
0
3
17
2
11
15
20
25
0 4
8 12
0
6
12
1824
0
2
6
10
Dept. of Electrical Engineering and Computer Science,
Northwestern University
Experimental EvaluationExperimental Evaluation
• System-level Context-Awareness
• Intra-Query level Context-Awareness– Query Indexing– Query Ordering– Spatio-temporal Join
• Overall performance study
Dept. of Electrical Engineering and Computer Science,
Northwestern University
Experimental Evaluation: system-level context-awareness
Experimental Evaluation: system-level context-awareness
• “Before “ trigger reduce response time significantly due to the savings in disk access
• Set-level trigger out performs tuple-level trigger, but this is somewhat diminished by the dominant disk access and computation time
Dept. of Electrical Engineering and Computer Science,
Northwestern University
Experimental Evaluation: system-level context-awareness
Experimental Evaluation: system-level context-awareness
Range Query
Dept. of Electrical Engineering and Computer Science,
Northwestern University
Experimental Evaluation: system-level context-awareness
Experimental Evaluation: system-level context-awareness
Within Distance Query
Dept. of Electrical Engineering and Computer Science,
Northwestern University
Experimental Evaluation: system-level context-awareness
Experimental Evaluation: system-level context-awareness
K-Nearest Neighbor Query
Dept. of Electrical Engineering and Computer Science,
Northwestern University
Experimental Evaluation: Query IndexingExperimental Evaluation: Query Indexing
Range Query – 100 Affected Trajectories
Dept. of Electrical Engineering and Computer Science,
Northwestern University
Experimental Evaluation: Query IndexingExperimental Evaluation: Query Indexing
Range Query – 200 Affected Trajectories
Dept. of Electrical Engineering and Computer Science,
Northwestern University
Experimental Evaluation: Query IndexingExperimental Evaluation: Query Indexing
Within Distance Query – 100 Affected Trajectories
Dept. of Electrical Engineering and Computer Science,
Northwestern University
Experimental Evaluation: Query IndexingExperimental Evaluation: Query Indexing
KNN Query – 100 Affected Trajectories
Dept. of Electrical Engineering and Computer Science,
Northwestern University
Experimental Evaluation: Query OrderingExperimental Evaluation: Query Ordering
Ordering of A Group of Pending Range Queries
Dept. of Electrical Engineering and Computer Science,
Northwestern University
Experimental Evaluation: Query orderingExperimental Evaluation: Query ordering
Ordering of A Group of Within Distance Queries
Dept. of Electrical Engineering and Computer Science,
Northwestern University
Experimental Evaluation:Spatio-temporal Join
Experimental Evaluation:Spatio-temporal Join
Dept. of Electrical Engineering and Computer Science,
Northwestern University
Experimental evaluation:overall performance
Experimental evaluation:overall performance
• Context-aware approach can make query reevaluation 3 times faster than the naive approach
Dept. of Electrical Engineering and Computer Science,
Northwestern University
ConclusionConclusion
• Investigated the impact of various context-dimension on the reevaluation of pending queries
• Reduced response time to traffic abnormality by utilizing the spatio-temporal correlation between the queries and the (updated) trajectories
• Implemented a system that maintains correct answers to three types of major continuous queries
Dept. of Electrical Engineering and Computer Science,
Northwestern University
Ongoing work: OMCAT DemoOngoing work: OMCAT Demo
Dept. of Electrical Engineering and Computer Science,Northwestern University
THANK YOU!THANK YOU!