+ All Categories
Home > Engineering > Building an Event-oriented Data Platform with Kafka, Eric Sammer

Building an Event-oriented Data Platform with Kafka, Eric Sammer

Date post: 16-Apr-2017
Category:
Upload: confluent
View: 2,561 times
Download: 2 times
Share this document with a friend
30
building a system for machine and event-oriented data e. sammer | @esammer kafka summit 2016
Transcript
Page 1: Building an Event-oriented Data Platform with Kafka, Eric Sammer

building a system for machine andevent-oriented datae. sammer | @esammerkafka summit 2016

Page 2: Building an Event-oriented Data Platform with Kafka, Eric Sammer

© 2015 Rocana, Inc. All Rights Reserved.

context

Page 3: Building an Event-oriented Data Platform with Kafka, Eric Sammer

© 2015 Rocana, Inc. All Rights Reserved.3

what we do• we build a system for the operation of modern data centers• triage and diagnostics, exploration, trends, advanced analytics of complex

systems• our data: logs, metrics, human activity, anything that occurs in the data center• “enterprise software” (i.e. we build for others.)

• today: how we built what we built

Page 4: Building an Event-oriented Data Platform with Kafka, Eric Sammer

© 2015 Rocana, Inc. All Rights Reserved.4

our typical customer use cases• >100K events / sec (8.6B events / day), sub-second end to end latency, full

fidelity retention, critical use cases• quality of service - “are credit card transactions happening fast enough?”• fraud detection - “detect, investigate, prosecute, and learn from fraud.”• forensic diagnostics - “what really caused the outage last friday?”• security - “who’s doing what, where, when, why, and how, and is that ok?”• user behavior - ”capture and correlate user behavior with system performance,

then feed it to downstream systems in realtime.”

Page 5: Building an Event-oriented Data Platform with Kafka, Eric Sammer

© 2015 Rocana, Inc. All Rights Reserved.

depth: 3 meters

Page 6: Building an Event-oriented Data Platform with Kafka, Eric Sammer

© 2015 Rocana, Inc. All Rights Reserved.6

high level architecture – sources

Page 7: Building an Event-oriented Data Platform with Kafka, Eric Sammer

© 2015 Rocana, Inc. All Rights Reserved.7

high level architecture – sinks

Page 8: Building an Event-oriented Data Platform with Kafka, Eric Sammer

© 2015 Rocana, Inc. All Rights Reserved.8

guarantees• no single point of failure exists• all components scale horizontally[1]

• data retention and latency is a function of cost, not tech[1]

• every event is delivered provided no more than N - 1 failures occur (where N is the kafka replication level)

• all operations, including upgrade, are online[2]

• every event is (or appears to be) delivered exactly once[3]

[1] we’re positive there’s a limit, but thus far it has been cost.[2] from the user’s perspective, at a system level.[3] when queried via our UI. lots of details here.

Page 9: Building an Event-oriented Data Platform with Kafka, Eric Sammer

© 2015 Rocana, Inc. All Rights Reserved.

events

Page 10: Building an Event-oriented Data Platform with Kafka, Eric Sammer

© 2015 Rocana, Inc. All Rights Reserved.10

modeling our world• everything is an event• each event contains a timestamp, type, location, host, service, body, and type-

specific attributes (k/v pairs)• build specialized aggregates as necessary - just optimized views of the data

Page 11: Building an Event-oriented Data Platform with Kafka, Eric Sammer

© 2015 Rocana, Inc. All Rights Reserved.11

event schema{ id: string, ts: long, event_type_id: int, location: string, host: string, service: string, body: [ null, string ], attributes: map<string>}

Page 12: Building an Event-oriented Data Platform with Kafka, Eric Sammer

© 2015 Rocana, Inc. All Rights Reserved.12

event types• some event types are standard

– syslog, http, log4j, generic text record, …• users define custom event types• producers populate event type• transformations can turn an event of type A into B• event type metadata tells downstream systems how to interpret body and

attributes

Page 13: Building an Event-oriented Data Platform with Kafka, Eric Sammer

© 2015 Rocana, Inc. All Rights Reserved.13

ex: generic syslog eventevent_type_id: 100, // rfc3164, rfc5424 (syslog)body: … // raw syslog message bytesattributes: { // extracted fields from body syslog_message: “DHCPACK from 10.10.0.1 (xid=0x45b63bdc)”, syslog_severity: “6”, // info severity syslog_facility: “3”, // daemon facility syslog_process: “dhclient”, syslog_pid: “668”, …}

Page 14: Building an Event-oriented Data Platform with Kafka, Eric Sammer

© 2015 Rocana, Inc. All Rights Reserved.14

ex: generic http eventevent_type_id: 102, // generic http eventbody: … // raw http log message bytesattributes: { http_req_method: “GET”, http_req_vhost: “w2a-demo-02”, http_req_path: “/api/v1/search?q=service%3Asshd&p=1&s=200”, http_req_query: “q=service%3Asshd&p=1&s=200”, http_resp_code: “200”, …}

Page 15: Building an Event-oriented Data Platform with Kafka, Eric Sammer

© 2015 Rocana, Inc. All Rights Reserved.

stream processing

Page 16: Building an Event-oriented Data Platform with Kafka, Eric Sammer

© 2015 Rocana, Inc. All Rights Reserved.16

a reminder…

Page 17: Building an Event-oriented Data Platform with Kafka, Eric Sammer

© 2015 Rocana, Inc. All Rights Reserved.17

data processing• each processing job gets a full stream of the fire hose, decides what it wants to

consider or operate on• output of “non-terminal” jobs always just events• result: all processing jobs are composable• many jobs take user rules or configuration from our ui

Page 18: Building an Event-oriented Data Platform with Kafka, Eric Sammer

© 2015 Rocana, Inc. All Rights Reserved.18

the jobs• transformation engine: configuration-based data transformation• metric aggregation: olap cube construction of time series data (e.g. host 17

user cpu time)• model build/eval: train/evaluate various kinds of models (e.g. anomaly

detection)• trigger engine: detect complex patterns in the stream, emit events on match

(e.g. complex event processing, automated workflow, alerting)• action engine: perform some action upon receiving a specific event type (e.g.

email notification, 3rd party api invocation)• storage: write all the things to hdfs

Page 19: Building an Event-oriented Data Platform with Kafka, Eric Sammer

© 2015 Rocana, Inc. All Rights Reserved.19

transformation use cases

Page 20: Building an Event-oriented Data Platform with Kafka, Eric Sammer

© 2015 Rocana, Inc. All Rights Reserved.20

event feedback loops

Page 21: Building an Event-oriented Data Platform with Kafka, Eric Sammer

© 2015 Rocana, Inc. All Rights Reserved.

metrics and time series

Page 22: Building an Event-oriented Data Platform with Kafka, Eric Sammer

© 2015 Rocana, Inc. All Rights Reserved.22

aggregation• mostly for time series metrics• two halves: on write and on query• data model: (dimensions) => (aggregates)• on write

– reduce(a: A, b: A) => A over window– store “base” aggregates, all associative and commutative

• on query– perform same aggregate or derivative aggregates– group by the same dimensions– we use SQL (Impala)

Page 23: Building an Event-oriented Data Platform with Kafka, Eric Sammer

© 2015 Rocana, Inc. All Rights Reserved.23

aside: late arriving data (it’s a thing)• never trust a (wall) clock• producer determines event time, rest of the system uses this always• data that shows up late always processed according to event time• apache beam describes these issues perfectly• this is real and you must deal with it

Page 24: Building an Event-oriented Data Platform with Kafka, Eric Sammer

© 2015 Rocana, Inc. All Rights Reserved.24

ex: service event volume by host and minute• dimensions: ts, window, location, host, service, metric• on write, aggregates: count, sum, min, max, last• epoch, 60000, us-west-2a, w2a-demo-1, sshd, event_volume =>

17, 42, 1, 10, 8• on query:

– SELECT floor(ts / 60000) as bin, host, service, metric, sum(value_sum) FROM events WHERE ts BETWEEN x AND y AND metric = ”event_volume” GROUP BY bin, host, service, metric

• if late arriving data existed in events, the same dimensions would repeat with a another set of aggregates and would be rolled up as a result of the group by

• tl;dr: normal window aggregation operations

Page 25: Building an Event-oriented Data Platform with Kafka, Eric Sammer

© 2015 Rocana, Inc. All Rights Reserved.

extension, pain, and advice

Page 26: Building an Event-oriented Data Platform with Kafka, Eric Sammer

© 2015 Rocana, Inc. All Rights Reserved.26

extending the system• custom producers• custom consumers• event types• parser / transformation plugins• custom metric definition and aggregate functions• custom processing jobs on landed data

Page 27: Building an Event-oriented Data Platform with Kafka, Eric Sammer

© 2015 Rocana, Inc. All Rights Reserved.27

pain (aka: the struggle is real)• lots of tradeoffs when picking a stream processing solution

– samza: right features, but low level programming model, not supported by vendors. missing security features.

– storm: too rigid, too slow. not supported by all Hadoop vendors.– flink: relatively new, fledgling community. growing.– spark streaming: tons of issues initially, but lots of community energy. improving.

• stack complexity, (relative im)maturity• beam-style retractions required for correct, timely, efficient aggregates of

complex metrics (non-assoc/commutative)

Page 28: Building an Event-oriented Data Platform with Kafka, Eric Sammer

© 2015 Rocana, Inc. All Rights Reserved.28

if you’re going to try this…• read all the literature on stream processing[1]

• treat it like the distributed systems problem it is• understand, make, and make good on guarantees• find the right abstractions• never trust the hand waving or “hello worlds”• fully evaluate the projects/products in this space• understand it’s not just about search

[1] wait, like all of it? yea, like all of it.

Page 29: Building an Event-oriented Data Platform with Kafka, Eric Sammer

© 2015 Rocana, Inc. All Rights Reserved.29

things I didn’t talk about• reprocessing data when bad code / transformations are detected• dealing with data quality issues (“the struggle is real” part 2)• the user interface and all the fancy analytics

– data visualization and exploration– event search– anomalous trend and event detection– metric, source, and event correlation– motif finding– noise reduction and dithering

• event delivery semantics (e.g. at least once, exactly once, etc.)• alerting, notification, and other subsystems

Page 30: Building an Event-oriented Data Platform with Kafka, Eric Sammer

© 2015 Rocana, Inc. All Rights Reserved.

questions?

thank you.

@esammer | [email protected]


Recommended