Python Through the Back Door: Netflix Presentation at CodeMash 2014

38
Python Through the Back Door CodeMash 2014 Roy Rapoport @royrapoport rsr@netflix.com www.linkedin.com/in/royrapoport
  • date post

    17-Oct-2014
  • Category

    Technology

  • view

    1.213
  • download

    0

description

A discussion of the technical problems that resulted in adopting Python as a first-class language within Netflix's cloud environment

Transcript of Python Through the Back Door: Netflix Presentation at CodeMash 2014

Page 1: Python Through the Back Door: Netflix Presentation at CodeMash 2014

Python Through the Back Door

!

CodeMash 2014 !

Roy Rapoport @royrapoport [email protected]

www.linkedin.com/in/royrapoport

Page 2: Python Through the Back Door: Netflix Presentation at CodeMash 2014

A Word About Me

!2

• About 20 years in technology • Systems engineering, networking,

software development, QA, release management

• Time at Netflix: 1655 days • Before at Netflix: Service Delivery in

the IT/Ops, troubleshooter, Builder of Python Things[tm]

• Current role: Insight Engineering •Real-Time Operational Insight

(4y:6m:11d)

Page 3: Python Through the Back Door: Netflix Presentation at CodeMash 2014

Stories We Tell

!3

• Technical Problems • Howler Monkey • Alerting

• Python As a First-Class Language • Culture and People

ProblemPythonPeople

Page 4: Python Through the Back Door: Netflix Presentation at CodeMash 2014

“Netflix Company Profile Now via self service*

!4

People

Go to your favorite Python REPL and type the following:

import re, requests!content = requests.get(“http://ir.netflix.com").content!content = content.replace(“ ", " ")!p = re.compile(r”.*over (\d+) .*in (\d+)”, re.S)!m = re.match(p, content)!print "Netflix is the world's leading Internet \! subscription service for enjoying TV and movies, \! with more than {} million subscribers in {} \! countries.”.format(m.group(1), m.group(2))!

*No whining. Remember that you’ll never again need to wait for me to update this slide like you had to wait for database access when you started your last job.”

- Jay Zarfoss, http://www.slideshare.net/zarfide

Page 5: Python Through the Back Door: Netflix Presentation at CodeMash 2014

Design Your Culture for Desired Outcomes

!5

1. Speed of innovation!2. Availability!3. Cost

People

Page 6: Python Through the Back Door: Netflix Presentation at CodeMash 2014

Design For What’s Important

!6

Freedom and Responsibility!Hire Smart Experienced People!

Set them Loose!Watch Magic Happen

People

Page 7: Python Through the Back Door: Netflix Presentation at CodeMash 2014

PoliciesRaise your hand if you love them

People

Page 8: Python Through the Back Door: Netflix Presentation at CodeMash 2014

Policies (How They Usually Work)

���8

People

Page 9: Python Through the Back Door: Netflix Presentation at CodeMash 2014

Policies (How They Usually Work)

���9

11/27/2006 “Sorry, but the standard monitor...is the HP 17" flat panel. I actually told a director last week that they couldn't have a 19" for a new office so I am not picking on just you.”

People

Page 10: Python Through the Back Door: Netflix Presentation at CodeMash 2014

Policies (How They Usually Work)

���10

!6/18/2007

“There is a request for quantity 2 17” flat panels. We have received direction from the CIO that no one will have more than 1 flat panel monitor. I just wanted to let you know that there will only be one monitor ordered ... The 17” is our only standard except for Legal.”

People

Page 11: Python Through the Back Door: Netflix Presentation at CodeMash 2014

Policies (How They Usually Work)

���11

•Prescriptive •Inflexible •Determined by others •Slow to change

People

Page 12: Python Through the Back Door: Netflix Presentation at CodeMash 2014

Policies @nflx

���12

People

Page 13: Python Through the Back Door: Netflix Presentation at CodeMash 2014

Policies @nflx

���13

!01/30/2013, 15:22 PST

I'd like to request a 15” MBP w/ Retina Display. I don't know how much you guys care about CPU specs -- it looks like the bump from 2.3GHz to 2.6GHz is reasonably priced at only about $100, so if it works for you that'd be nice. 16GB RAM and at least 512GB drive. !

01/31/2013 12:00 PST: “Forwarded to IT Purchasing to provide a quote to Roy for the requested configuration.” 13:33 PST: “Requesting quote from vendor” 15:32 PST: “Attached is the quote, please approve and I’ll place order” 15:46 PST: “Thanks for the rapid response. Please order.” 15:52 PST: “Ordered. PO #...”

People

Page 14: Python Through the Back Door: Netflix Presentation at CodeMash 2014

Policies @nflx

���14

• Descriptive

• As flexible as we are

• Describe what we choose to do/get

• Evolve quickly

People

Page 15: Python Through the Back Door: Netflix Presentation at CodeMash 2014

The Before Time

���15

Dozens of SSL Certificates

Decentralized

Kept Expiring

Hilarity would ensue

Amazon Resources

“No Preset Limit”

You know when you hit it

Hilarity would ensue

Problem

Page 16: Python Through the Back Door: Netflix Presentation at CodeMash 2014

The Before Time

���16

• Well-developed Developer Ecosystem

• Discovery

• DB Client

• Credentials Management

• Memory Object Cache

• Server Infrastructure

• Telemetry

• You wanted that for Java, right?

Python

Page 17: Python Through the Back Door: Netflix Presentation at CodeMash 2014

The Before Time

���17

• Just moved from IT/Ops

• Formally tasked with SSL cert issue as quarterly goal

• Limits issue “tacked” on

• Happily hackily Pythonic

• Didn’t know JavaPresenter Selfie

ProblemPython

Page 18: Python Through the Back Door: Netflix Presentation at CodeMash 2014

Architecture

���18

ELB

EC2

Filesystem

IP Range

DNS Domain

Cassandra

Certificate

Nagger

CherryPy

Problem

7/10/2011 Ready for beta

Page 19: Python Through the Back Door: Netflix Presentation at CodeMash 2014

Persistence• Started with SimpleDB

• Then Cassandra

• Drove creation of …

• import Discovery

• import Cassandra

• And a design error!19

Python

Page 20: Python Through the Back Door: Netflix Presentation at CodeMash 2014

Abstraction

!20

Python

• “The process of separating ideas from specific instances of those ideas at work.”

• Some abstraction: Good

• Too much abstraction burns your tongue*

• Known bug

* Mixed metaphor is mixed

Page 21: Python Through the Back Door: Netflix Presentation at CodeMash 2014

Architecture

���21

Problem

Page 22: Python Through the Back Door: Netflix Presentation at CodeMash 2014

Architecture

���22

Problem

Page 23: Python Through the Back Door: Netflix Presentation at CodeMash 2014

Alerting

���23

Problem

• Enterprise IT Solution • Managed by the Enterprise IT Alerting People • File Tickets • Send alerts to NOC • Completely separate from telemetry system

Copyright USAID Microlinks. CC Attribution 2.0

Page 24: Python Through the Back Door: Netflix Presentation at CodeMash 2014

Alerting

���24

Problem

• Enterprise IT Solution • Managed by the Enterprise IT Alerting People • File Tickets • Send alerts to NOC • Completely separate from telemetry system

Copyright: http://www.flickr.com/photos/s_w_ellis

CC Attribution 2.0 License

Page 25: Python Through the Back Door: Netflix Presentation at CodeMash 2014

Alerting

���25

Problem

•Already had a good telemetry system

•Outsourced notification to PagerDuty

•No alert routing (and deduplication)

Monitoring Alerting Notification

Page 26: Python Through the Back Door: Netflix Presentation at CodeMash 2014

Alerting

���26

People

•Space crunch •New cube mate: @jedberg •One Month Deadline

Page 27: Python Through the Back Door: Netflix Presentation at CodeMash 2014

Alerting

���27

Problem

alerting

api

Central Alert

Gateway

Pager Duty

Amazon SES

Atlas

Let’s Wake Someone Up (Livecoding for Fun and Profit)

Page 28: Python Through the Back Door: Netflix Presentation at CodeMash 2014

But Now We Need…

���28

Python

•import Discovery.publish

•import EVCache

•import EpicMetrics

•import Archaius

•import Asgard.Registry

•import AKMS

Page 29: Python Through the Back Door: Netflix Presentation at CodeMash 2014

AKMS?

���29

Python

In [1]: import AKMS!In [2]: ak = AKMS.AKMS("RoyWasHere")!In [3]: ak.keys()!Out[3]: ['MLQBAYLLDIGXPBQB', ‘eMr+Mdhv+E4xD+paPCxXF+’]!In [4]: a, s = ak.keys()!In [5]: s3_object = boto.connect_s3(a, s)!In [6]: ak = AKMS.AKMS("RoyWasHere", version=2)!In [7]: ak.keys()!Out[7]: [‘yn[…]G’, ‘rV[…]bKfSUHDSA’, ‘reallyLongStringElided']!In [8]: ak.expiration!Out[8]: 1389165118!In [9]: a, s, s2 = ak.keys()!In [10]: s3_object = boto.connect_s3(a, s, security_token=s2)

Page 30: Python Through the Back Door: Netflix Presentation at CodeMash 2014

So AKMS

���30

People

•Server more paranoid than most

•Making Python library was a pain

•Remember Jay?

•High lateral trust

•Prioritization autonomy

•Never ask for permission

Page 31: Python Through the Back Door: Netflix Presentation at CodeMash 2014

Lateral Trust

���31

People

•Humans are good game players

•What are the rules?

•Zero-sum games: I want you to lose

•Stack ranking

•Fixed bonus / raise pools

Page 32: Python Through the Back Door: Netflix Presentation at CodeMash 2014

Lateral Trust @nflx

���32

People

•No fixed pools for anything

•No ranking (at all)

•Reviews != raises

•Smart people generally make good decisions

•Global optimization

Page 33: Python Through the Back Door: Netflix Presentation at CodeMash 2014

Subordinate Trust @nflx

���33

People

•Focus on results

•Unleash employees

•Encourage disagreement

•Accept dissent

•Job #1: Attract and retain world-class talent

Page 34: Python Through the Back Door: Netflix Presentation at CodeMash 2014

Manager Trust @nflx

���34

People

•Question, question, question

•Drive for context, not decisions

•Nobody is above questioning

Page 35: Python Through the Back Door: Netflix Presentation at CodeMash 2014

Field of Dreams

���35

Python

•Turned out I wasn’t the only one •Striking the right balance between MVP and future growth (maybe)

•And if it hadn’t … it’d still have been the right choice

Page 36: Python Through the Back Door: Netflix Presentation at CodeMash 2014

A Virtuous Cycle

���36

Python

•Requirement for high impact •No process for permission •Unorthodox language choice •Lateral support for development •Increased adoption •… •Profit!*

PeopleProblem

* (or at least a new standard)

Page 37: Python Through the Back Door: Netflix Presentation at CodeMash 2014

!37

http://bit.ly/netflixcmpython

Tell me what you think. You know you want to.

Page 38: Python Through the Back Door: Netflix Presentation at CodeMash 2014

Attributions

���38

http://www.flickr.com/photos/watchsmart/

http://www.flickr.com/photos/yaketyyakyak/

Pem Dorjee Sherpa