Download Context-Aware Optimization of Continuous Query Maintenance

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Theoretical computer science wikipedia , lookup

Transcript
Context-Aware Optimization of
Continuous Query Maintenance
for Trajectories
For the Degree Master of Science
Hui Ding
December, 2005
Dept. of Electrical Engineering and Computer Science,
Northwestern University
Outline
1. Motivation
2. System
Architecture
3. Context-Aware Optimization
4. Experimental Evaluation
3. Conclusion
Dept. of Electrical Engineering and Computer Science,
Northwestern University
Motivation
• Location-Based Services has become an enabling
technology 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 objects
Location
update
Location
update
Database Server
Moving Objects
Spatial Queries
Business Rules
Dept. of Electrical Engineering and Computer Science,
Northwestern University
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:
B
Andi: Give me the 4-star hotels
within 5 miles on my way I-90 north
I-90
A
Dept. of Electrical Engineering and Computer Science,
Northwestern University
Motivation: Modeling Moving
Objects in the Database
Moving objects can be modeled as follows:
sequence of (location,time)
updates (e.g., GPS-based)
(location,time, Velocity Vector )
updates
Electronic maps + traffic distribution
patterns + set of (to be visited) points
=> full trajectory
now ->

A trajectory is a piece-wise
linear function f: T -> (x, y)
represented as a sequence
of points (x1, y1, t1), (x2,
y2, t2), …, (xn, yn, tn)

Realistic description:
transportation vehicles,
patrol cars, delivery trucks,
individuals travel between
home and work…
Continuous Queries
are Maintained on
the trajectories!
Dept. of Electrical Engineering and Computer Science,
Northwestern University
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: 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
• 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 Architecture
Traffic
Abnormality
Answers and
Answer Updates
Post
Query
User Interface
Context Parser and
Extraction
Moving Object Table
Traj
ID
Traj
ID
...
Traj
ID
Traj.
Shape
Traj.
Shape
...
Traj.
Shape
...
...
...
...
Pending
Query
Pending
Query
...
Pending
Query
SDO_GEOMETRY type
Triggers
Index Engine
Query Operators
Geometry
Engine
Query Table
Query
ID
Query Database
...
Region
Current
Answer
Linear Referencing
System
Traffic Abnormality Table
Zone
ID
Dist.
Zone
Database
...
Time
Duration
Databas
e
Query Optimizer
Stored
Procedures
Cache
Table
Main Memory
Dept. of Electrical Engineering and Computer Science,
Northwestern University
System Architecture :
Main Components
 Database Tables
Moving
Objects table (MOT)
Traffic Abnormalities Table (TAT)
Queries
Table (QT)
 Database Triggers

Query Trigger TR_Q:
ON
IF
INSERT/UPDATE TO TAT
Traffic Abnormality Table
Dist. Database Time
...
Duration
Zone
Traffic monitoring Trigger TR_TAT:
ON
trajectories in MOT affected
UPDATE
Zone
ID

UPDATE TO MOT
IF A_Q Affected
MOT.traj_shape
Update A_Q
Moving Object Table
Traj
ID
Traj.
Shape
...
Pending
Query
...
...
...
...
Query Table
Query Query Database Current
...
ID
Region
Answer
Dept. of Electrical Engineering and Computer Science,
Northwestern University
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
• Carefully avoid context-switching cost
– System level
– Intra-query level
• Intelligently reduce disk access and
computation volume
– Utilizing spatio-temporal context information
embedded in the queries/moving objects
Dept. of Electrical Engineering and Computer Science,
Northwestern University
Context-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
Moving Object Table
Moving Object Table
Traj
id1
Traj
id2
Traj
id3
Traj
id4
Traj
id5
Query Table
flags
………
flags
flags
flags
………
Query
……
id1
flags
Re-evaluate
after all
are updated
Query
……
id2
Query
……
id3
……
Traj
id1
Traj
id2
Traj
id3
Traj
id4
Traj
id5
flags
………
flags
flags
flags
………
Dept. of Electrical Engineering and Computer Science,
Northwestern University
flags
Re-evaluate
after Update
Query Table
Re-evaluate after
Update
Query
……
id1
Re-evaluate after
Update
Re-evaluate after
Update
Query
……
id2
Re-evaluate after
Update
Query
……
id3
……
Context-Aware Optimization:
System-level Context-awareness
“Before” vs. “After” trigger for query re-evaluation
Database
Moving Objects Table
Check for
affected
trajectories
Load
Trajectories for
Updates
Before
?
After
Traj
id1
Traj
id2
Traj
id3
Traj
id4
Traj
id5
Traj
id6
Traj
id7
flags
………
flags
flags
flags
………
Update Query
answer
Dept. of Electrical Engineering and Computer Science,
Northwestern University
flags
flags
flags
Context-Aware Optimization:
Intra-query level Context-Awareness
•
Chances of performance tuning: the three steps of
reevaluation
1. Between affected moving objects and unaffected queries
2. Between affected queries and unaffected moving objects
3. Between affected moving objects and affected queries
3
Updated
Trajectories
Updated
Queries
Affected?
Affected?
2
1
Moving Object
Trajectories
Pending
Queries
Report Traffic
Abnormality
Dept. of Electrical Engineering and Computer Science,
Northwestern University
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
W
selectivity
D2
KN
N1
KN
N2
R1
W
D1
R2
Dept. of Electrical Engineering and Computer Science,
Northwestern University
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 spacefilling curve
R2
R1
R3
R4
Dept. of Electrical Engineering and Computer Science,
Northwestern University
Context-Aware Optimization:
Join++ -- Spatio-Temporal Peculiarities
• When reevaluating affected queries against
affected trajectories, we proposed a spatiotemporal join algorithm to reduce the amount of
computation required
Sort Updated
T
r
A a
b ffic
n
o
rm
a
lit
y
U
Tp
d
raa
jete
ct
o
ry
M
oT
vi r
na
g je
Oct
bo
je ri
ct e
s
P
e
nQ
du
ine
gri
e
s
U
pQ
d
au
tee
ry
Trajectory
Segments
S
p
T lit
ra
je
ct
o
ry
SpatioTemporal Join
Update Grid
Lists for
Queries
Dept. of Electrical Engineering and Computer Science,
Northwestern University
Context-Aware Optimization:
Spatio-temporal Join Example
Tr5
17
Q2 25
3
Tr6
0
20
25
15
Q3
24
18
d
2
11
16
20
40
12
10
6
Tr3 10
6
Tr2
Q1
0
10
Tr1
4
12
2
0
ro
of
8
Tr4
0
0
5
(0,10)
Dept. of Electrical Engineering and Computer Science,
Northwestern University
Experimental 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
• “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
Dept. of Electrical Engineering and Computer Science,
Northwestern University
Range Query
Experimental Evaluation:
system-level context-awareness
Dept. of Electrical Engineering and Computer Science,
Northwestern University
Within Distance Query
Experimental Evaluation:
system-level context-awareness
Dept. of Electrical Engineering and Computer Science,
Northwestern University
K-Nearest Neighbor Query
Experimental Evaluation: Query Indexing
Range Query – 100 Affected Trajectories
Dept. of Electrical Engineering and Computer Science,
Northwestern University
Experimental Evaluation: Query Indexing
Range Query – 200 Affected Trajectories
Dept. of Electrical Engineering and Computer Science,
Northwestern University
Experimental Evaluation: Query Indexing
Within Distance Query – 100 Affected Trajectories
Dept. of Electrical Engineering and Computer Science,
Northwestern University
Experimental Evaluation: Query Indexing
KNN Query – 100 Affected Trajectories
Dept. of Electrical Engineering and Computer Science,
Northwestern University
Experimental Evaluation: Query Ordering
Dept. of Electrical Engineering and Computer Science,
Northwestern University
Ordering of A Group of Pending Range Queries
Experimental Evaluation: Query ordering
Dept. of Electrical Engineering and Computer Science,
Northwestern University
Ordering of A Group of Within Distance Queries
Experimental Evaluation:
Spatio-temporal Join
Dept. of Electrical Engineering and Computer Science,
Northwestern University
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
Conclusion
• Investigated the impact of various contextdimension 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 Demo
Dept. of Electrical Engineering and Computer Science,
Northwestern University
THANK YOU!
Dept. of Electrical Engineering and Computer Science,
Northwestern University