88
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved Drinking from the Firehose Drinking from the Firehose Mahesh Paolini-Subramanya (@dieswaytoofast) V.P. R&D, Ubiquiti Networks

Drinking From The Firehose - The Erlang Way

Embed Size (px)

DESCRIPTION

Imagine that you have tens of millions of endpoints, each of which is sending you a constant stream of data - to the tunes of petabytes per second. You also have millions of uses who want to monitor and administer them. And don't forget all the historical reports that these users insist upon all the time. And imagine that this these users and endpoints are distributed all over the world. This pretty much describes our environment - one that we've implemented with not just Riak, but also ElasticSearch, *and* Cassandra (because why go with one, when you can have all three!) - with Erlang tying all the moving pieces together. Join me as I show you how we successfully drink from this firehose of data without spilling a drop.

Citation preview

Page 1: Drinking From The Firehose - The Erlang Way

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Drinking from the Firehose

Drinking from the

FirehoseMahesh Paolini-Subramanya (@dieswaytoofast)V.P. R&D, Ubiquiti Networks

Page 2: Drinking From The Firehose - The Erlang Way

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Drinking from the Firehose

Drinking from the

Firehose

Page 3: Drinking From The Firehose - The Erlang Way

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Drinking from the Firehose

Drinking from the

FirehoseAka: “Scale Matters”

Page 4: Drinking From The Firehose - The Erlang Way
Page 5: Drinking From The Firehose - The Erlang Way
Page 6: Drinking From The Firehose - The Erlang Way

Drinking from the Firehose

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

ARCHITECTURE

DEVICE

Page 7: Drinking From The Firehose - The Erlang Way

Drinking from the Firehose

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Architecture

DEVICE

STATUS

Page 8: Drinking From The Firehose - The Erlang Way

Drinking from the Firehose

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Scale-Fail

DEVICE

STATUS

Page 9: Drinking From The Firehose - The Erlang Way

Drinking from the Firehose

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Data Stores

Page 10: Drinking From The Firehose - The Erlang Way

Drinking from the Firehose

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Data Stores

• State of the World

Page 11: Drinking From The Firehose - The Erlang Way

Drinking from the Firehose

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Data Stores

• State of the World

• Historical Data

Page 12: Drinking From The Firehose - The Erlang Way

Drinking from the Firehose

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Data Stores

• State of the World

• Historical Data

• Configurations

Page 13: Drinking From The Firehose - The Erlang Way

Drinking from the Firehose

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Data Stores

• State of the World

• Historical Data

• Configurations

• Billing

Page 14: Drinking From The Firehose - The Erlang Way
Page 15: Drinking From The Firehose - The Erlang Way

AGILITY

Page 16: Drinking From The Firehose - The Erlang Way
Page 17: Drinking From The Firehose - The Erlang Way

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Drinking from the Firehose

Fault Tolerance

From

http://www.erlang.org/download/armstrong_thesis_2003.pdf

Page 18: Drinking From The Firehose - The Erlang Way

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Drinking from the Firehose

The Big Six

Concurrency

From

http://www.erlang.org/download/armstrong_thesis_2003.pdf

Page 19: Drinking From The Firehose - The Erlang Way

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Drinking from the Firehose

The Big Six

Concurrency

Fault detection

From

http://www.erlang.org/download/armstrong_thesis_2003.pdf

Page 20: Drinking From The Firehose - The Erlang Way

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Drinking from the Firehose

The Big Six

Concurrency

Fault detection

Fault Identification

From

http://www.erlang.org/download/armstrong_thesis_2003.pdf

Page 21: Drinking From The Firehose - The Erlang Way

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Drinking from the Firehose

The Big Six

Concurrency

Fault detection

Fault Identification

Error Encapsulation

From

http://www.erlang.org/download/armstrong_thesis_2003.pdf

Page 22: Drinking From The Firehose - The Erlang Way

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Drinking from the Firehose

The Big Six

Concurrency

Fault detection

Fault Identification

Error Encapsulation

Code upgrade

From

http://www.erlang.org/download/armstrong_thesis_2003.pdf

Page 23: Drinking From The Firehose - The Erlang Way

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Drinking from the Firehose

The Big Six

Concurrency

Fault detection

Fault Identification

Error Encapsulation

Code upgrade

Stable Storage

From

http://www.erlang.org/download/armstrong_thesis_2003.pdf

Page 24: Drinking From The Firehose - The Erlang Way

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Drinking from the Firehose

The Big Six

Concurrency

Fault detection

Fault Identification

Error Encapsulation

Code upgrade

Stable Storage

From

http://www.erlang.org/download/armstrong_thesis_2003.pdf

Page 25: Drinking From The Firehose - The Erlang Way

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Drinking from the Firehose

The Big Six

Concurrency

Fault detection

Fault Identification

Error Encapsulation

Code upgrade

Stable Storage

From

http://www.erlang.org/download/armstrong_thesis_2003.pdf

Page 26: Drinking From The Firehose - The Erlang Way

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Drinking from the Firehose

Page 27: Drinking From The Firehose - The Erlang Way

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Drinking from the Firehose

** exception error: no match of

right hand side value

{error,unhappy}

Page 28: Drinking From The Firehose - The Erlang Way

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Drinking from the Firehose

Page 29: Drinking From The Firehose - The Erlang Way

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Drinking from the Firehose

The Big Six

Concurrency

Fault detection

Fault Identification

Error Encapsulation

Code upgrade

Stable Storage

From

http://www.erlang.org/download/armstrong_thesis_2003.pdf

Page 30: Drinking From The Firehose - The Erlang Way

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Drinking from the Firehose

** exception error: no match of

right hand side value

{error,unhappy}

Page 31: Drinking From The Firehose - The Erlang Way

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Drinking from the Firehose

Page 32: Drinking From The Firehose - The Erlang Way

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Drinking from the Firehose

The Big Six

Concurrency

Fault detection

Fault Identification

Error Encapsulation

Code upgrade

Stable Storage

From

http://www.erlang.org/download/armstrong_thesis_2003.pdf

Page 33: Drinking From The Firehose - The Erlang Way
Page 34: Drinking From The Firehose - The Erlang Way

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Drinking from the Firehose

The Big Six

Concurrency

Fault detection

Fault Identification

Error Encapsulation

Code upgrade

Stable Storage

From

http://www.erlang.org/download/armstrong_thesis_2003.pdf

Page 35: Drinking From The Firehose - The Erlang Way
Page 36: Drinking From The Firehose - The Erlang Way

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Drinking from the Firehose

The Big Six

Concurrency

Fault detection

Fault Identification

Error Encapsulation

Code upgrade

Stable Storage

From

http://www.erlang.org/download/armstrong_thesis_2003.pdf

Page 37: Drinking From The Firehose - The Erlang Way
Page 38: Drinking From The Firehose - The Erlang Way
Page 39: Drinking From The Firehose - The Erlang Way

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Drinking from the Firehose

The Fault Tolerant System

Page 40: Drinking From The Firehose - The Erlang Way

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Drinking from the Firehose

The Big Six

Concurrency

Fault detection

Fault Identification

Error Encapsulation

Code upgrade

Stable Storage

From

http://www.erlang.org/download/armstrong_thesis_2003.pdf

Page 41: Drinking From The Firehose - The Erlang Way

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Drinking from the Firehose

The Big Six

Concurrency

Fault detection

Fault Identification

Error Encapsulation

Code upgrade

Stable Storage

From

http://www.erlang.org/download/armstrong_thesis_2003.pdf

Page 42: Drinking From The Firehose - The Erlang Way

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Drinking from the Firehose

The Big Six

Concurrency

Fault detection

Fault Identification

Error Encapsulation

Code upgrade

Stable Storage

From

http://www.erlang.org/download/armstrong_thesis_2003.pdf

LOOSE C

OUPLING

Page 43: Drinking From The Firehose - The Erlang Way

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Drinking from the Firehose

Loose Coupling

Page 44: Drinking From The Firehose - The Erlang Way

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Drinking from the Firehose

Loose Coupling

Breeds Trust

Page 45: Drinking From The Firehose - The Erlang Way
Page 46: Drinking From The Firehose - The Erlang Way

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Drinking from the Firehose

Loose Coupling

Breeds Trust

Devotes Brainpower appropriately

Page 47: Drinking From The Firehose - The Erlang Way
Page 48: Drinking From The Firehose - The Erlang Way

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Drinking from the Firehose

Loose Coupling

Breeds Trust

Devotes Brainpower appropriately

Minimizes bugs

Page 49: Drinking From The Firehose - The Erlang Way
Page 50: Drinking From The Firehose - The Erlang Way

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Drinking from the Firehose

Fault Tolerance

60 - 90% of all SW projects fail

10 – 25% of all SW projects get abandoned

Page 51: Drinking From The Firehose - The Erlang Way
Page 52: Drinking From The Firehose - The Erlang Way

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Drinking from the Firehose

The Big Six - Systems

Concurrency

Fault detection

Fault Identification

Error Encapsulation

Code upgrade

Stable Storage

Page 53: Drinking From The Firehose - The Erlang Way

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Drinking from the Firehose

The Big Six - Systems

Concurrency

Fault detection

Fault Identification

Error Encapsulation

Code upgrade

Stable Storage

MONIT

ORING

Page 54: Drinking From The Firehose - The Erlang Way

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Drinking from the Firehose

Monitoring?

Page 55: Drinking From The Firehose - The Erlang Way

Monitoring?• Dashboards

Page 56: Drinking From The Firehose - The Erlang Way

Monitoring?• Dashboards

• Out of band systems

Page 57: Drinking From The Firehose - The Erlang Way

Monitoring?• Dashboards

• Out of band systems

• Polyglot safety

Page 58: Drinking From The Firehose - The Erlang Way

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Drinking from the Firehose

The Big Six - Systems

Concurrency

Fault detection

Fault Identification

Error Encapsulation

Code upgrade

Stable Storage

Page 59: Drinking From The Firehose - The Erlang Way

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Drinking from the Firehose

The Big Six - Systems

Concurrency

Fault detection

Fault Identification

Error Encapsulation

Code upgrade

Stable Storage

Polyglo

t

Persis

tence

Page 60: Drinking From The Firehose - The Erlang Way
Page 61: Drinking From The Firehose - The Erlang Way

Drinking from the Firehose

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Polyglot Persistence

Page 62: Drinking From The Firehose - The Erlang Way

Scale-Fail

DEVICE

STATUS

Page 63: Drinking From The Firehose - The Erlang Way

Drinking from the Firehose

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Data Stores

• State of the World

• Historical Data

• Configurations

• Billing

Page 64: Drinking From The Firehose - The Erlang Way

Drinking from the Firehose

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Data Stores

• State of the World

Page 65: Drinking From The Firehose - The Erlang Way

Drinking from the Firehose

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Data Stores

• State of the World ElasticSearch

Page 66: Drinking From The Firehose - The Erlang Way

Drinking from the Firehose

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Data Stores

• State of the World ElasticSearch

• Historical Data

Page 67: Drinking From The Firehose - The Erlang Way

Drinking from the Firehose

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Data Stores

• State of the World ElasticSearch

• Historical Data Cassandra

Page 68: Drinking From The Firehose - The Erlang Way

Drinking from the Firehose

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Data Stores

• State of the World ElasticSearch

• Historical Data Cassandra

• Configurations

Source: Wholly unscientific research by me.

Page 69: Drinking From The Firehose - The Erlang Way

Drinking from the Firehose

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Data Stores

• State of the World ElasticSearch

• Historical Data Cassandra

• Configurations Riak

Page 70: Drinking From The Firehose - The Erlang Way

Drinking from the Firehose

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Data Stores

• State of the World ElasticSearch

• Historical Data Cassandra

• Configurations Riak

• Billing

Page 71: Drinking From The Firehose - The Erlang Way

Drinking from the Firehose

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Data Stores

• State of the World ElasticSearch

• Historical Data Cassandra

• Configurations Riak

• Billing Postgres

Page 72: Drinking From The Firehose - The Erlang Way

Drinking from the Firehose

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Data Stores

• State of the World ElasticSearch

• Historical Data Cassandra

• Configurations Riak

• Billing Postgres

Polyglo

t

Persis

tence

Page 73: Drinking From The Firehose - The Erlang Way

Drinking from the Firehose

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Data Stores

• State of the World ElasticSearch

• Historical Data Cassandra

• Configurations Riak

• Billing Postgres

LOOSE C

OUPLING

Page 74: Drinking From The Firehose - The Erlang Way

Drinking from the Firehose

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Data Stores

• State of the World ElasticSearch

• Historical Data Cassandra

• Configurations Riak

• Billing Postgres

MONIT

ORING

Page 75: Drinking From The Firehose - The Erlang Way
Page 76: Drinking From The Firehose - The Erlang Way

1

1

1

Page 77: Drinking From The Firehose - The Erlang Way
Page 78: Drinking From The Firehose - The Erlang Way

Drinking from the Firehose

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Split Brain

• Its ubiquitous (thanks aphyr)

Page 79: Drinking From The Firehose - The Erlang Way

Drinking from the Firehose

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Split Brain

• Its ubiquitous (thanks aphyr)

• Zookeeper doesn’t necessarily help

Page 80: Drinking From The Firehose - The Erlang Way

Drinking from the Firehose

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Split Brain

• Its ubiquitous (thanks aphyr)

• Zookeeper doesn’t necessarily help

• Moving the problem around doesn’t necessarily help

Page 81: Drinking From The Firehose - The Erlang Way
Page 82: Drinking From The Firehose - The Erlang Way

Cheating classroom)

Page 83: Drinking From The Firehose - The Erlang Way

Drinking from the Firehose

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Cheating

• Stale status messages are OK

Page 84: Drinking From The Firehose - The Erlang Way

Drinking from the Firehose

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Cheating

• Stale status messages are OK

• Charts can miss data

Page 85: Drinking From The Firehose - The Erlang Way

Drinking from the Firehose

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Cheating

• Stale status messages are OK

• Charts can miss data

• Billing is sharded

Page 86: Drinking From The Firehose - The Erlang Way

Drinking from the Firehose

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Cheating

• Stale status messages are OK

• Charts can miss data

• Billing is sharded

• Availability zones (google.co.uk)

Page 87: Drinking From The Firehose - The Erlang Way

Scaling

Page 88: Drinking From The Firehose - The Erlang Way

Drinking from the Firehose

V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved

Drinking from the Firehose

Mahesh Paolini-Subramanya

(@dieswaytoofast)

V.P. R&D, Ubiquiti Networks