Running the Benchmark

STREAM Online Help > Running the Benchmark

This section describes how to run the Linear Road Benchmark on the STREAM system.


About the Benchmark

The Linear Road Benchmark was developed by the Aurora Project to compare the performance of data stream applications on different systems. A mapping from the benchmark specification to CQL queries can be found here. We remind the user that the CQL syntax used in this mapping differs slightly from the CQL syntax supported currently by STREAM. The authoritative source on CQL query syntax supported by STREAM is available here. All queries on this page adhere to the latest CQL syntax supported by STREAM.


Running the Benchmark Setup Script

A script for registering the necessary streams and queries for the "Toll Notification" and "Toll Computation" queries (parts 1 and 2 of the benchmark) is included with the demo. To execute it, select the "Benchmark Setup" item from the "Scripts" menu.

This script registers some streams and intermediate relations, creates CQL Views for populating them, and then registers an output query. The exact commands that the script executes are listed at the end of this document.


Examining the Benchmark Query

Select the query beginning with "RSTREAM (SELECT E.car_id ..." from the "View" menu. This should bring up the following plan in the plan view pane:

The automatically generated layout can be a bit crowded. Recall that you can use the mouse to move objects around in the layout, and using the Shift key moves the entire subtree.

Starting around the middle left in the automatic layout, you can see the single input stream, CarLocStr, and you can see the chain of queues and operators composing the first CQL View query:

ISTREAM ( SELECT car_id, speed, expr_way, dir, x_pos/5280 AS seg FROM CarLocStr );
Other operators in the tree correspond to the other CQL View queries and finally, at the top, to the output query.

Information about the operators seen in the plan (and other plan entities in the STREAM system as well) can be found here.


Sending Car Location Data

Select the "CarLocStr" stream from the "Stream Source" menu. The stream source control that comes up can be used to send location tuples to the system and to generate toll notifications from the system.

The data is sent using a stream source file, and is an initial version of the Linear Road Benchmark data generated by the Aurora group.


Appendix: Commands Exececuted by the "Benchmark Setup" Script

1. Register Streams And Intermediate Relations
CarLocStr - Stream of car location reports. This forms primary input to the system. All the other streams and relations are computed from this one by CQL views and queries.

 REGISTER
      STREAM  CarLocStr  (  car_id  integer, speed  integer,  expr_way
      integer, lane integer, dir integer, x_pos integer );
CarSegStr - Same as CarLocStr stream, but with the location of the car replaced by the segment corresponding to the location.
REGISTER STREAM CarSegStr ( car_id     integer, 
                            speed      integer, 
                            expr_way   integer, 
                            dir        integer,
                            seg        integer );
CurCarSeg - Relation containing the current segment for each car.
REGISTER RELATION CurCarSeg ( car_id     integer, 
                              expr_way   integer, 
                              dir        integer,
                              seg        integer );
CarSegEntryStr - Stream of tuples each corresponding to entry of a car into a new segment. A car enters a new segment when a new entry appears in the CurCarSeg relation.
REGISTER STREAM CurSegEntryStr ( car_id     integer, 
                                 expr_way   integer, 
                                 dir        integer, 
                                 seg        integer );
SegAvgSpeed - The average speed of the cars in a segment over the last 5 minutes.
REGISTER RELATION SegAvgSpeed ( expr_way   integer, 
                                dir        integer, 
                                seg        integer, 
                                speed      float );
SegVolume - Relation containing the number of cars currently in a segment.
REGISTER RELATION SegVolume ( expr_way    integer, 
                              dir         integer,
                              seg         integer,
                              volume      integer );
SlowSegVolume - Relation containing 150 minus the volume of segments where the average speed is less than 40 miles per hour. This is important due to the formula by which tolls are calculated (see the benchmark specification).
REGISTER RELATION SlowSegVolume ( expr_way    integer, 
                                  dir         integer,
                                  seg         integer,
                                  volume      integer );
SquaredVolume - Same as SlowSegVolume, except that the volume column is replaced by the sqvol column, which contains the square of the volume for the segment. Note that this relation is only necessary because our system currently does not support arithmetic expressions involving more than one operation in SELECT clauses.
REGISTER RELATION SquaredVolume ( expr_way    integer, 
                                  dir         integer,
                                  seg         integer,
                                  sqvol       integer );
SegToll - Stream of tolls. Each car, on entering a segment, pays a toll determined by the current state of traffic in the segment, as specified in the benchmark.
REGISTER RELATION SegToll ( expr_way    integer, 
                            dir         integer,
                            seg         integer,
                            toll        integer );

2. Create CQL Views To Generate Intermediate Streams and Relations

into CarSegStr:

ISTREAM (
    SELECT car_id, speed, expr_way, dir, x_pos/5280 AS seg 
    FROM   CarLocStr
);
into CurCarSeg:
SELECT CarSegStr.car_id, expr_way, dir, seg 
FROM   CarSegStr PARTITION BY CarSegStr.car_id ROWS 1
into CarSegEntryStr:
ISTREAM (
    SELECT * FROM CurCarSeg
);
into SegAvgSpeed:
SELECT   expr_way, dir, seg, AVG(speed)
FROM     CarSegStr RANGE 5 MINUTES
GROUP BY expr_way, dir, seg;
into SegVolume:
SELECT   expr_way, dir, seg, COUNT(car_id) 
FROM     CurCarSeg 
GROUP BY expr_way, dir, seg;
into SlowSegVolume:
SELECT   S.expr_way, S.dir, S.seg, V.volume - 150 as vol
FROM     FROM SegAvgSpeed S, SevVolume V
WHERE    S.expr_way = V.expr_way AND S.dir = V.dir AND S.seg = V.seg AND S.speed < 40.0
into SquaredVolume:
SELECT   expr_way, dir, seg, volume * volume as sqvol
FROM     SlowSegVolume
into SegToll (note that we arbitrarily set the base toll to 5):
SELECT   expr_way, dir, seg, sqvol * 5 as toll
FROM     SquaredVolume

3. Register the Output Query

RSTREAM (
    SELECT  E.car_id, E.seg, T.toll 
    FROM    CarSegEntryStr E NOW, SegToll T
    WHERE   E.expr_way = T.expr_way AND E.dir = T.dir AND E.seg = T.seg
);

Last modified: Mon Dec 8 00:55:16 PST 2003