Approximation is Bliss - Yongjoo Park · 2020-06-07 · Resurgence of AQP research 0 20 40 60 80...

34
Approximate Computing in Database Systems Yongjoo Park @Michigan Approximation is Bliss

Transcript of Approximation is Bliss - Yongjoo Park · 2020-06-07 · Resurgence of AQP research 0 20 40 60 80...

Page 1: Approximation is Bliss - Yongjoo Park · 2020-06-07 · Resurgence of AQP research 0 20 40 60 80 1998 2003 2008 2013 2018 Acharya. Aqua Hellerstein. OLA Jermaine. DBO t Cormode. Synopses

Approximate Computing in Database Systems

Yongjoo Park @Michigan

Approximation is Bliss

Page 2: Approximation is Bliss - Yongjoo Park · 2020-06-07 · Resurgence of AQP research 0 20 40 60 80 1998 2003 2008 2013 2018 Acharya. Aqua Hellerstein. OLA Jermaine. DBO t Cormode. Synopses

Approximate query processing isbecoming more valuable

Page 3: Approximation is Bliss - Yongjoo Park · 2020-06-07 · Resurgence of AQP research 0 20 40 60 80 1998 2003 2008 2013 2018 Acharya. Aqua Hellerstein. OLA Jermaine. DBO t Cormode. Synopses

What is approximate query processing (AQP)?

Faster and Cheaper

I/O Computation Exact Answer

100011100010110110111010010

Less Computation

100011100010110110111010010

Approximate AnswerLess I/O

Page 4: Approximation is Bliss - Yongjoo Park · 2020-06-07 · Resurgence of AQP research 0 20 40 60 80 1998 2003 2008 2013 2018 Acharya. Aqua Hellerstein. OLA Jermaine. DBO t Cormode. Synopses

MR Online,COSMOS

AQUA,Ripple join

Approx countestimator

1985 1990 1995 2000 2005 2010 2015

Doublesampling

Online agg

Dynamicsample

Opt stratifiedDBO

STRAT SMS

Bootstrap for AQP

SciBORQ

BlinkDB

QuickR, Wander join

DAQ

35 years of research

AQP research has a long history

Page 5: Approximation is Bliss - Yongjoo Park · 2020-06-07 · Resurgence of AQP research 0 20 40 60 80 1998 2003 2008 2013 2018 Acharya. Aqua Hellerstein. OLA Jermaine. DBO t Cormode. Synopses

Resurgence of AQP research

0

20

40

60

80

1998 2003 2008 2013 2018

Acharya. Aqua Hellerstein. OLA Jermaine. DBO Cormode. Synopses

cita

tion

coun

t

Page 6: Approximation is Bliss - Yongjoo Park · 2020-06-07 · Resurgence of AQP research 0 20 40 60 80 1998 2003 2008 2013 2018 Acharya. Aqua Hellerstein. OLA Jermaine. DBO t Cormode. Synopses

Resurgence of AQP research

0

20

40

60

80

1998 2003 2008 2013 2018

Acharya. Aqua Hellerstein. OLA Jermaine. DBO Cormode. Synopses

cita

tion

coun

t

Page 7: Approximation is Bliss - Yongjoo Park · 2020-06-07 · Resurgence of AQP research 0 20 40 60 80 1998 2003 2008 2013 2018 Acharya. Aqua Hellerstein. OLA Jermaine. DBO t Cormode. Synopses

Resurgence of AQP research

0

20

40

60

80

1998 2003 2008 2013 2018

Acharya. Aqua Hellerstein. OLA Jermaine. DBO Cormode. Synopses

cita

tion

coun

t

Hadoop

Cloudera Hortonworks

Redshift big datasystems/ vendors

Spark

Page 8: Approximation is Bliss - Yongjoo Park · 2020-06-07 · Resurgence of AQP research 0 20 40 60 80 1998 2003 2008 2013 2018 Acharya. Aqua Hellerstein. OLA Jermaine. DBO t Cormode. Synopses

Today’s big data ecosystems

FLOW STORE FORMAT

COMPUTE VIZ

Page 9: Approximation is Bliss - Yongjoo Park · 2020-06-07 · Resurgence of AQP research 0 20 40 60 80 1998 2003 2008 2013 2018 Acharya. Aqua Hellerstein. OLA Jermaine. DBO t Cormode. Synopses

Today’s big data ecosystems

FLOW STORE FORMAT

COMPUTE VIZ

Can process a large volume of data

Slow (esp. for ad-hoc queries)

Costly

Page 10: Approximation is Bliss - Yongjoo Park · 2020-06-07 · Resurgence of AQP research 0 20 40 60 80 1998 2003 2008 2013 2018 Acharya. Aqua Hellerstein. OLA Jermaine. DBO t Cormode. Synopses

Big data analytics is slow

One of the biggest customer science company in UK

One of the largestretail corporations

Collects 70GB+ data/day

Ad-hoc queries with customer demographic filters

Basic statistics + ML

A location intelligence company

Billions of GPS points

Real-time responses required for its web-interface

Using commercial clusters (from MapR, Amazon, ...)10-20 minute query latencies

Page 11: Approximation is Bliss - Yongjoo Park · 2020-06-07 · Resurgence of AQP research 0 20 40 60 80 1998 2003 2008 2013 2018 Acharya. Aqua Hellerstein. OLA Jermaine. DBO t Cormode. Synopses

Big data analytics is costly

$450K/monthpay per query

The cost increases with more data & queries

Case 80 GB/day, one-year data retention, 1000 queries/day

$48K/monthpay per node HIGH

COST

Page 12: Approximation is Bliss - Yongjoo Park · 2020-06-07 · Resurgence of AQP research 0 20 40 60 80 1998 2003 2008 2013 2018 Acharya. Aqua Hellerstein. OLA Jermaine. DBO t Cormode. Synopses

Big data: too much cost for its value?

https://www.jesse-anderson.com/2019/06/i-come-not-to-bury-cloudera-but-to-praise-it/”“We generate woefully low amounts of value relative to the amount spent.

Jesse Anderson, Director of Big Data Institute

65% of Cloudera is gonein 4 months

Page 13: Approximation is Bliss - Yongjoo Park · 2020-06-07 · Resurgence of AQP research 0 20 40 60 80 1998 2003 2008 2013 2018 Acharya. Aqua Hellerstein. OLA Jermaine. DBO t Cormode. Synopses

Approximation is bliss100x faster or cheaper by sacrificing 0.1% accuracy err = f( 1

n − 1N ) ≤ f( 1

n )

Faster: less I/O, less computation

Cheaper: same latency with less resource

Page 14: Approximation is Bliss - Yongjoo Park · 2020-06-07 · Resurgence of AQP research 0 20 40 60 80 1998 2003 2008 2013 2018 Acharya. Aqua Hellerstein. OLA Jermaine. DBO t Cormode. Synopses

AQP can produce indistinguishable results

2 billion pointsTook 71 mins

1 million pointsTook 3 secs

EXACT APPROXIMATE

[Park et al. ICDE’16]

Page 15: Approximation is Bliss - Yongjoo Park · 2020-06-07 · Resurgence of AQP research 0 20 40 60 80 1998 2003 2008 2013 2018 Acharya. Aqua Hellerstein. OLA Jermaine. DBO t Cormode. Synopses

Our contributions

1. 35 years of research, little industry adoption

Our effort: Universal AQP

2. Limited to simple aggregation Our effort: AQP for ML

[Park et al. SIGMOD’18]

[Park et al. SIGMOD’19]

sum, avg, count, count-distinct

Page 16: Approximation is Bliss - Yongjoo Park · 2020-06-07 · Resurgence of AQP research 0 20 40 60 80 1998 2003 2008 2013 2018 Acharya. Aqua Hellerstein. OLA Jermaine. DBO t Cormode. Synopses

<Universal AQP>...

Page 17: Approximation is Bliss - Yongjoo Park · 2020-06-07 · Resurgence of AQP research 0 20 40 60 80 1998 2003 2008 2013 2018 Acharya. Aqua Hellerstein. OLA Jermaine. DBO t Cormode. Synopses

Typical AQP systems

[Aqua ’99, JoinSynopses ’99, BlinkDB ’13, WanderJoin ’16, Quickr ’16, and more]

avg (sensor_temp)

user/app

AQP System

± 0.182.3

82.28 ± 0.01

82.2873

Page 18: Approximation is Bliss - Yongjoo Park · 2020-06-07 · Resurgence of AQP research 0 20 40 60 80 1998 2003 2008 2013 2018 Acharya. Aqua Hellerstein. OLA Jermaine. DBO t Cormode. Synopses

Barriers in adopting AQP

• Newer SQL-on-Hadoop: busy catching up on standard features

Vendor resistance: AQP requires significant changes to DBMS internals

• Traditional DBMS: stable codebases, reluctance to major changes

[BlinkDB ’13, G-OLA ’15, Join Synopses ’99, WanderJoin ‚16, ABM ’14, ...]

User resistance:• users don’t typically abandon their existing systems• vendor lock-in makes data migration almost impossible

Page 19: Approximation is Bliss - Yongjoo Park · 2020-06-07 · Resurgence of AQP research 0 20 40 60 80 1998 2003 2008 2013 2018 Acharya. Aqua Hellerstein. OLA Jermaine. DBO t Cormode. Synopses

One example of user resistance

Since our organization is huge, it would be difficult to ask infrastructure team to apply patch on spark for supporting BlinkDB.

Giridhar Addepalli, Walmarthttps://github.com/sameeragarwal/blinkdb/issues/14

“”

Page 20: Approximation is Bliss - Yongjoo Park · 2020-06-07 · Resurgence of AQP research 0 20 40 60 80 1998 2003 2008 2013 2018 Acharya. Aqua Hellerstein. OLA Jermaine. DBO t Cormode. Synopses

Our Approach: Universal AQP

AQP

Laye

r

SQLEngine

OriginalQuery

Approx. Ans toOriginal Query(+ error bound)

RewrittenQuery

Exact Ans toRewritten

Query

The rewritten query runs faster becauseit uses a sample table instead of the original table

Page 21: Approximation is Bliss - Yongjoo Park · 2020-06-07 · Resurgence of AQP research 0 20 40 60 80 1998 2003 2008 2013 2018 Acharya. Aqua Hellerstein. OLA Jermaine. DBO t Cormode. Synopses

Universal AQP: criteria

Consistency

Accuracy guarantee

Efficiency

VerdictDBhttps://github.com/mozafari/verdictdb

We focus on append-only data

New error estimation logic

Comparable to built-in AQP

Page 22: Approximation is Bliss - Yongjoo Park · 2020-06-07 · Resurgence of AQP research 0 20 40 60 80 1998 2003 2008 2013 2018 Acharya. Aqua Hellerstein. OLA Jermaine. DBO t Cormode. Synopses

VerdictDB: offers large speedups

0

5

10

15

20

25

30

On Redshift On Spark SQL On Impala

Spee

dup

(tim

es)

Datasets:• 500GB TPC-H benchmark• 200GB Instacart dataset

Workloads:• TPC-H, microbenchmark

Data Systems:• Redshift, Spark SQL, Impala• 10+1 r4.xlarge cluster

24.0×

12.0×

18.6×

Including all overhead

Used columnar formats for all systems

2% relative errors

Page 23: Approximation is Bliss - Yongjoo Park · 2020-06-07 · Resurgence of AQP research 0 20 40 60 80 1998 2003 2008 2013 2018 Acharya. Aqua Hellerstein. OLA Jermaine. DBO t Cormode. Synopses

VerdictDB: comparable to built-in AQP

0

5

10

15

20

Late

ncy

(sec

)

Datasets:• 200GB Instacart dataset

Workloads:• microbenchmark

Data Systems:• Spark SQL• 10+1 r4.xlarge cluster

17.3 sec

0.70 sec 0.97 sec

OriginalSpark

Built-inAQP System

Built-in AQP System:SnappyData(a commercial version of BlinkDB) Ours

Remember:requires a wholesale replacementof your database systems

Page 24: Approximation is Bliss - Yongjoo Park · 2020-06-07 · Resurgence of AQP research 0 20 40 60 80 1998 2003 2008 2013 2018 Acharya. Aqua Hellerstein. OLA Jermaine. DBO t Cormode. Synopses
Page 25: Approximation is Bliss - Yongjoo Park · 2020-06-07 · Resurgence of AQP research 0 20 40 60 80 1998 2003 2008 2013 2018 Acharya. Aqua Hellerstein. OLA Jermaine. DBO t Cormode. Synopses

...</Universal AQP>

Page 26: Approximation is Bliss - Yongjoo Park · 2020-06-07 · Resurgence of AQP research 0 20 40 60 80 1998 2003 2008 2013 2018 Acharya. Aqua Hellerstein. OLA Jermaine. DBO t Cormode. Synopses

<AQP for ML>...

Page 27: Approximation is Bliss - Yongjoo Park · 2020-06-07 · Resurgence of AQP research 0 20 40 60 80 1998 2003 2008 2013 2018 Acharya. Aqua Hellerstein. OLA Jermaine. DBO t Cormode. Synopses

Machine learning can be time-consuming

More data, slower training

We train multiple models• new training data• feature engineering

[Anderson, CIDR’13] 50K 100K 500K 1M 10M 37M

79 s 95 s 166 s 263 s

1735 s

5727 s

Number of examples

Criteo datasetlogistic regression (L-BFGS)

Page 28: Approximation is Bliss - Yongjoo Park · 2020-06-07 · Resurgence of AQP research 0 20 40 60 80 1998 2003 2008 2013 2018 Acharya. Aqua Hellerstein. OLA Jermaine. DBO t Cormode. Synopses

Sampling may accelerate training

Training: iterative gradient computationθt+1 = θt - α · grad(θt)

Sampling: gradient computation becomes fastergrad(θt) = (1/N) ∑i=1..N f(xi | θt)

Benefits if (savings from sampling) > (increase in # of iterations)

1. Ad-hoc approach: no accuracy guarantee2. Biased sampling: not efficient for feature engineering

(until convergence)

Page 29: Approximation is Bliss - Yongjoo Park · 2020-06-07 · Resurgence of AQP research 0 20 40 60 80 1998 2003 2008 2013 2018 Acharya. Aqua Hellerstein. OLA Jermaine. DBO t Cormode. Synopses

BlinkML: uniform sampling w/ accuracy guarantee

training set(size N)

sample (size n)

sampleautomatically

full(x)

approx(x)

ML trainer consistentpredictions

Consistency is expressed asEx[full(x) ≠ approx(x)] < ε with high probability

Page 30: Approximation is Bliss - Yongjoo Park · 2020-06-07 · Resurgence of AQP research 0 20 40 60 80 1998 2003 2008 2013 2018 Acharya. Aqua Hellerstein. OLA Jermaine. DBO t Cormode. Synopses

BlinkML supports commonly-used models

Supports convex MLE models:• linear regression• logistic regression• probabilistic PCA• generalized linear models

https://www.kaggle.com/surveys/2017/

Accuracy guarantee exploits the property of MLE models:grad(θopt) = (1/N) ∑i=1..N f(xi | θopt) = 0

BlinkML introduces computational optimization

Page 31: Approximation is Bliss - Yongjoo Park · 2020-06-07 · Resurgence of AQP research 0 20 40 60 80 1998 2003 2008 2013 2018 Acharya. Aqua Hellerstein. OLA Jermaine. DBO t Cormode. Synopses

BlinkML offers large speedups

1

10

100

1000

90% 95% 96% 97% 98% 99%

Logistic regression46M examples

Requested Accuracy

625×

73×25×

Spee

dup

Datasets:• Size: 2.86 GB on disk•# of features: 998K

Systems:•Optimization: Scipy•5+1 m5.2xlarge

66× 60× 50×

Page 32: Approximation is Bliss - Yongjoo Park · 2020-06-07 · Resurgence of AQP research 0 20 40 60 80 1998 2003 2008 2013 2018 Acharya. Aqua Hellerstein. OLA Jermaine. DBO t Cormode. Synopses

...</AQP for ML>

Page 33: Approximation is Bliss - Yongjoo Park · 2020-06-07 · Resurgence of AQP research 0 20 40 60 80 1998 2003 2008 2013 2018 Acharya. Aqua Hellerstein. OLA Jermaine. DBO t Cormode. Synopses

Summary

1. AQP: becoming more valuable

2. VerdictDB: enables AQP on any platforms

3. BlinkML: trains MLE models with bounded errors

Page 34: Approximation is Bliss - Yongjoo Park · 2020-06-07 · Resurgence of AQP research 0 20 40 60 80 1998 2003 2008 2013 2018 Acharya. Aqua Hellerstein. OLA Jermaine. DBO t Cormode. Synopses

Thank you!