declarative network monitoring with an underprovisioned ...on passive network monitoring, an...

18
Declarative Network Monitoring with an Underprovisioned Query Processor (Extended Version) Frederick Ralph Reiss Joseph M. Hellerstein Electrical Engineering and Computer Sciences University of California at Berkeley Technical Report No. UCB/EECS-2006-38 http://www.eecs.berkeley.edu/Pubs/TechRpts/2006/EECS-2006-38.html April 10, 2006

Upload: others

Post on 24-Sep-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Declarative Network Monitoring with an Underprovisioned ...on passive network monitoring, an application in which the data rates typically exhibit a large peak-to-average ratio. Provisioning

Declarative Network Monitoring with anUnderprovisioned Query Processor (Extended

Version)

Frederick Ralph ReissJoseph M. Hellerstein

Electrical Engineering and Computer SciencesUniversity of California at Berkeley

Technical Report No. UCB/EECS-2006-38

http://www.eecs.berkeley.edu/Pubs/TechRpts/2006/EECS-2006-38.html

April 10, 2006

Page 2: Declarative Network Monitoring with an Underprovisioned ...on passive network monitoring, an application in which the data rates typically exhibit a large peak-to-average ratio. Provisioning

Copyright © 2006, by the author(s).All rights reserved.

Permission to make digital or hard copies of all or part of this work forpersonal or classroom use is granted without fee provided that copies arenot made or distributed for profit or commercial advantage and that copiesbear this notice and the full citation on the first page. To copy otherwise, torepublish, to post on servers or to redistribute to lists, requires prior specificpermission.

Acknowledgement

This work was supported by an NDSEG fellowship, aswell as by a grant from the National Science Foundation,award number IIS-0205647.

Page 3: Declarative Network Monitoring with an Underprovisioned ...on passive network monitoring, an application in which the data rates typically exhibit a large peak-to-average ratio. Provisioning

Declarative Network Monitoring with an Underprovisioned Query Processor(Extended Version)

Frederick ReissU.C. Berkeley

Joseph M. HellersteinU.C. Berkeley

Abstract

Many of the data sources used in stream query process-ing are known to exhibit bursty behavior. We focus hereon passive network monitoring, an application in which thedata rates typically exhibit a large peak-to-average ratio.Provisioning a stream query processor to handle peak ratesin such a setting can be prohibitively expensive.

In this paper, we propose to solve this problem by pro-visioning the query processor for typical data rates insteadof much higher peak data rates. To enable this strategy, wepresent mechanisms and policies for managing the trade-offs between the latency and accuracy of query results whenbursts exceed the steady-state capacity of the query proces-sor.

We describe the current status of our implementation andpresent experimental results on a testbed network monitor-ing application to demonstrate the utility of our approach.

1 Introduction

Many of the emerging applications in stream query pro-cessing are known to exhibit high-speed, bursty data rates.The behavior of data streams in such applications is char-acterized by relatively long periods of calm, punctuated by“bursts” of high-speed data. The peak data rate exhibited ina burst is typically many times the average data rate.

In this paper, we focus on an application that is particu-larly prone to bursty data: passive network monitoring. Apassive network monitor (See Figure 1) is a device attachedto a high-traffic network link that monitors and analyzes thepackets on the link.

There has been significant interest in bringing the powerof declarative queries to passive network monitors [8, 16].Declarative queries are easy to change in response to theevolution of networked applications, protocols and attacks,and they free network operators from the drudgery of hand-optimizing their monitoring code.

However, high-speed bursts and tight time constraintsmake implementing declarative query processing for net-work monitoring a difficult problem. The bursty nature ofnetwork traffic is well-documented in the literature [21, 25].Situations like SYN floods can multiply the effects of bursts

Network 1 Network 2

Passive Monitor

Figure 1: A typical passive network monitoring setup.

by increasing bandwidth usage and decreasing packet sizesimultaneously. Under such situations, even keeping simplecounters during bursts is considered difficult [11]. Burstsoften produce not only more data, but also different datathan usual. This will often be the case, for example, in crisisscenarios, such as a denial of service attack or a flash crowd.Because network operators need real-time data on the statusof their networks, network monitors need to provide timelyanswers under bursty load without dropping packets.

Many researchers have attempted to bring declarativequeries to network monitoring by scaling up the query en-gine to the network’s peak rate through various approaches.Some systems accelerate query processing with custom,reconfigurable, or parallel hardware [29]. Other systemsconstruct queries by connecting blocks of highly-optimizedspecial-purpose code [8]. Additionally, researchers have de-veloped algorithms and data structures for computing ap-proximate answers in small amounts of time and space[13, 5, 7].

Realistically, making query processing scale to “linespeed” involves compromises. Custom hardware is expen-sive; specialized code limits the flexibility of the query lan-guage; approximate query answers are inferior to exact an-swers.

In this paper, we navigate these compromises with a dif-ferent approach. We do not scale our query processor to thenetwork’s maximum speed. Instead, we use a query proces-sor that can provide timely, exact answers under the typicalload on the network connection. This normal load can be anorder of magnitude lower than the maximum load.

Of course, bursts will exceed the steady-state capacity ofa system that is configured in such a way. This overloadcan lead to increased latency of query results, if the system

1

Page 4: Declarative Network Monitoring with an Underprovisioned ...on passive network monitoring, an application in which the data rates typically exhibit a large peak-to-average ratio. Provisioning

buffers excess data; or decreased query result accuracy, ifthe system discards excess data. The key to provisioningfor typical data rates is to manage the overload behavior ofthe system.

To meet this goal, we allow the user to specify delay con-straints that bound the latency of query results. Our systemmanages its buffering to ensure that it satisfies the user’sdelay constraints. When it is impossible to meet a delayconstraint while processing all input data, we apply approx-imate query processing techniques to minimize the impacton query result accuracy. To enable this tight integrationof buffer management and approximation without extensivemodifications to our query engine, we have developed an ar-chitecture that we call Data Triage.

2 Technical Contributions

The remaining sections of this paper describe our solu-tions to the technical challenges of provisioning for typicalnetwork load. From a query processing standpoint, the maincontributions of this paper are as follows:

• Taking advantage of the bursty nature of network traf-fic to reduce the cost of provisioning a declarative net-work monitor (Section 5)

• Using windowed delay constraints to drive adaptiveload shedding (Section 6)

• The Data Triage architecture (Section 8)• Implementation of approximation and Data Triage

without modifications to the core query engine (Sec-tions 8 and 9)

• Stream query processing experiments with timing-accurate network traces (Section 11)

3 Related Work

Overload handling is a natural concern in stream queryprocessing, and several pieces of previous work have pro-posed solutions to the problem.

The Aurora continuous query system sheds excess loadby inserting drop operators into its dataflow network [32].Our work differs from this approach in two ways: Firstof all, we use fixed end-to-end delay constraints, whereasAurora’s drop operators minimize a local cost functiongiven the resources available. Secondly, our system adap-tively falls back on approximation in overload situations,while Aurora handles overload by dropping tuples from thedataflow.

Other work has focused on choosing the right tuples todrop in the event of overload [9, 18, 30]. Our work is com-plementary to these approaches. In this paper, we do notfocus on choosing “victim” tuples in the event of overflow;rather, we develop a framework that sends the victim tuplesthrough a fast, approximate data path to maintain boundedend-to-end latency. Choosing the right victim tuples forData Triage is an important piece of future work.

Other stream processing systems have focused on usingpurely approximate query processing as a way of handlinghigh load [4, 20]. Load shedding systems that use this ap-proach lossily compress sets of tuples and perform queryprocessing on the compressed sets. The STREAM datamanager [12] uses either dropping or synopses to handleload. In general, this previous work has focused on situa-tions in which the steady-state workload of the query pro-cessor exceeds its capacity to process input streams; we fo-cus here on provisioning a system to handle the steady statewell and to degrade gracefully when bursts lead to tempo-rary overload.

Real-time databases focus on providing answers to staticqueries within tight time bounds. CASE-DB [24] is a real-time database system that meets its real-time constraintsby giving approximate answers to queries. Our windoweddelay constraints differ from this previous work in thatwe maintain timing constraints continuously over unpre-dictable streaming data.

An overview of ongoing work on Data Triage appearedas a short paper in ICDE 2005 [27].

4 Query Model

The work in this paper uses the query model of the cur-rent development version of TelegraphCQ [6]. Queries inTelegraphCQ are expressed in CQL [2], a stream query lan-guage based on SQL. Data streams in TelegraphCQ consistof sequences of timestamped relational tuples. Users createstreams and tables using a variant of SQL’s Data DefinitionLanguage, as illustrated in Figure 2.

−− Stream of IP header information.−− The ”inet” type encapsulates a 32−bit IP addresscreate stream Packets (

src addr inet , dest ddr inet ,length integer, ts timestamp)type unarchived;

−− Table of WHOIS informationcreate table Whois (min addr inet, max addr inet,

name varchar);

Figure 2: Schema for the queries in Figure 3.

In addition to traditional SQL query processing, Tele-graphCQ allows users to specify long-running continuousqueries over data streams and/or static tables. In this paper,we focus on continuous queries.

The basic building block of a continuous query in Tele-graphCQ is a SELECT statement similar to the SELECT state-ment in SQL. These statements can perform selections, pro-jections, joins, and time windowing operations over streamsand tables.

TelegraphCQ can combine multiple SELECT statementsby using a variant of the SQL99 WITH construct. The im-

2

Page 5: Declarative Network Monitoring with an Underprovisioned ...on passive network monitoring, an application in which the data rates typically exhibit a large peak-to-average ratio. Provisioning

plementation of the WITH clause in TelegraphCQ supportsrecursive queries, but we do not consider recursion in thispaper.

The specifications of time windows in TelegraphCQ con-sist of RANGE and optional SLIDE and START parameters.Different values of these parameters can specify sliding,hopping (also known as tumbling), or jumping windows.For ease of exposition, we limit ourselves in this paper tothe case where RANGE and SLIDE are equal; that is, to hop-ping windows. We briefly discuss the extension of our workto general sliding windows in Section 8.3.

Figure 3 gives several example network monitoringqueries that demonstrate the utility of this query model.We will use the first of these queries as a running examplethroughout the paper.

−− Fetch all packets from Berkeleyselect ∗

from Packets P [range by ’5 seconds’slide by ’5 seconds’ ],

Whois Wwhere P.src addr ≥W.min addr

and P.src addr < W.max addrand W.name like ’%berkeley.edu’;

−− Compute a traffic matrix (aggregate traffic−− between source−destination pairs), updating−− every 5 secondsselect P.src addr , P.dest addr , sum(P.length)from Packets P [range by ’30 sec’ slide by ’5 sec’ ]group by P.src addr, P.dest addr ;

−− Find all <source, destination > pairs that transmit−− more than 1000 packets for two 10−second windows−− in a row.with

Elephants asselect P.src addr , P.dest addr , count(∗)from Packets P [range ’10 sec’ slide ’10 sec’ ]group by P.src addr, P.dest addrhaving count(∗) > 1000

(select P.src addr , P.dest addr , count(∗)from Packets P [range ’10 sec’ slide ’10 sec’ ],

Elephants E [range ’10 sec’ slide ’10 sec’ ]−− Note that Elephants is offset−− by one window!

where P.src addr = E.src addrand P.dest addr = E.dest addr

group by P.src addr, P.dest addrhaving count(∗) > 1000);

Figure 3: Sample queries in TelegraphCQ CQL

0

0.002

0.004

0.006

0.008

0.01

0.012

0 200 400 600 800 1000 1200

Pro

babi

lity

Den

sity

Packets Per 1-Second Window

Figure 4: Distribution of packet rates in a trace of HTTPtraffic from www.lbl.gov.

5 Data Rates in Passive Network Monitoring

Having provided a brief overview of the necessary back-ground material, we now turn to the main topic of this pa-per: Taking advantage of bursty network traffic to reducethe cost of monitoring networks with a stream query pro-cessor.

Analyses of network traffic from a wide variety ofsources have shown them to exhibit self-similar, bursty be-havior along a number of dimensions [21, 25]. In this pa-per, we focus on one of these parameters, the rate of packetarrival. Packet arrival rates tend to follow heavy-tailed dis-tributions, with high-speed bursts occurring over a broadrange of time scales [28]. For example, Figure 4 shows thedistribution of packet arrival rates in a trace from the webserver www.lbl.gov.

Network monitoring systems are typically provisionedwith sufficient CPU capacity to handle the maximum packetarrival rate on the network connection. Because of theheavy-tailed distribution of packet arrival rates, this max-imum rate tends to be significantly higher than the vast ma-jority of network traffic.

In this paper, we advocate provisioning a network mon-itor to handle the 90th to 95th percentile of traffic. Thisapproach allows significant reductions in the CPU require-ments of the monitor, while enabling the monitor to processall data most of the time.

For example, Figure 5 shows the ratio between the 80ththrough 100th percentiles of the packet arrival rate distribu-tion in Figure 4. This analysis is conservative, in that weassume that the maximum rate observed in our trace is themaximum rate the connection can sustain. Assuming thatthe network monitor’s CPU requirements are proportionalto packet arrival rate, provisioning for the 95th percentileof packet arrival rate would reduce CPU requirements formonitoring this network connection by 76 percent.

3

Page 6: Declarative Network Monitoring with an Underprovisioned ...on passive network monitoring, an application in which the data rates typically exhibit a large peak-to-average ratio. Provisioning

80 85 90 95 1000

20

40

60

80

100

Dat

a R

ate

(% o

f max

)

76% reduction in data rate at

95th percentile

Percentile of Time Windows

Figure 5: The ratio between the maximum data rate in thetrace in 4 and the 80th to 100th percentile packet arrivalrates. Provisioning a network monitor for the 95th per-centile of this distribution reduces CPU requirements by 76percent.

5.1 Microbenchmark Analysis

The analysis in the previous section is encouraging, butits naive application is not very effective. Figure 6 showsthe results of an experiment to measure the actual latencyof query results.

The data source for this experiment was the packet traceused in the previous section. We played back this tracethrough TelegraphCQ, using a schema similar to that in Fig-ure 2. We configured TelegraphCQ to run the query:

select count(*)from Packets [range ’10 sec’ slide ’10 sec’];

To simulate a less-powerful machine, we increased theplayback rate of the trace by a factor of 10 and reduced thequery window by a factor of 10. At these settings, our queryprocessor was provisioned for the 90th percentile of packetarrival rates. The graph shows the observed latency betweenquery result generation and the end of each time window.

The results of this experiment demonstrate that naivelyprovisioning the query processor for “typical” data rate cancause unacceptable increases in latency. The largest de-lays occur because the query processor does not follow thesecond assumption we made in the previous section: thatprocessing the data from a given window does not inter-fere with processing of subsequent windows. Longer burstscause cumulative increases in latency across time windows.

In the sections that follow, we propose the use of delayconstraints to codify acceptable delay and the Data Triagearchitecture to ensure that a query processor meets its delayconstraints.

6 Delay Constraints

While it has the potential to reduce significantly the costof network monitoring hardware, the strategy of provision-ing for typical load leads to tradeoffs with query result la-

0 100 200 300 400 500012345678

Offset into Trace (sec)

Que

ry R

esul

t Lat

ency

(sec

)

Figure 6: Query result latency for a simple aggregationquery over a 10-second time window. The query proces-sor is provisioned for the 90th percentile of packet arrivalrates. Data is a trace of a web server’s network traffic.

tency. Navigating these tradeoffs in a principled way re-quires a way for the user to specify what constitutes accept-able latency for a given query.

A delay constraint is a user-defined bound on the latencybetween data arrival and query result generation. Figure7 shows an example our proposed syntax for delay con-straints. Our modification to CQL adds the optional clause

LIMIT DELAY TO [interval]

to the end of the SELECT statement.

select count(∗)from Packets P [range by ’5 seconds’

slide by ’5 seconds’ ],Whois Wwhere P.src\string addr ≥W.min\string addr

and P.src\ string addr < W.max\string addrand W.name LIKE ’\%berkeley.edu’

limit delay to ’1 second’;

Figure 7: Sample query with a delay constraint

If the SELECT clause does not involve windowed aggre-gation, the delay constraint bounds the delay between thearrival of a tuple and the production of its correspondingjoin results. When the SELECT clause contains a windowedaggregate, the delay constraint becomes what we call a win-dowed delay constraint. A windowed delay constraint ofD seconds means that the aggregate results for a time win-dow are available at most D seconds after then end of thewindow.

Most of the monitoring queries we have studied containwindowed GROUP BY and aggregation, so we concentratehere on delay constraints for windowed queries.

4

Page 7: Declarative Network Monitoring with an Underprovisioned ...on passive network monitoring, an application in which the data rates typically exhibit a large peak-to-average ratio. Provisioning

Variable Units DescriptionD sec The delay constraintW sec Size of the query’s hopping windowC f ull sec

(CPU)Incremental CPU cost of sending a tuplethrough the main query in Data Triage

Cshadow sec(CPU)

Cost of sending a tuple through theshadow query

Ctup sec(CPU)

Overall cost of processing a tuple

Csum sec(CPU)

CPU cost of adding a tuple to a summary

Rpeaktuples

sec The highest data rate that Data Triagecan handle

Rexacttuples

sec The highest data rate at which DataTriage does not use approximation

Table 1: Variables used in Sections 6 through 8

Table 1 summarizes the variable names used in this sec-tion and the ones that follow. Consider a query with ahopping time window of size W and a windowed delayconstraint of D seconds. Let wt denote the time windowto which a given tuple t belongs, and let Ctup denote themarginal cost of processing a tuple. We assume that Ctup isconstant across all tuples; we discuss relaxing this assump-tion in the Future Work section. Let end(w) denote the endof window w.

The delay constraint defines a delivery deadline for eachtuple t of

deadline(t) = end(wt)+D−Ctup (1)

It can be easily shown that, if the query processor consumesevery tuple before its delivery deadline, then the query en-gine satisfies the delay constraint.

We note that every tuple in a hopping window has thesame deadline. During the remainder of this paper, we de-note the deadline for the tuples in window w by deadline(w)

7 Satisfying Delay Constraints

In the previous section, we introduced the concept of de-lay constraints as a way for the application to specify itstolerance for query result latency.

The overall goal of our work is to satisfy delay con-straints with a query processor that is provisioned for the90th to 95th percentile of its data rates. To handle bursts,such a query processor needs a mechanism for trading offthe accuracy of query results against increased data process-ing speed. To provide such a mechanism, we leverage theextensive previous work in approximate query processing.

7.1 Approximate Query Processing with Sum-maries

Much work has been done on approximate relationalquery processing using lossy set summaries. Originally in-tended for query optimization and interactive data analysis,these techniques have also shown promise as a fast and ap-proximate method of stream query processing. Examples ofsummary schemes include random sampling [33, 1], multi-dimensional histograms [26, 17, 10, 31], and wavelet-basedhistograms [5, 22].

The focus of this paper is not to develop new methods ofapproximate query processing. Instead, we leverage previ-ous work to manage latency and accuracy with bursty datastreams. Because no single summarization method has beenshown to dominate all others, we have developed and im-plemented a framework that allows us to employ a broadspectrum of techniques.

Our framework divides a given summarization schemeinto four components:

• A summary data structure that provides a compact,lossy representation of a set of relational tuples

• A compression function that constructs summariesfrom sets of tuples.

• A set of operators that compute relational algebra ex-pressions in the summary domain.

• A rendering function that computes aggregate valuesor generates a representative set of tuples from a sum-mary.

These primitives allow one to approximate continuousqueries of the type described in Section 4. First, summarizethe tuples in the current time window, then run these sum-maries through a tree of operators, and finally render theapproximate result.

In addition to the primitives listed above, each approx-imation technique also has one or more tuning parame-ters. Examples of such parameters include sample rate, his-togram bucket width, and number of wavelet coefficients.The tuning parameters control the tradeoff between process-ing time and approximation error.

With the current state-of-the-art in summarization tech-niques, the tuning parameters need to be set prior to the cre-ation of the summary. Of course, a query processor that em-ploys approximation to meet delay constraints cannot pre-dict whether a burst will occur in the current time window.Such a system must tune its summaries to the maximumdata rate that could possibly occur.

Unfortunately, the values of the tuning parameters thatenable such a high data rate will result in relatively highapproximation errors. The summarization technique willovercompress the present data, because it cannot predict thefuture behavior of the stream.

Our solution to this problem is to use approximation as a“safety valve” rather than a primary data path. Our system

5

Page 8: Declarative Network Monitoring with an Underprovisioned ...on passive network monitoring, an application in which the data rates typically exhibit a large peak-to-average ratio. Provisioning

Tria

ge L

ayer

Que

ry E

ngin

e

Initial Filteringand Parsing

The shadow query computes approximately what results are missing from the main query

ShadowQuery

Summaries ofSets of Tuples

The main portion of the query operates without regard to load-shedding.

Main Query

TriagedTuples

MergeResults

Summarizer

TriageScheduler

TriageQueue

Summaries ofMissing Results

RawPackets

Figure 8: An overview of the Data Triage architecture. DataTriage acts as a middleware layer within the network mon-itor, isolating the real-time components from the best-effortquery processor to maintain end-to-end responsiveness.

maintains two data paths: one that uses normal query pro-cessng and one that uses approximation. The system onlysends tuples through the approximate data path when pro-cessing those tuples fully would violate the delay constraint.

8 Data Triage

In the previous section, we motivated our approach ofusing approximation as a fallback mechanism to satisfy de-lay constraints. Implementing this approach without majormodifications to the query engine leads to an architecturethat we call Data Triage.

Figure 8 gives an overview of the Data Triage architec-ture. This architecture consists of several components:

• The initial parsing and filtering layer of the systemdecodes network packets and produces streams of re-lational tuples containing detailed information aboutthe packet stream. Our current implementation of thislayer is based on the low-level packet-processing rou-tines of the Bro intrusion detection system [11].

• The Main Query operates inside a stream query pro-cessor, in our case TelegraphCQ. The user-specifiedquery consumes tuples from the initial parsing and fil-tering layer. Architecturally, the key characteristic of

the main query is that it is tuned to operate at the net-work’s typical data rate. Data Triage protects the mainquery from data rates that exceed its capacity.

• A Triage Queue sits between each stream of tuples andthe main query. Triage Queues act as buffers to smoothout small bursts, and they provide a mechanism forsome data to the approximate data path when there isnot enough time to perform full query processing onevery tuple.

• The Triage Scheduler manages the Triage Queues toensure that the system delivers query results on time.The Scheduler manages end-to-end delay by triagingexcess tuples from the Triage Queues, sending thesetuples through a fast but approximate alternate datap-ath. We give a detailed description of our schedulingalgorithms and delay constraints in Section 8.1.

• The Summarizer builds summary data structures con-taining information about the tuples that the Schedulerhas triaged. The Summarizer then encapsulates thesesummaries and sends them to the query engine for ap-proximate query processing.

• The shadow query uses approximate query processingover summary data structures to compute the resultsthat are missing from the main query.

We have implemented Data Triage in the TelegraphCQstream query processor. In the process of doing so, we over-came several challenges. The sections that follow describethe approaches we used to construct simple and efficient so-lutions to these problems:• Choosing which tuples to triage and when to triage

them (Section 8.1)

• Constructing approximate shadow queries efficiently(Sections 8.2 and 9)

• Determining the maximum data rate that Data Triagecan support with a given approximation technique(Section 8.4).

8.1 The Triage Scheduler

The Triage Scheduler is the control component of DataTriage, with control over the Triage Queue and the Summa-rizer. The scheduler’s primary purpose is to ensure that thesystem meets the delay constraint. The Triage Schedulermeets this goal by controlling three important decisions:

• Whether to send a tuple from the Triage Queue to themain query

• Whether to “triage” a tuple from the Triage Queue, byadding it to a summary

• When to transfer the current summary from the Sum-marizer to the shadow query.

Sending tuples to the summarizer supports significantlyhigher data rates, but compression operations do not have

6

Page 9: Declarative Network Monitoring with an Underprovisioned ...on passive network monitoring, an application in which the data rates typically exhibit a large peak-to-average ratio. Provisioning

nonzero cost. As we will show in our experiments, sum-marizing a large number of triaged tuples requires a rela-tively small but still significant amount of CPU time. Like-wise, relational operations on summaries can take a signifi-cant amount of time, though they only occur once per timewindow. In order to satisfy the user’s delay constraints,the Triage Scheduler needs to take these costs into accountwhen deciding which tuples to triage and when to triagethem.

Recall from the previous section that a delay constraintof D defines a tuple delivery deadline of deadline(t) =end(wt)+ D−Ctup for each tuple t, where Ctup is the timerequired to process the tuple.

In the Data Triage architecture, the value of Ctup de-pends on which datapath a tuple follows. Let C f ull de-note the CPU time required to send a tuple through themain query, and let Csum denote the CPU time to add atuple to the current summary. Then we have: Ctup ={

C f ull (for main query)Csum (for shadow query)The Triage Scheduler also needs to account for the cost

of sending summaries through the shadow query. We letCshadow denote the cost per time window of the shadowquery, including the cost of merging query results. We as-sume that Cshadow is constant regardless of the number oftuples triaged. We revisit this assumption in Section ??.

Cshadow is a per-window cost. We assume that the systemuses a single CPU. Under this assumption, an increase inCshadow decreases the amount of processing time availablefor other operations.

Incorporating the costs of the approx-imate datapath into the deadline equationfrom Section 6, we obtain the new equation:

deadline(w) = end(w)+D−Cshadow−{

C f ull (for main query)Csum (for shadow query) (2)

In other words, the deadline for a tuple depends on whetherthe tuple is triaged. Of course, whether the tuple is triageddepends on the tuple’s deadline.

We can satisfy all the above requirements with a singlescheduling invariant. Intuitively:

Time to process remainingtuples in window ≤ Time before delay con-

straint violated.

(3)More formally, letting n denote the number of tuples in

the Triage Queue, W the window size, O the real-time offsetinto the current window, and C f ull the cost of sending a tuplethrough the main query:

nC f ull ≤W +D−Cshadow−O, (4)

or equivalently

n ≤(

W +D−Cshadow

C f ull

)− O

C f ull. (5)

As long as the Triage Scheduler maintains this invariant(by triaging enough tuples to keep n sufficiently low), the

Offset into Window (sec)

Effe

ctiv

e Q

ueue

Len

gth

WCshadow

D

0 1 2 3 4 5 6 70

1000

2000

3000

4000

5000

6000 Next window

Effective queue length for this window

Figure 9: The effective length of the Triage Queue for tuplesbelonging to a 5-second time window, as a function of offsetinto the window. The delay constraint is 2 seconds, andCshadow is 1 second.

query processor will satisfy its delay constraint. We notethat the Scheduler must maintain the invariant simultane-ously for all windows whose tuples could be in the TriageQueue.

It is important to note that n, the number of tuples thatcan reside in the Triage Queue without violating this invari-ant, decreases linearly throughout each time window. Onecould imagine using a fixed queue length to satisfy the in-variant, but doing so would require a queue length of theminimum value of n over the entire window. In other words,using a fixed-length queue causes the system to triage tuplesunnecessarily. In keeping with our philosophy of using ap-proximation as a fallback mechanism, our scheduler avoidstriaging tuples for as long as possible by continuously vary-ing the number of tuples from the window that are permittedto reside in the Triage Queue. Figure 9 illustrates this vari-ation in effective queue length.

8.2 Approximate Query Processing Framework

Another challenge of implementing Data Triage isadding the approximate query processing components to thequery engine without rearchitecting the system. We havemet this challenge by developing a common framework fordifferent types of approximate query processing and map-ping this framework onto TelegraphCQ’s object-relationalcapabilities. This implementation permits the use of manydifferent summary types and minimizes changes to the Tele-graphCQ query engine.

At the core of a summary scheme is the summarizationdata structure, which provides a compact, lossy representa-tion of a set of relational tuples. We used the user-defineddatatype functionality of TelegraphCQ to implement sev-eral types of summary data structure, including reservoirsamples, two types of multidimensional histograms, andwavelet-based histograms.

7

Page 10: Declarative Network Monitoring with an Underprovisioned ...on passive network monitoring, an application in which the data rates typically exhibit a large peak-to-average ratio. Provisioning

The second component of a summary scheme is a com-pression function for summarizing sets of tuples. One wayto implement these is as functions that take a set of tuplesas an argument and return a summary. To avoid the spaceoverhead of storing large sets of tuples, our implementationtakes in a stream of tuples and incrementally adds them tothe summary.

The third component of a summary scheme is a set ofrelational operators that operate on the summary domain.Once summaries are stored in objects, it is straightforwardto implement relational operators as functions on these ob-jects. For example, some of the operators for the MHISTmultidimensional histogram type [26] are as follows:

−− Project S down to the indicated columns.create function project (S MHIST,

colnames cstring )returns MHIST as ...

−− Approximate SQL’s UNION ALL construct.create function union all (S MHIST, T MHIST)

returns MHIST as ...

−− Compute approximate equijoin of S and T.create function equijoin (

S MHIST, S colname cstring,T MHIST, T colname cstring)

returns MHIST as ...

The final component of a summary scheme is a renderingfunction that computes aggregate values from a summary.TelegraphCQ contains functionality from PostgreSQL forconstructing functions that return sets of tuples. We use thisset-returning function framework to implement the render-ing functions for the different datatypes:

−− Convert S into tuples, one tuple for each bucketcreate function mhist render(S MHIST)

returns setof record as ...

Having implemented the components of a given sum-marization scheme, we can construct Data Triage’s shadowqueries and merging logic using query rewriting. Section 9demonstrates this process on a simple example query.

8.3 General Sliding Windows

The previous sections have described our implementa-tion of Data Triage as it applies to nonoverlapping, or “hop-ping,” time windows. Extending this work to multiplequeries with general sliding windows is straightforward.

Briefly, the framework described in this paper can ac-comodate arbitrary combinations of TelegraphCQ windowclauses with the following changes:• Use the method described in [19] to convert overlap-

ping time windows to a repeating sequence of nonover-lapping windows.

• Compute delay constraints for each of the nonover-lapping windows by determining the query delay con-straints that apply at a given point in the sequence.

• When constructing shadow queries, use user-definedaggregates to merge summaries from adjacent win-dows as needed.

In the remainder this section, we explain the first and lastof these steps in greater detail.

8.3.1 Converting overlapping windows

The main challenge in supporting general sliding windowsis that the windows can overlap. In particular, a tuple couldbelong to any number of time windows. If a tuple can be amember of n windows, we would like to avoid adding thetuple to n summaries.

Krishnamurthy et al. have developed a general methodof converting any combination of overlapping window spec-ifications into a sequence of nonoverlapping time windows.The idea behind this approach is to create a new nonoverlap-ping window whenever one of the overlapping windows ad-vances. The transformation produces a repeating sequenceof overlapping windows of varying widths. The TriageScheduler produces a summary for each of these nonover-lapping windows.

8.3.2 Using aggregates to merge summaries

Once we have converted a sliding window to a set ofnonoverlapping hopping windows, we need an efficient wayto merge sets of adjacent hopping windows into a singlesliding window. To perform this merging, we create a user-defined aggregate function that computes the approximateUNION ALL a set of summaries:

create aggregate Summary agg(sfunc = union all ,basetype = Summary,stype = Summary

);

We can now write a subquery that fetches a “custom”summary of the dropped tuples in a particular window. Forease of exposition, we present this subquery as a view:

−− Where <fraction in window> and−− <window number> are SQL expressions.create view R dropped windowed asselect

Summary agg( R.summary ) as summaryfrom triaged R [ original window spec]

8.4 Provisioning Data Triage

Data Triage uses approximate query processing as a fall-back mechanism to ensure that an underprovisioned queryprocessor can meet a delay constraint. The effectiveness

8

Page 11: Declarative Network Monitoring with an Underprovisioned ...on passive network monitoring, an application in which the data rates typically exhibit a large peak-to-average ratio. Provisioning

of this approach of course depends on the summary imple-mentation being faster than the general-purpose query pro-cessor.

In particular, we would like to know:• If the approximation method in Data Triage’s shadow

query performs at a given level, what degree of under-provisioning will Data Triage permit?

• How quickly can different query approximation meth-ods process data?

In this section, we address both of these questions. Westart with a theoretical analysis of approximate query pro-cessing performance as it applies to Data Triage, then weapply our theory to an experimental analysis of several ap-proximation methodologies.

As in previous sections, our analysis assumes that thetime windows in the user’s query are hopping windows.

8.4.1 Data Triage and System Capacity

An important design goal of Data Triage is what we call theDo-no-harm principle:

If the system has time to process all the tuplesin a time window fully, it should do so.

Data Triage operates in two regimes: Up to a certaindata rate Rexact , the system performs exact query process-ing. Above Rexact , Data Triage must resort to approximationto handle data rates up to a maximum of Rpeak.

We characterize the CPU cost of a summarization/ap-proximation scheme by two parameters, Cshadow and Csum.We assume for ease of exposition that these parameters areconstants; similar conclusions can be reached by treatingCshadow and Csum as random variables.

In the paragraphs that follow, we derive the relationshipbetween the summarization parameters, Cshadow and Csum,and the system capacity parameters, Rexact and Rpeak.

8.4.2 Cshadow

Recall that Cshadow represents the CPU cost incurred bysending a summary through the shadow query.

The maximum possible value of Rexact is 1C f ull

, the rateat which the main query can consume tuples. If the user’squery involves hopping windows of length W and it takesC f ull to process a tuple in the main query, then the numberof tuples that the main query can process in a single windowis

W −Cshadow

C f ull. (6)

Effectively, Rexact is reduced by a factor of 1− CshadowW .

Additionally, since the system cannot send a summary tothe shadow query until the end of a time window, Cshadowserves as a lower bound on the delay constraint.

In summary, Cshadow constrains the query parameters Dand W . In order for Data Triage to work effectively, the

value of Cshadow needs to be less than the delay constraint Dand small relative to the window size W .

8.4.3 Csum

Csum represents the incremental CPU cost of adding a singletuple to a summary.

In contrast to Cshadow, Csum is a per-tuple cost. The valueof Csum limits Rpeak, the maximum instantaneous rate atwhich tuples can enter the system.

The system must be able to summarize incoming tuplesquickly enough to meet its delay constraint. The TriageQueue can contain tuples from up to

⌊WD

⌋+ 1 windows at

once, and the number of tuples from each window that can

reside in the Triage Queue decreases at a rate of 1C f ull

tuplessec .

Since the system must be able to handle a sustained load ofRpeak without dropping any tuples, we have

Rpeak =(

1− Cshadow

W

)(1

Csum−

(⌊WD

⌋+1

)1

C f ull

)(7)

Note that, Cshadow �W and Csum �C f ull , then Rpeak ≈1

Csum.

In summary, the ratio between Csum and C f ull (the timeto process a tuple in the main query) acts as a bound on thecost savings through underprovisioning.

8.5 Performance Analysis of ApproximationTechniques

We have implemented several summary types within theframework we described earlier in this paper:• Multidimensional histograms with a fixed grid of

buckets

• MHIST multidimensional histograms [26]

• Wavelet-based histograms [23]

• Reservoir sampling [33]All of the approximation schemes we studied allow the

user to adjust the tradeoff between speed and accuracy bychanging a summary granularity parameter. For exam-ple, reservoir sampling uses a sample size parameter, andwavelet-based histograms keep a fixed number of waveletcoefficients.

We conducted a microbenchmark study to determine therelationship between summary granularity and the parame-ters Csum and Cshadow for our implementations.

8.5.1 Measuring Csum

Our first experiment measured Csum, the CPU cost of insert-ing a tuple into each of the data structures.

The experiment inserted randomly-generated two-column tuples into the summaries. We measured the in-sertion cost across a range of summary granularities.

9

Page 12: Declarative Network Monitoring with an Underprovisioned ...on passive network monitoring, an application in which the data rates typically exhibit a large peak-to-average ratio. Provisioning

0 20000 40000 60000

se

c/tu

ple

(lo

g s

ca

le)

Summary Size (buckets/coeffs/tuples)

MHISTFixed-Grid Hist

Wavelet-Based HistReservoir Sample

10–1

10–3

10–5

10–7

Figure 10: The CPU cost of inserting a tuple into the fourtypes of summary we implemented. The X axis representsthe granularity of the summary data structure.

Figure 10 shows the results of this experiment; note thelogarithmic scale on the y axis. The X axis represents sum-mary granularity, measured by the number of histogrambuckets, wavelet coefficients, or sampled tuples.

The insertion cost for reservoir sampling was extremelylow, though it did increase somewhat at larger sample sizes,probably due to caching effects.

Fixed-grid histograms provided low insertion timesacross a wide variety of data structure sizes. The insertionoperation on such a histogram is a simple index into an ar-ray, and cache effects were not significant at the summarysizes we examined.

The insertion cost for wavelet-based histograms in-creased somewhat with summary size, primarily due to thecost of sorting to find the largest wavelet coefficients. Thisincrease was only a factor of 2 across the entire range ofwavelet sizes.

MHISTs exhibited a relatively high insertion cost thatbecame progressively worse as the number of buckets wasincreased. For more than a few hundred buckets, insertioninto our MHIST implementation would slower than normaltuple processing. The high insertion cost stems mostly fromthe lack of an index to the MHIST buckets. Using a kd-tree [3] to map tuples to buckets would rectify this problem.Even with these optimizations, our MHIST implementationwould still have a higher insertion cost than the other sum-maries, as evidenced by the leftmost point on the curve.

8.6 Measuring Cshadow

Our second experiment measured the value of theCshadow constant as a function of summary granularity. Theexperiment measured the cost of performing the shadowquery for a stream-table join query.

Figure 11 shows our results. The cost of the join wassensitive to summary size for all summaries studied. Thejoin costs of the four summary types were separated by sig-nificant constant factors, with MHISTs taking the longest,

0 20000 40000 60000 800000

5

10

15

20

MH

IST Sa

mple

Wavelet-Based Histogram

Fixed-Grid Histogram

Summary Size (buckets/coeffs/samples)

Cos

t Per

Win

dow

(sec

)

Figure 11: The time required to compute a single window ofa shadow query using four kinds of summary data structure.The X axis represents the granularity of the summaries; theY axis represents execution time.

followed by reservoir samples, wavelet-based histograms,and fixed-grid histograms.

Again, MHISTs were significantly slower than the otherhistogram-based summaries. In this case, the discrepancywas due to MHIST buckets not being aligned with eachother along the join dimension. This misalignment meantthat each bucket joined with several other buckets and pro-duced a large number of result buckets.

We also conducted a version of this experiment in whichwe varied the number of tuples inserted into the summaries.Beyond 100 tuples, the cost of the shadow query was insen-sitive to the number of tuples. We omit detailed results dueto space constraints.

8.6.1 Discussion

Our evaluation of the four approximation schemes we haveimplemented shows that three of them can summarize tu-ples fast enough to be useful for Data Triage. In the cur-rent version of TelegraphCQ, C f ull , the time to process a tu-ple in a conventional query, typically ranges from 1×10−4

to 1× 10−3 seconds, depending on query complexity. Thecompression functions for the three summary types can con-sume tuples considerably faster, with Csum values of approx-imately 1×10−5 for fixed-grid or wavelet-based histogramsand 1× 10−6 for samples. We expect these times to dropsignificantly as we optimize our code.

Our shadow query microbenchmark shows that simplefixed-grid histograms have very small values of Cshadow,even at very fine summary granularities. Even accountingfor their relatively inefficient partitioning function, thesesimple histograms should work better than the other sum-mary types studied for queries with short time windows ortight delay constraints.

10

Page 13: Declarative Network Monitoring with an Underprovisioned ...on passive network monitoring, an application in which the data rates typically exhibit a large peak-to-average ratio. Provisioning

select hist_to_count( hist_project( hist_bandjoin( (select summary from CachedHist where entryname = ‘Whois’), TP.summary, ‘Packets.src_addr’, ‘Whois.min_addr’, ‘Whois.max_addr’ ), ‘Packets.src_addr’ ) ) as shadow, TP.end_ts as tsFrom __triaged_Packets TP;

Shadow Query

insert into CachedHistsselect ‘Whois’, hist_from_query( ‘select min_addr, max_addr from Whois where name like \’%berkeley.edu\’’);

Precompute Static PortionsOriginal QueryOriginal Queryselect count(*), tsfrom Packets P [range ’5 seconds’ slide ’5 seconds’], Whois Wwhere P.src_addr >= W.min_addr and P.src_addr < W.max_addr and W.name LIKE ’%berkeley.edu’limit delay to ’1 second’;

DifferentialRelational Algebra

Final QueryMain Query

ShadowQuery

Packets-Packets+

Packetsnoisy

Whois-Whois+

Whoisnoisy

MergeQuery

with(select count(*)...) as main_q,(select hist_to_count(...)) as shadow_q,(select M.count as main_count, S.count as shadow_count, M.ts as ts from main_q M [range ‘5 seconds’], full outer join shadow_q S [range ‘5 seconds’] where M.ts = S.ts);

Figure 12: An illustration of the Data Triage query rewrite algorithm as applied to an example query. The algorithm pro-duces a main query, a shadow query, and auxiliary glue queries to merge their results. This example uses multidimensionalhistograms as a summary datatype.

9 Lifetime of a Query

To illustrate the methods we use to construct shadowqueries and how these methods interact with our imple-mentation of Data Triage, we will now describe the queryrewrite and execution process as it applies to the query inFigure 7. The query reports the number of packets comingfrom Berkeley domains every 5 seconds.

9.1 Summary Streams

Recall the sample CQL schema from Section 4. Thisschema contains a table of WHOIS information and astream, Packet, of information about network packets.

To use Data Triage in TelegraphCQ, the user adds an ONOVERLOAD clause to each CREATE STREAM statement:

create stream Packets ...on overload keep MHIST;

This clause specifies the type of summary that Data Triagewill construct on excess tuples in the stream. We plan to al-low the user to choose the summary type at query executiontime in a future version of TelegraphCQ.

The ON OVERLOAD clause causes TelegraphCQ to gener-ate an auxiliary summary stream for summaries of triagedtuples:

create streamtriaged Packets (summary MHIST,

earliest timestamp,latest timestamp);

The two Timestamp fields in this stream indicate the rangeof timestamps in the tuples represented by the summaryfield. The summary stream will serve as an input to allshadow queries that operate on the Packets stream. 1

9.2 Query Rewrite

Figure 12 shows the query rewrite process as appliedto our sample query. Our query rewriting methodology isbased on an algebraic formalism that allows us to correctlyrewrite queries into shadow queries. We use relational al-gebra to build a set of differential relational algebra opera-tors. Our approach here resembles past work in maintainingmaterialized views [14], though our setting is different.

Briefly, each differential operator propagates changesfrom the inputs to the outputs of the corresponding rela-tional algebra operator. The differential relational algebradivides each relation S into noisy, additive noise, and sub-

1Our system also creates a second summary stream that summarizesnon-triaged tuples. This second stream is only necessary for queries withstream-stream joins and is only activated for such queries.

11

Page 14: Declarative Network Monitoring with an Underprovisioned ...on passive network monitoring, an application in which the data rates typically exhibit a large peak-to-average ratio. Provisioning

tractive noise components2 Snoisy, S+ and S−, such that:

Snoisy ≡ S +S+−S− (8)

where + and − are the multiset union and multiset differ-ence operators, respectively.

Our query rewriter starts by constructing a differentialrelational algebra expression for each SELECT clause in theoriginal query. Each differential operator is defined in termsof the basic relational operators. The query rewriter recur-sively applies these definitions to the differential relationalalgebra expression to obtain a relational algebra expressionfor the tuples that are missing from the main query’s out-put. Then the query rewriter removes empty relations andtranslates the relational algebra expression into the object-relational framework we described in Section 8.2 to producethe shadow query.

Certain portions of the shadow query reference static ta-bles that do not change during the lifetime of the user’scontinuous query. The query rewriter precomputes theseexpressions and stores the resulting summary objects in asystem table. At runtime, the shadow query fetches thesecached summaries instead of recomputing the correspond-ing subexpressions.

Finally, the query rewriter generates a single WITH state-ment that will run the main and shadow queries and mergetheir results. The user submits this rewritten query to thequery engine, which begins executing the main and shadowqueries.

9.3 Query Execution

When the rewritten query enters the system, the Tele-graphCQ engine passes the delay constraint and windowsize to the Triage Scheduler. The Scheduler monitors theTriage Queue on the Packets stream and summarizes tu-ples that the system does not have time to process fully.Once per time window, the Scheduler sends a summary tothe __triaged_Packets stream that serves as an input tothe shadow query.

The original query returns a single count of packets pertime window. In place of this single count, the rewrittenquery will instead return two counts per time window —one from the main query and one from the shadow query.The user can add these two counts to obtain an estimate ofthe true query results. Keeping the results of the main andshadow queries separate provides feedback as to how muchapproximation went into the overall result.

10 Differential Relational Algebra

In this section, we define a set of differential oper-ators that correspond to the relational algebra operators

2The additive noise component is necessary because operations likenegation and set difference can cause additional tuples to appear in an ex-pression’s output when tuples are removed from its inputs.

〈σ ,π,×,−〉. The crux of these derivations is to capture theeffects on relational algebra expressions when tuples disap-pear from their base relations.

10.1 Selection

We create the differential selection operatorσ̂(Snoisy,S+,S−) ≡ (Rnoisy,R+,R−) from the standardselection operator σ as follows:

σ̂(Snoisy,S+,S−)≡ (σ(Snoisy),σ(S+),σ(S−)). (9)

Intuitively, the differential selection operator simply ap-plies traditional selection to all three channels.

10.2 Projection

The definition of the differential projection operator issimilar to that of the differential selection operator:

π̂(Snoisy,S+,S−)≡ (π(Snoisy),π(S+),π(S−)). (10)

It is important to note that the differential projection op-erator only works properly for multisets. The problem ofhandling these SELECT DISTINCT queries is one that weare currently investigating.

10.3 Cross Product

The definition of the differential cross-product operatoris more complicated than the previous two operators.

Since

Snoisy ≡ S +S+−S− (11)Tnoisy ≡ T +T+−T−, (12)

for any relations S and T , we have

S×T = Snoisy×Tnoisy

−S+×T+

−S+× (Tnoisy−T+)−(Snoisy−S+)×T+

+S−×T−+S−× (Tnoisy−T+)+(Snoisy−S+)×T−).

Figure 13 shows the intuition behind the above formula.Accordingly, we define the differential cross product op-

erator ×̂ as

(Snoisy,S+,S−)×̂(Tnoisy,T+,T−)≡ (Rnoisy,R+,R−) (13)

where

Rnoisy = Snoisy×Tnoisy

and

12

Page 15: Declarative Network Monitoring with an Underprovisioned ...on passive network monitoring, an application in which the data rates typically exhibit a large peak-to-average ratio. Provisioning

S

T

(S-S )

Snoisy

noisy noisy

Tnoisy

S-

T-

-

(T-T )-

S+

T+

S×T

S ×T

Figure 13: Intuitive version of the differential cross prod-uct definition. The large square represents the tuples in thecross-product of (S+S+) with (T +T+), borrowing a visualmetaphor from Ripple Join [15]. The smaller shaded squareinside the large square represents the cross product of theoriginal relations S and T . The speckled square representsthe cross product of these two relations after the tuples in S−and T− are removed and the tuples in S+ and T− are addedto S and T , respectively. The differential cross product com-putes the difference between these two cross products. Notethat Snoisy−S+ = S−S−.

R+ = S+×T+

+S+× (Tnoisy−T+)+(Snoisy−S+)×T+

andR− = S−×T−

+S−× (Tnoisy−T+)+(Snoisy−S+)×T−).

10.4 Join

The derivation of the differential join operator followsthe same line of reasoning as that of the differential crossproduct operator and produces essentially the same defini-tion. For brevity, we omit this derivation.

10.5 Set Difference

The set difference operator has the interesting propertythat removing tuples from one of its inputs can add tuplesto its output. We model this behavior by defining the differ-ential set difference operator −̂ as

(Snoisy,S+,S−)−̂(Tnoisy,T+,T−)≡ (Rnoisy,R+,R−), (14)

5 sec

2 sec

10 sec delay constraint

Without Data Triage

10

20

30

0 0

10

20

30

0 10 20 30 40 50

Que

ry R

esul

t Del

ay (s

ec)

Window Number (10-second windows)

With Data Triage:

Burst from t=180-240 sec

Figure 15: A comparison of query result latency with andwithout Data Triage on with the system provisioned for the90th percentile of load. The data stream was a timing-accurate trace of a web server. Each line is the average of10 runs fo the experiment.

where

Rnoisy = Snoisy−Tnoisy

andR+ = (S+−Tnoisy)

+((T−−S+)∩Snoisy)and

R− = (S+∩T−)+((Snoisy∩T+)−S+)+(S−−T−−Tnoisy)

Figure 14 gives an intuition for this defintion.

11 Experimental Validation

We conducted experiments on our prototype implemen-tation of Data Triage to measure how well it satisfieddelay constraints in a realistic environment. We used a105-MB trace of the traffic to and from the HTTP serverwww.lbl.gov as the input to our experiments.

The query used in the experiments was a variant of theexample query from earlier in the paper. The current imple-mentation of band joins in TelegraphCQ is inefficient, so wemodified the query to be an equijoin on the most significant16 bits of the IP address instead.

We ran our experiments on a server with two 1.4 GHzPentium III CPUs and 1.5 GB of main memory. To simulateusing a less powerful embedded CPU, we wrote a programthat would “play back” the trace at a multiple of its originalspeed and decreased the delay constraint and window sizeof the query accordingly. We used reservoir samples as theapproximation method for this experiment. We adjusted thetrace playback rate to 10 times the original rate. At this datarate, our system was provisioned for the 90th percentile ofpacket arrival rates in our trace.

13

Page 16: Declarative Network Monitoring with an Underprovisioned ...on passive network monitoring, an application in which the data rates typically exhibit a large peak-to-average ratio. Provisioning

S-T-

T+S+

noisy noisyTT

SS-

S-T-

T+

S+

noisy noisyTnoisyT

SnoisyS -

Figure 14: Intuitive version of the definition of the differential set difference operator, (Snoisy,S+,S−)−̂(Tnoisy,T+,T−). Thisoperator computes a delta between (Snoisy−Tnoisy) and (S−T ), where Snoisy represents the tuples that remain in S after thequery processor drops some of its input tuples. The shaded area in the Venn Diagram on the left contains the tuples in(Snoisy−Tnoisy), and the shaded area in the diagram on the right contains the tuples in (S−T ). The shaded regions outlinedin bold in one Venn diagram are not shaded in the other diagram.

11.1 Latency

For our first experiment, we ran the query both withand without Data Triage and measured the latency of queryresults. We determined latency by measuring the time atwhich the system output the result for each window and sub-tracting the window’s last timestamp from this figure. Werepeated the experiment 10 times and recorded the averagelatency for each time window.

Figure 15 shows a graph of query result latency dur-ing the first 500 seconds of the trace. The the line marked“Without Data Triage” shows the latency of the query on anunmodified version of TelegraphCQ. The other lines showthe latency of TelegraphCQ with Data Triage and delay con-straints of 10, 5, and 2 seconds, respectively.

Approximately 180 seconds into the trace, a 50-secondburst exceeds the query processor’s capacity. WithoutData Triage, the unmodified version of TelegraphCQ fallssteadily behind the trace and does not catch up until 90 sec-onds after the end of the burst.

With Data Triage enabled, the Triage Scheduler shuntsexcess tuples to the shadow query as needed to satisfy thedelay constraint. As the graph shows, the system triages justenough tuples to avoid violating the constraint, performingfull processing on as much of the input data as possible.

11.2 Result Accuracy

Our second experiment measured the accuracy of queryresults with three methods of satisfying a 2-second delayconstraint. We measured result error using a root-mean-

0 10 20 30 40 50

Ave

rage

RM

S E

rror

Window Number (10-second windows)

0

50

100 200 300 400

Data Triage

Drop ExcessTuples

Summarize All

Figure 16: A comparison of query result accuracy usingthe same experimental setup as in Figure 15 and a 2-seconddelay constraint. Data Triage outperformed the other twoload-shedding methods tested. Each line is the average of10 runs of the experiment.

squared error metric. That is, we defined the error for timewindow w as:

Ew =

√∑g∈groups (actual(g)− reported(g))2

|groups|(15)

Using this error metric and the same query and experi-mental setup as the previous experiment, we measured theresult error of three load-shedding methods:• Data Triage as described in this paper

14

Page 17: Declarative Network Monitoring with an Underprovisioned ...on passive network monitoring, an application in which the data rates typically exhibit a large peak-to-average ratio. Provisioning

• Drop Excess Tuples: When the delay constraint isabout to be violated, drop the remaining tuples in thewindow.

• Summarize All: Generate summaries of all tuples andperform approximate query processing on the sum-maries.

We used a reservoir sample as the summary type for bothData Triage and the Summarize All technique. We tuned thereservoir size to the maximum data rate in the trace.

Figure 16 shows the results for the first 500 seconds ofthis experiment. Throughout the trace, Data Triage pro-vides more accurate results than either of the other meth-ods. During the bursts in windows 0 and 18-21, Data Triageprocesses as many tuples as possible before resorting to ap-proximation. The Drop Excess Tuples method, on the otherhand, generates query results that are missing significantchunks of the data. Likewise, the Summarize All methoddrops tuples that could have been processed fully.

During the periods in between bursts, both Data Triageand the Drop Excess Tuples method processed all tuples ineach window, producing no error. The error for Summa-rize All also decreased somewhat during these lulls, as thereservoir sample covered a larger portion of the data in thewindow.

12 Conclusion

In this paper, we observed that there are significant po-tential cost savings to provisioning a network monitor fortypical data rates as opposed to the maximum load. Wefound that controlling the tradeoff between provisioningand latency is key to enabling these cost savings. We de-scribed windowed delay constraints, a way of specifyingtolerances for query result latency, and the Data Triage ar-chitecture that we use to implement delay constraints. Wepresented a theoretical analysis of scheduling and provi-sioning for Data Triage, as well as a formally-based, practi-cal query rewrite scheme that allows us to implement DataTriage without modifying the core of the query engine. Fi-nally, we used our implementation to perform experimentsthat demonstrate the Data Triage can satisfy windowed de-lay constraints on an underprovisioned stream query pro-cessor.

Acknowledgments

This work was supported by an NDSEG fellowship, aswell as by a grant from the National Science Foundation,award number IIS-0205647.

We would like to thank Yang Zhang for his help in im-plementing wavelet-based histograms in TelegraphCQ. Wewould also like to thank Boon Thao Loo, Ryan Huebsch,Yanlei Diao, and Shariq Rizvi for helpful comments onearly drafts of this paper.

References

[1] S. Acharya, P. B. Gibbons, V. Poosala, and S. Ra-maswamy. Join synopses for approximate query an-swering. In SIGMOD, pages 275–286, 1999.

[2] A. Arasu, S. Babu, and J. Widom. The cql continu-ous query language: Semantic foundations and queryexecution. Technical Report 2003-67, Stanford Uni-versity, 2003.

[3] J. Bentley. Multidimensional binary search trees usedfor associative searching. Communications of theACM, pages 509–517, 1975.

[4] A. Bulut and A. K. Singh. Swat: Hierarchical streamsummarization in large networks. In ICDE, 2003.

[5] K. Chakrabarti, M. Garofalakis, R. Rastogi, andK. Shim. Approximate query processing usingwavelets. VLDB Journal, 10(2–3):199–223, 2001.

[6] S. Chandrasekaran, O. Cooper, A. Deshpande, M. J.Franklin, J. M. Hellerstein, W. Hong, S. Krishna-murthy, S. Madden, V. Raman, F. Reiss, and M. Shah.Telegraphcq: Continuous dataflow processing for anuncertain world. In CIDR, 2003.

[7] M. Charikar, K. Chen, and M. Farach-Colton. Findingfrequent items in data streams. Theor. Comput. Sci.,312(1):3–15, 2004.

[8] C. D. Cranor, T. Johnson, O. Spatscheck, andV. Shkapenyuk. Gigascope: A stream database fornetwork applications. In SIGMOD, 2003.

[9] A. Das, J. E. Gehrke, and M. Riedewald. Approximatejoin processing over data streams. In SIGMOD. ACMPress, 2003.

[10] A. Deshpande and J. Hellerstein. On usingcorrelation-based synopses during query optimization.Technical Report CSD-02-1173, U.C. Berkeley EECSDepartment, May 2002.

[11] H. Dreger, A. Feldmann, V. Paxson, and R. Som-mer. Operational experiences with high-volume net-work intrusion detection. In CCS, pages 2–11. ACMPress, 2004.

[12] R. M. et al. Query processing, resource management,and approximation in a data stream management sys-tem. In CIDR. ACM Press, 2003.

[13] M. Garofalakis and P. Gibbons. Approximate queryprocessing: Taming the terabytes!, 2001.

[14] A. Gupta and I. S. Mumick. Maintenance of materi-alized views: Problems, techniques, and applications.IEEE Data Eng. Bull., 18(2):3–18, 1995.

15

Page 18: Declarative Network Monitoring with an Underprovisioned ...on passive network monitoring, an application in which the data rates typically exhibit a large peak-to-average ratio. Provisioning

[15] P. J. Haas and J. M. Hellerstein. Ripple joins for onlineaggregation. In A. Delis, C. Faloutsos, and S. Ghan-deharizadeh, editors, SIGMOD, pages 287–298. ACMPress, 1999.

[16] G. Iannaccone, C. Diot, and D. McAuley. The CoMowhite paper. Technical Report IRC-TR-04-017, IntelResearch, September 2004.

[17] H. V. Jagadish, N. Koudas, S. Muthukrishnan,V. Poosala, K. C. Sevcik, and T. Suel. Optimal his-tograms with quality guarantees. In VLDB, pages 275–286, 24–27 1998.

[18] J. Kang, J. F. Naughton, and S. D. Viglas. Evaluat-ing window joins over unbounded streams. In ICDE,2003.

[19] S. Krishnamurthy and M. J. Franklin. Shared hierar-chical aggregation over receptor streams. TechnicalReport UCB-CSD-05-1381, UC Berkeley, 2005.

[20] I. Lazaridis and S. Mehrotra. Capturing sensor-generated time series with quality guarantees. InICDE, 2003.

[21] W. E. Leland, M. S. Taqq, W. Willinger, and D. V.Wilson. On the self-similar nature of Ethernet traffic.In D. P. Sidhu, editor, ACM SIGCOMM, pages 183–193, 1993.

[22] Y. Matias, J. S. Vitter, and M. Wang. Wavelet-basedhistograms for selectivity estimation. In SIGMOD,pages 448–459, 1998.

[23] Y. Matias, J. S. Vitter, and M. Wang. Dynamic main-tenance of wavelet-based histograms. In VLDB, 2000.

[24] G. Ozsoyoglu, S. Guruswamy, K. Du, and W.-C.Hou. Time-constrained query processing in CASE-DB. Knowledge and Data Engineering, 7(6):865–884,1995.

[25] V. Paxson and S. Floyd. Wide-area traffic: the fail-ure of Poisson modeling. IEEE Trans. Networking,3(3):226 – 224, 1995.

[26] V. Poosala and Y. Ioannidis. Selectivity estimationwithout the attribute value independence assumption.In CIDR. ACM Press, 2003.

[27] F. Reiss and J. M. Hellerstein. Data triage: Anadaptive architecture for load shedding in telegraphcq(short paper). In ICDE, 2005.

[28] R. Riedi and W. Willinger. Self-similar Network Traf-fic and Performance Evaluation. Wiley, 2000.

[29] D. V. Schuehler and J. Lockwood. TCP-Splitter:A TCP/IP flow monitor in reconfigurable hardware.In Hot Interconnects, pages 127–131, Stanford, CA,Aug. 2002.

[30] U. Srivastava and J. Widom. Memory-limited execu-tion of windowed stream joins, 2004.

[31] Y. Tao, J. Sun, and D. Papadias. Selectivity estimationfor predictive spatio-temporal queries. In ICDE, 2003.

[32] N. Tatbul, U. Centintemel, S. Zdonik, M. Cherniack,and M. Stonebraker. Load shedding in a data streammanager. In VLDB, 2003.

[33] J. S. Vitter. Random sampling with a reservoir. ACMTrans. Math. Softw., 11(1):37–57, 1985.

16