parallel machines flinkforward2017

13
Powering Machine Learning EXPERIENCES WITH STREAMING & MICRO - BATCH FOR ONLINE LEARNING Swaminathan Sundararaman FlinkForward 2017

Upload: nisha-talagala

Post on 21-Apr-2017

309 views

Category:

Data & Analytics


0 download

TRANSCRIPT

Page 1: Parallel machines flinkforward2017

Powering Machine Learning

EXPERIENCES WITH STREAMING & MICRO-BATCH FOR ONLINE LEARNING

Swaminathan SundararamanFlinkForward 2017

Page 2: Parallel machines flinkforward2017

2

The Challenge of Today’s Analytics Trajectory

Edges benefit from real-time online learning and/or inference

IoT is Driving Explosive Growth in Data Volume

“Things” Edge and network Datacenter/Cloud

Data lake

Page 3: Parallel machines flinkforward2017

3

• Real-world data is unpredictable and burstyo Data behavior changes (different time of day, special events, flash crowds, etc.)

• Data behavior changes require retraining & model updateso Updating models offline can be expensive (compute, retraining)

• Online algorithms retrain on the fly with real-time datao Lightweight, low compute and memory requirementso Better accuracy through continuous learning

• Online algorithms are more accurate, especially with data behavior changes

Real-Time Intelligence: Online Algorithm Advantages

Page 4: Parallel machines flinkforward2017

4

Experience Building ML Algorithms on Flink 1.0

• Built both Offline(Batch) and Online algorithmso Batch Algorithms (Examples: KMeans, PCA, and Random Forest)

o Online Algorithms (Examples: Online KMeans, Online SVM)

• Uses many of the Flink DataStream primitives:o DataStream APIs are sufficient and primitives are generic for ML algorithms.

o CoFlatMaps, Windows, Collect, Iterations, etc.

• We have also added Python Streaming API support in Flink and are working with dataArtisans to contribute it to upstream Flink.

Page 5: Parallel machines flinkforward2017

5

Example: Online SVM Algorithm/* Co-map to update local model(s) when new data arrives and also create the shared model when a pre-defined threshold is met */private case class SVMModelCoMap(...) {

/* flatMap1 processes new elements and updates local model*/def flatMap1(data: LabeledVector[Double],

out: Collector[Model]) {. . .

}/* flatMap2 accumulates local models and creates a new model

(with decay) once all local models are received */def flatMap2(currentModel: Model, out: Collector[Model]) {

. . .}

}

object OnlineSVM {. . .def main(args: Array[String]): Unit = {

// initialize input arguments and connectors. . .

}}

DataStream

FM1 FM1

FM2 FM2

M M

Task Slot Task Slot

M MM M

M M

Aggregated and local models combined with decay factor

Page 6: Parallel machines flinkforward2017

6

• A server providing VoD services to VLC (i.e., media player) clientso Clients request videos of different sizes at different times o Server statistics used to predict violations

• SLA violation: service level drops below predetermined threshold

Telco Example: Measuring SLA Violations

In summary, this paper has the following main contributions:

- introduces an application agnostic approach for real-time prediction of SLA violations based on online machine learning;

- shows that accurate prediction of SLA violation can be achieved using online learning methods for a VoD service scenario;

- demonstrates that online learning methods significantly outperform offline learning methods in scenarios with concept drift.

The rest of this paper is organized as follows: Section II defines the problem. Section III discusses machine learning from streaming data. Section IV describes feature space and service quality metrics. Section V details the testbed setup. An extensive performance evaluation is conducted and discussed in Section VI. Conclusions are drawn in Section VII.

II. PROBLEM SETTING The envisioned system consists of a set of servers

connected to another set of clients over a network. Each client can access a VoD service running on the server side. Note that a similar setup was investigated in our previous work [1][5]. However, compared to our previous work this setup assumes a stream of learning examples from at least one client in order to build an online service quality prediction model for the clients in real time. The experimental setup is visualized in Figure 2.

Fig. 2. Test-bed setup.

Device statistics X are collected at the server while the service is operational. In this setting, device statistics refer to system metrics on the operating-system level such as CPU utilization, the number of running processes, the rate of context switches and free memory. In contrast, service-level metrics Y on the client side refer to statistics on the application level such as the video frame rate. The metrics X and Y are fed in real time to the Service Predictor module.

The metrics X and Y evolve over time, influenced by the load on the server, operating system, and application load dynamics. Assuming a global clock, that can be read on both the client and the server, we can model the evolution of the metrics X and Y as time series {Xt}t , {Yt}t and {(Xt , Yt)}t. The assumption in [1] was that the metrics are drawn from a stationary and unknown distribution D. Under this assumption it was possible to create a prediction model M : X→Y using offline machine learning techniques.

However, the assumption of a stationary distribution is limiting and does not always hold in real-world scenarios. The underlying problem is often referred to as a concept drift. That is, instead of being stationary the distribution D evolves over time: {D1, D2, …, Dt}. It implies the prediction system cannot rely on an initial model M throughout the service lifecycle without any changes. Rather, the model M has to be updated as new samples arrive. The prediction system will end up with an evolution of models {Mt, t=1..T}. This puts new demands on the actual learning but also on how to build the actual system.

Note that we do not discuss the true origin or cause of the drifting distribution D; rather we observe problems when learning from one trace and predicting on a second trace and try to overcome that with online learning.

Assume that a service level agreement (SLA) has been defined and computed for the client side service metrics. The SLA at a given time can either be in a ‘violated’ or ‘not violated’ state based on the service metric values. That is, for each service metric Yt at time t we can compute an SLAt value.

The objective in this paper is to predict application level SLA conformance for clients based on X, under the assumption that the underlying distribution D may change over time.

Further note that we assume that the distribution D does not depend on the network or the client. In practical terms, this means that the network is lightly loaded. We are aware that such assumptions may not hold for real systems, and we plan on relaxing them in the future. Previous research has also shown how end-to-end network measurements can be used to predict client-side metrics [2]; therefore, including this aspect would not necessarily add to the contributions of this work. Rather, we believe that this work complement already existing work on performance prediction in the management area.

III. LEARNING FROM HIGH SPEED DATA STREAMS Data stream processing essentially differs from traditional

data processing in that the statistical calculations need to be made using an infinite number of continuously arriving samples [6]. This restricts the number of available models to those that can be efficiently trained using a single pass over the data. The practical rational behind this is that data is generated with high velocity and in large volumes, limiting the storage and multi-pass processing.

Machine learning refers to the task of predicting unseen samples based on the currently available examples using statistical learning techniques. Predictions can broadly be categorized into a classification problem or regression problem [7]. In this paper we limit our study to classification problem, which contrasts to our previous work in [1] which studied a similar setup but for regression. Suitable online models for predictions should exhibit low prediction and learning latency, low overhead, and preferably also be interpretable (often refered to as a white box solution).

An inherent problem of real world data not always considered in theory is that of concept drift where the learned relation between independent and dependent variables changes over time. In terms of notations in this paper it simply means that the underlying and unknown distribution D, defined in the

DatasetLabels for training

Page 7: Parallel machines flinkforward2017

7

• Load patterns – Flashcrowd, Periodic• Delivered to Flink and Spark as live stream in experiments

Dataset(https://arxiv.org/pdf/1509.01386.pdf)

CPU Utilization

Memory/Swap I/O Transactions

Block I/O operations

Process Statistics

Network Statistics

CPU Idle Mem Used Read transactions/s

Block Reads/s

New Processes/s

Received packets/s

CPU User Mem Committed

Write transactions/s

Block Writes/s

Context Switches/s

Transmitted Packets/s

CPU System Swap Used Bytes Read/s Received Data (KB)/s

CPU IO_Wait Swap Cached Bytes Written/s Transmitted Data (KB)/s

Interface Utilization %

Page 8: Parallel machines flinkforward2017

8

When load pattern remains static (unchanged), Online algorithms can be as accurate as Offline algorithms

Fixed workloads – Online vs Offline (Batch)

Load Scenario Offline (LibSVM) Accuracy

Offline (Pegasos) Accuracy

Online SVMAccuracy

flashcrowd_load 0.843 0.915 0.943

periodic_load 0.788 0.867 0.927

constant_load 0.999 0.999 0.999

poisson_load 0.963 0.963 0.971

Page 9: Parallel machines flinkforward2017

9

Online SVM vs Batch (Offline) SVM – both in FlinkAc

cum

ulat

ed E

rror R

ate

Time

Load Change

Until retraining occurs, changing dataresults in lower accuracy model

Training Workload

Real-World Workload

0%

5%

10%

15%

20%

25%Network-SLA-Violation-Prediction

Offline-SVMOnline-SVM

Online Algorithm retrains on the flyreduces error rate

Online algorithms quickly adapt to workload changes

Page 10: Parallel machines flinkforward2017

10

Throughput: Online SVM in Streams and Micro-Batch

23.32 26.5846.29 39.4444.69

85.11

173.91

333.33

0.00

50.00

100.00

150.00

200.00

250.00

300.00

350.00

1 2 4 8

Thou

sand

s of

Ope

ratio

ns p

er S

econ

d

Number of Nodes

Throughput for processing samples with 256 attributes from Kafka

Spark 2.0 Flink 1.0.3

1.9x3.2x

3.8x

8.5x

Notable performance improvement over micro-batch based solution

Page 11: Parallel machines flinkforward2017

11

Latency: Online SVM in Streams & Micro-batch

1.9x3.2x

3.8x

8.5x

0.01

0.1

1

10

100

Late

ncy

(sec

s)

Time

Spark - 1s ubatch Spark - 0.1s ubatch Spark 0.01s ubatch Spark 10s ubatch Flink 1.0.3

Low and predictable latency as needed in Edge

Page 12: Parallel machines flinkforward2017

12

Edge computing & Online learning are needed for real-time analytics

• Edge Computing: minimizes the excessive latencies, reaction time

• Online learning: can dynamically adapt to changing data / behavior

Online machine learning with streaming on Flink

• Supports low latency processing with scaling across multiple nodes

• Using real world data, demonstrate improved accuracy over offline algorithms

Conclusions

Page 13: Parallel machines flinkforward2017

13

Parallel MachinesThe Machine Learning Management Solution

[email protected]