The Evolution of Hadoop at Spotify Rafal Wojdyla (rav@spotify.com) - - PowerPoint PPT Presentation

the evolution of hadoop at spotify
SMART_READER_LITE
LIVE PREVIEW

The Evolution of Hadoop at Spotify Rafal Wojdyla (rav@spotify.com) - - PowerPoint PPT Presentation

The Evolution of Hadoop at Spotify Rafal Wojdyla (rav@spotify.com) Josh Baer (jbx@spotify.com) @l_phant @ravwojdyla Technical Product Owner Data Engineer Data Infrastructure Hadoop Team Overview Growing Pains Gaining Focus The


slide-1
SLIDE 1
slide-2
SLIDE 2
slide-3
SLIDE 3

The Evolution

  • f Hadoop at

Spotify

Rafal Wojdyla (rav@spotify.com) Josh Baer (jbx@spotify.com)

slide-4
SLIDE 4

Technical Product Owner Data Infrastructure Data Engineer Hadoop Team @ravwojdyla @l_phant

slide-5
SLIDE 5

Overview

  • Growing Pains
  • Gaining Focus
  • The Future
slide-6
SLIDE 6

Growing Pains

slide-7
SLIDE 7

What is Spotify?

  • Music Streaming Service
  • Launched in 2008
  • Free and Premium Tiers
  • Available in 58 Countries
slide-8
SLIDE 8

75+ Million Active Users

slide-9
SLIDE 9

30+ Million Songs

slide-10
SLIDE 10

1+ Billion Plays/Day

slide-11
SLIDE 11

What is Spotify?

  • Data Infrastructure
  • 1700 Hadoop Nodes
  • 62 PB Storage
  • 30 TB/day from user logs
  • 400 TB/day generated by

Hadoop

slide-12
SLIDE 12

Powered by Data

  • Running App
  • Matches music to running tempo
  • Personalized running playlists in

multiple tempos

http:/ /www.theverge.com/2015/6/1/8696659/spotify-running-is-great-for-discovery
slide-13
SLIDE 13

Powered by Data

slide-14
SLIDE 14
slide-15
SLIDE 15

select track_id, artist_id, count(1) from user_activities where play_seconds > 30 and country = ‘DK’ group by track_id, artist_id limit 50;

slide-16
SLIDE 16
slide-17
SLIDE 17

Moving Data to Hadoop

10.123.133.333 - - [Mon, 3 June 2015 11:31:33 GMT] "GET /api/admin/job/ aggregator/status HTTP/1.1" 200 1847 "https://my.analytics.app/admin" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.81 Safari/537.36" 10.123.133.222 - - [Mon, 3 June 2015 11:31:43 GMT] "GET /api/admin/job/ aggregator/status HTTP/1.1" 200 1984 "https://my.analytics.app/admin" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.81 Safari/537.36” 10.123.133.222 - - [Mon, 3 June 2015 11:33:02 GMT] "GET /dashboard/ courses/1291726 HTTP/1.1" 304 - "https://my.analytics.app/admin" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.81 Safari/537.36" 10.321.145.111 - - [Mon, 3 June 2015 11:33:03 GMT] "GET /api/loggedInUser HTTP/1.1" 304 - "https://my.analytics.app/dashboard/courses/1291726" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.81 Safari/537.36" 10.112.322.111 - - [Mon, 3 June 2015 11:33:03 GMT] "POST /api/ instrumentation/events/new HTTP/1.1" 200 2 "https://my.analytics.app/ dashboard/courses/1291726" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.81 Safari/537.36” 10.123.133.222 - - [Mon, 3 June 2015 11:33:02 GMT] "GET /dashboard/ courses/1291726 HTTP/1.1" 304 - "https://my.analytics.app/admin" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.81 Safari/537.36"
  • Raw data is complicated
  • Often dirty
  • Evolving structure
  • Duplication all over
  • Getting data to a central

processing point is HARD

slide-18
SLIDE 18

LogArchiver

  • Original method to transport logs from APs to HDFS
  • Lasted from 2009 - 2013
  • Relies on rsync/scp and cron to move files around
slide-19
SLIDE 19

FAIL

slide-20
SLIDE 20

ERR, LESSON?

slide-21
SLIDE 21

Log -> HDFS latency reduced from hours to seconds!

slide-22
SLIDE 22
slide-23
SLIDE 23

Workflow Management Fail!

5 ¡* ¡* ¡* ¡* ¡ ¡ ¡ ¡spotify-­‑core ¡ ¡ ¡ ¡ ¡ ¡hadoop ¡jar ¡merge_hourly_logs.jar ¡ 15 ¡* ¡* ¡* ¡* ¡ ¡ ¡spotify-­‑core ¡ ¡ ¡ ¡ ¡ ¡hadoop ¡jar ¡aggregate_song_plays.jar ¡ 30 ¡* ¡* ¡* ¡* ¡ ¡ ¡spotify-­‑analytics ¡hadoop ¡jar ¡merge_song_metadata.jar ¡ 0 ¡1 ¡* ¡* ¡* ¡ ¡ ¡ ¡spotify-­‑core ¡ ¡ ¡ ¡ ¡ ¡hadoop ¡jar ¡daily_aggregate.jar ¡ 0 ¡2 ¡* ¡* ¡* ¡ ¡ ¡ ¡spotify-­‑core ¡ ¡ ¡ ¡ ¡ ¡hadoop ¡jar ¡calculate_toplist.jar

slide-24
SLIDE 24

https:/ /github.com/spotify/luigi

slide-25
SLIDE 25

[data-­‑sci@sj-­‑edge-­‑a1 ¡~] ¡$ ¡hdfs ¡dfs ¡-­‑ls ¡/data ¡ Found ¡3 ¡items ¡ drwxr-­‑xr-­‑x ¡ ¡ ¡-­‑ ¡hdfs ¡hadoop ¡ ¡ ¡ ¡ ¡0 ¡2015-­‑01-­‑01 ¡12:00 ¡lake ¡ drwxr-­‑xr-­‑x ¡ ¡ ¡-­‑ ¡hdfs ¡hadoop ¡ ¡ ¡ ¡ ¡0 ¡2015-­‑01-­‑01 ¡12:00 ¡pond ¡ drwxr-­‑xr-­‑x ¡ ¡ ¡-­‑ ¡hdfs ¡hadoop ¡ ¡ ¡ ¡ ¡0 ¡2015-­‑01-­‑01 ¡12:00 ¡ocean ¡ [data-­‑sci@sj-­‑edge-­‑a1 ¡~] ¡$ ¡hdfs ¡dfs ¡-­‑ls ¡/data/lake ¡ Found ¡1 ¡items ¡ drwxr-­‑xr-­‑x ¡ ¡ ¡-­‑ ¡hdfs ¡hadoop ¡ ¡ ¡ ¡ ¡1321451 ¡2015-­‑01-­‑01 ¡12:00 ¡boats.txt ¡ [data-­‑sci@sj-­‑edge-­‑a1 ¡~] ¡$ ¡hdfs ¡dfs ¡-­‑cat ¡/data/lake/boats.txt ¡ …

slide-26
SLIDE 26

https:/ /github.com/spotify/snakebite

slide-27
SLIDE 27

$ ¡time ¡for ¡i ¡in ¡{1..100}; ¡do ¡hdfs ¡dfs ¡-­‑ls ¡/ ¡> ¡/dev/null; ¡done ¡ real ¡3m32.014s ¡ user ¡6m15.891s ¡ sys ¡ ¡0m18.821s ¡ $ ¡time ¡for ¡i ¡in ¡{1..100}; ¡do ¡snakebite ¡ls ¡/ ¡> ¡/dev/null; ¡done ¡ real ¡0m34.760s ¡ user ¡0m29.962s ¡ sys ¡ ¡0m4.512s ¡

slide-28
SLIDE 28

Gaining Focus

slide-29
SLIDE 29

Hadoop Availability

  • In 2013:
  • Hadoop expanded to 200 nodes
  • Critical but not very reliable
  • Created a ‘squad’ with two missions:
  • Migrate to a new distribution with Yarn
  • Make Hadoop reliable
slide-30
SLIDE 30

How did we do?

Hadoop Uptime

90% 92% 94% 96% 98% 100%

Q3-`12 Q4-`12 Q1-`13 Q2-`13 Q3-`13 Q4-`13 Q1-`14 Q2-`14 Q3-`14 Q4-`14 Q1-`15 Q2-`15 Q3-`15

slide-31
SLIDE 31

How did we do?

Hadoop Uptime

90% 92% 94% 96% 98% 100%

Q3-`12 Q4-`12 Q1-`13 Q2-`13 Q3-`13 Q4-`13 Q1-`14 Q2-`14 Q3-`14 Q4-`14 Q1-`15 Q2-`15 Q3-`15

slide-32
SLIDE 32

How did we do?

Hadoop Uptime

90% 92% 94% 96% 98% 100%

Q3-`12 Q4-`12 Q1-`13 Q2-`13 Q3-`13 Q4-`13 Q1-`14 Q2-`14 Q3-`14 Q4-`14 Q1-`15 Q2-`15 Q3-`15

slide-33
SLIDE 33

How did we do?

Hadoop Uptime

90% 92% 94% 96% 98% 100%

Q3-`12 Q4-`12 Q1-`13 Q2-`13 Q3-`13 Q4-`13 Q1-`14 Q2-`14 Q3-`14 Q4-`14 Q1-`15 Q2-`15 Q3-`15

slide-34
SLIDE 34

How did we do?

Hadoop Uptime

90% 92% 94% 96% 98% 100%

Q3-`12 Q4-`12 Q1-`13 Q2-`13 Q3-`13 Q4-`13 Q1-`14 Q2-`14 Q3-`14 Q4-`14 Q1-`15 Q2-`15 Q3-`15

slide-35
SLIDE 35

How did we do?

Hadoop Uptime

90% 92% 94% 96% 98% 100%

Q3-`12 Q4-`12 Q1-`13 Q2-`13 Q3-`13 Q4-`13 Q1-`14 Q2-`14 Q3-`14 Q4-`14 Q1-`15 Q2-`15 Q3-`15

slide-36
SLIDE 36

What happened in the last quarter?

  • Expanded our cluster from ~1200 nodes to ~1700 nodes
  • When you scale Hadoop, the bugs in the code scale with it
  • HDFS-5790
  • HDFS-6425
slide-37
SLIDE 37

Uhh ohh…. I think I made a mistake

slide-38
SLIDE 38

[2014.03.12 ¡16:48:02 ¡| ¡data-­‑sci@edge-­‑1 ¡| ¡/home/data-­‑sci/development] ¡$ ¡snakebite ¡rm ¡-­‑R ¡/team/disco/ ¡test-­‑10/

slide-39
SLIDE 39

$ ¡snakebite ¡rm ¡-­‑R ¡/team/disco/ ¡test-­‑10/

slide-40
SLIDE 40

disco/ ¡test-­‑10

slide-41
SLIDE 41
slide-42
SLIDE 42

M O T H E R O F G O D

slide-43
SLIDE 43

$ ¡snakebite ¡rm ¡-­‑R ¡/team/disco/ ¡test-­‑10/ ¡

OK: ¡Deleted ¡/team/disco ¡

Goodbye Data! (1PB)

slide-44
SLIDE 44

Lessons Learned

  • “Sit on your hands before you type” - Wouter de Bie
  • Users will always want to retain data!
  • Remove superusers from ‘edgenodes’
  • Moving to trash = client-side implementation
slide-45
SLIDE 45

The Wild Wild West

slide-46
SLIDE 46

Pre-Production

slide-47
SLIDE 47

Going from Python to JVM

  • Most of our jobs were Hadoop (python) streaming
  • Lots of failures, slow performance
  • Had to find a better way
slide-48
SLIDE 48

Moving from Python to Crunch

  • Investigated several frameworks*
  • Selected Crunch:
  • Real types - compile time error detection, better testability
  • Higher level API - let the framework optimize for you
  • Better performance #JVM_FTW

*thewit.ch/scalding_crunchy_pig

slide-49
SLIDE 49
slide-50
SLIDE 50

Let’s Review

  • Getting data into Hadoop
  • Deploying data pipelines
  • Increasing availability and reliability of infrastructure
  • Killing it with performance
slide-51
SLIDE 51

The Future

slide-52
SLIDE 52

Growth %

571.429 1142.857 1714.286 2285.714 2857.143 3428.571 4000

2012 2013 2014 2015

Hadoop Usage Spotifz Users

Growth of Hadoop vs. Spotify Users

slide-53
SLIDE 53

Explosive Growth

  • Increased Spotify Users
  • Increased Use Cases
  • Increased Engineers
slide-54
SLIDE 54

Scaling Machines: Easier Scaling People: Harder

slide-55
SLIDE 55

User Feedback: Automate it!

slide-56
SLIDE 56

Inviso

Developed by Netflix: https:/ /github.com/Netflix/inviso

slide-57
SLIDE 57

Hadoop Report Card

  • Contains Statistics
  • Guidelines and Best

Practices

  • Sent Quarterly
slide-58
SLIDE 58

Apache Spark with Zeppelin

slide-59
SLIDE 59

Takeaways

  • There’s no golden path
  • No perfect solutions, only ones that work now!
  • Big Data is constantly evolving
  • Don’t be afraid to rebuild and replace!
slide-60
SLIDE 60

Join The Band!

Engineers needed in NYC, Stockholm

spotify.com/jobs

slide-61
SLIDE 61
slide-62
SLIDE 62