SlideShare a Scribd company logo
1 of 41
Download to read offline
Spark Workflow Management
Romi Kuntsman
Senior Big Data Engineer @ Totango
romi@totango.com
https://il.linkedin.com/in/romik
„Big things are happening here“ Meetup
2015-04-29
Agenda
●
Totango and Customer Success
●
Totango architecture overview
●
Apache Spark computing framework
●
Luigi workflow Engine
●
Luigi in Totango
Totango and Customer Success
Your customers' success is your success
SaaS Customer Journey
DECREASE VALUE
DECREASE VALUE
CHURN
CHURN
GROW VALUE
FIRST VALUE
START
INCREASE USERS
INCREASE USAGE
EXPAND FUNCTIONALITY
CHURN
ONGOING VALUE
Customer Success Platform
●
Analytics for SaaS companies
●
Clear view of customer journey
●
Proactively prevent churn
●
Increase upsale
●
Track feature, module and total usage
●
Health score based on usages pattern
●
Improve conversion from trial to paying
Health Console
Module Statistics
Feature Adoption
About Totango
●
Founded in 2010
●
Size: ~50 (half R&D)
●
Offices in Tel Aviv, San Mateo CA
●
120+ customers
●
~70 million events per day
●
~1.5 billion indexed documents per month
●
Hosted on Amazon Web Services
Totango Architecture Overview
From usage information to actionable analytics
Terminology
●
Service – Totango's customer (e.g. Zendesk)
●
Account – Service's (Zendesk's) customer
●
SDR (Service Data Record) – User activity
event (e.g. user Joe from account Acme did
activity Login in module Application)
SDR reception
●
Clients send SDRs to the gateway, where they
are collected, filtered, packaged and finally
stored in S3 for daily/hourly batch processing.
●
Realtime processing also notified.
Batch Workflow
Account Data Flow
1) Raw Data (SDRs)
2) Account Aging (MySQL - legacy)
3) Activity Aggregations (Hadoop – legacy)
4) Metrics (Spark)
5) Health (Spark)
6) Alerts (Spark)
7) Indexing to Elasticsearch
Data Structure
●
Account documents stored on Amazon S3
●
Hierarchial directory structure per task param:
e.g. /s-1234/prod/2015-04-27/account/metrics
●
Documents have a predefined JSON schema.
JSON mapped directly to Java document class
●
Each file is an immutable collection of documents
One object per line – easily partitioned by lines
Apache Spark
One tool to rule all data transformations
Resilient Distributed Datasets
●
RDDs – distributed memory abstraction that lets
programmers perform in-memory computations
on large clusters in a fault-tolerant way
●
Initial RDD created from stable storage
●
Programmer defines a transformation from an
immutable input object to a new output object
●
Transformation function class can (read: should!)
be built and tested separately from Spark
Transformation flow
Read: inputRows = sparkContext.textFile(inputPath)
Decode: inputDocuments = inputRows.map(new
jsonToAccountDocument())
Trasform: docsWithHealth = inputDocuments.map(new
augmentDocumentWithHealth(healthCalcMetadata))
… other transformations may be done, all in memory …
Encode: outputRows = docsWithHealth.map(new
accountDocumentToJson())
Write: outputRows.saveAsTextFile(outputPath)
Examples (Java)
Class AugmentDocumentWithHealth implements
Function<AccountDocument, AccountDocument>
AccountDocument call(final AccountDocument document)
throws Exception { … return document with health … }
Class AccountHealthToAlerts implements
FlatMapFunction<AccountDocument, EventDocument>
Iterable<EventDocument> call(final AccountDocument
document) throws Exception { … generate alerts … }
Transformation function
●
Passed as parameter to Spark transformation:
map, reduce, filter, flatMap, mapPartitions
●
Can (read: should!!) be checked in Unit Tests
●
Serializable – sent to Spark worker serialized
●
Function must be idempotent!
●
May be passed immutable metadata
Luigi Workflow Engine
You build the tasks, it takes care of the plumbing
Why a workflow engine?
●
Managing many ETL jobs
●
Dependencies between jobs
●
Continue pipeline from point of failure
●
Separate workflow per service per date
●
Overview and drill-down status Web UI
●
Manual intervention
Workflow engines
●
Azkaban, by LinkedIn (mostly for Hadoop)
●
Oozie, by Apache (only for Hadoop)
●
Amazon Simple Workflow Service (too generic)
●
Amazon Data Pipeline (deeply tied to AWS)
●
Luigi, by Spotify (customizable) – our choice!
What is Luigi
●
Like Makefile – but in Python, and for data
●
Dependencies are managed directly in code
●
Generic and easily extendable
●
Visualization of task status and dependency
●
Command-line interface
Luigi Task Structure
●
Extend luigi.Task
Implement 4 methods:
●
def input(self) (optional)
●
def output(self)
●
def depends(self)
●
def run(self)
Luigi Task Example
Luigi Predefined Tasks
●
HadoopJobTask
●
SparkSubmitTask
●
CopyToIndex (ES)
●
HiveQueryTask
●
PigJobTask
●
CopyToTable (RDMS)
●
… many others
Luigi Task Parameters
Luigi Command-line
Luigi Task List
Luigi Dependency Graph
Luigi Dependency Graph
Luigi in Totango
This is how we do it
Our codebase is in Java
Java class is called inside the task run method
Jenkins for Luigi
Gameboy
●
Totango-specific controller for Luigi
●
Provides high level overview
●
Enable manual re-run of specific tasks
●
Monitor progress, performance, run time,
queue, worker load etc
Gameboy
Gameboy
Gameboy
Summary
●
Typical data flow – from raw data to insights
●
We use Spark for fast in-memory
transformations, all code is in Java
●
Our batch processing pipeline consist of a
series of tasks, which are managed in Luigi
●
We don't use all of Luigi's python abilities, and
we've added some new management abilities
Questions?
The end is only the beginning

More Related Content

What's hot

How I learned to time travel, or, data pipelining and scheduling with Airflow
How I learned to time travel, or, data pipelining and scheduling with AirflowHow I learned to time travel, or, data pipelining and scheduling with Airflow
How I learned to time travel, or, data pipelining and scheduling with Airflow
Laura Lorenz
 
Interactive learning analytics dashboards with ELK (Elasticsearch Logstash Ki...
Interactive learning analytics dashboards with ELK (Elasticsearch Logstash Ki...Interactive learning analytics dashboards with ELK (Elasticsearch Logstash Ki...
Interactive learning analytics dashboards with ELK (Elasticsearch Logstash Ki...
Andrii Vozniuk
 
Presto - Hadoop Conference Japan 2014
Presto - Hadoop Conference Japan 2014Presto - Hadoop Conference Japan 2014
Presto - Hadoop Conference Japan 2014
Sadayuki Furuhashi
 

What's hot (20)

Apache Airflow in Production
Apache Airflow in ProductionApache Airflow in Production
Apache Airflow in Production
 
Introducing Apache Airflow and how we are using it
Introducing Apache Airflow and how we are using itIntroducing Apache Airflow and how we are using it
Introducing Apache Airflow and how we are using it
 
Migrating from Redshift to Spark at Stitch Fix: Spark Summit East talk by Sky...
Migrating from Redshift to Spark at Stitch Fix: Spark Summit East talk by Sky...Migrating from Redshift to Spark at Stitch Fix: Spark Summit East talk by Sky...
Migrating from Redshift to Spark at Stitch Fix: Spark Summit East talk by Sky...
 
Jorge de la Cruz [Veeam Software] | RESTful API – How to Consume, Extract, St...
Jorge de la Cruz [Veeam Software] | RESTful API – How to Consume, Extract, St...Jorge de la Cruz [Veeam Software] | RESTful API – How to Consume, Extract, St...
Jorge de la Cruz [Veeam Software] | RESTful API – How to Consume, Extract, St...
 
How I learned to time travel, or, data pipelining and scheduling with Airflow
How I learned to time travel, or, data pipelining and scheduling with AirflowHow I learned to time travel, or, data pipelining and scheduling with Airflow
How I learned to time travel, or, data pipelining and scheduling with Airflow
 
Log analysis using Logstash,ElasticSearch and Kibana
Log analysis using Logstash,ElasticSearch and KibanaLog analysis using Logstash,ElasticSearch and Kibana
Log analysis using Logstash,ElasticSearch and Kibana
 
Logs aggregation and analysis
Logs aggregation and analysisLogs aggregation and analysis
Logs aggregation and analysis
 
Interactive learning analytics dashboards with ELK (Elasticsearch Logstash Ki...
Interactive learning analytics dashboards with ELK (Elasticsearch Logstash Ki...Interactive learning analytics dashboards with ELK (Elasticsearch Logstash Ki...
Interactive learning analytics dashboards with ELK (Elasticsearch Logstash Ki...
 
Log aggregation and analysis
Log aggregation and analysisLog aggregation and analysis
Log aggregation and analysis
 
ELK at LinkedIn - Kafka, scaling, lessons learned
ELK at LinkedIn - Kafka, scaling, lessons learnedELK at LinkedIn - Kafka, scaling, lessons learned
ELK at LinkedIn - Kafka, scaling, lessons learned
 
Data Pipelines with Python - NWA TechFest 2017
Data Pipelines with Python - NWA TechFest 2017Data Pipelines with Python - NWA TechFest 2017
Data Pipelines with Python - NWA TechFest 2017
 
Managing data workflows with Luigi
Managing data workflows with LuigiManaging data workflows with Luigi
Managing data workflows with Luigi
 
Real Time Data Processing With Spark Streaming, Node.js and Redis with Visual...
Real Time Data Processing With Spark Streaming, Node.js and Redis with Visual...Real Time Data Processing With Spark Streaming, Node.js and Redis with Visual...
Real Time Data Processing With Spark Streaming, Node.js and Redis with Visual...
 
ELK Wrestling (Leeds DevOps)
ELK Wrestling (Leeds DevOps)ELK Wrestling (Leeds DevOps)
ELK Wrestling (Leeds DevOps)
 
What's coming in Airflow 2.0? - NYC Apache Airflow Meetup
What's coming in Airflow 2.0? - NYC Apache Airflow MeetupWhat's coming in Airflow 2.0? - NYC Apache Airflow Meetup
What's coming in Airflow 2.0? - NYC Apache Airflow Meetup
 
Presto - Hadoop Conference Japan 2014
Presto - Hadoop Conference Japan 2014Presto - Hadoop Conference Japan 2014
Presto - Hadoop Conference Japan 2014
 
Introduction to Streaming Distributed Processing with Storm
Introduction to Streaming Distributed Processing with StormIntroduction to Streaming Distributed Processing with Storm
Introduction to Streaming Distributed Processing with Storm
 
Presto Strata Hadoop SJ 2016 short talk
Presto Strata Hadoop SJ 2016 short talkPresto Strata Hadoop SJ 2016 short talk
Presto Strata Hadoop SJ 2016 short talk
 
Presto at Facebook - Presto Meetup @ Boston (10/6/2015)
Presto at Facebook - Presto Meetup @ Boston (10/6/2015)Presto at Facebook - Presto Meetup @ Boston (10/6/2015)
Presto at Facebook - Presto Meetup @ Boston (10/6/2015)
 
Presto at Twitter
Presto at TwitterPresto at Twitter
Presto at Twitter
 

Similar to Spark Workflow Management

Webinar september 2013
Webinar september 2013Webinar september 2013
Webinar september 2013
Marc Gille
 
From Zero to Streaming Healthcare in Production (Alexander Kouznetsov, Invita...
From Zero to Streaming Healthcare in Production (Alexander Kouznetsov, Invita...From Zero to Streaming Healthcare in Production (Alexander Kouznetsov, Invita...
From Zero to Streaming Healthcare in Production (Alexander Kouznetsov, Invita...
confluent
 

Similar to Spark Workflow Management (20)

Dataflow.pptx
Dataflow.pptxDataflow.pptx
Dataflow.pptx
 
Apache Airflow in the Cloud: Programmatically orchestrating workloads with Py...
Apache Airflow in the Cloud: Programmatically orchestrating workloads with Py...Apache Airflow in the Cloud: Programmatically orchestrating workloads with Py...
Apache Airflow in the Cloud: Programmatically orchestrating workloads with Py...
 
Laskar: High-Velocity GraphQL & Lambda-based Software Development Model
Laskar: High-Velocity GraphQL & Lambda-based Software Development ModelLaskar: High-Velocity GraphQL & Lambda-based Software Development Model
Laskar: High-Velocity GraphQL & Lambda-based Software Development Model
 
Webinar september 2013
Webinar september 2013Webinar september 2013
Webinar september 2013
 
The Lyft data platform: Now and in the future
The Lyft data platform: Now and in the futureThe Lyft data platform: Now and in the future
The Lyft data platform: Now and in the future
 
Lyft data Platform - 2019 slides
Lyft data Platform - 2019 slidesLyft data Platform - 2019 slides
Lyft data Platform - 2019 slides
 
Interactive workflow management using Azkaban
Interactive workflow management using AzkabanInteractive workflow management using Azkaban
Interactive workflow management using Azkaban
 
Building data "Py-pelines"
Building data "Py-pelines"Building data "Py-pelines"
Building data "Py-pelines"
 
Airflow Intro-1.pdf
Airflow Intro-1.pdfAirflow Intro-1.pdf
Airflow Intro-1.pdf
 
A Tool For Big Data Analysis using Apache Spark
A Tool For Big Data Analysis using Apache SparkA Tool For Big Data Analysis using Apache Spark
A Tool For Big Data Analysis using Apache Spark
 
GraphQL is actually rest
GraphQL is actually restGraphQL is actually rest
GraphQL is actually rest
 
What are the basic key points to focus on while learning Full-stack web devel...
What are the basic key points to focus on while learning Full-stack web devel...What are the basic key points to focus on while learning Full-stack web devel...
What are the basic key points to focus on while learning Full-stack web devel...
 
MongoDB .local Houston 2019: Wide Ranging Analytical Solutions on MongoDB
MongoDB .local Houston 2019: Wide Ranging Analytical Solutions on MongoDBMongoDB .local Houston 2019: Wide Ranging Analytical Solutions on MongoDB
MongoDB .local Houston 2019: Wide Ranging Analytical Solutions on MongoDB
 
Web App Prototypes with Google App Engine
Web App Prototypes with Google App EngineWeb App Prototypes with Google App Engine
Web App Prototypes with Google App Engine
 
From Zero to Streaming Healthcare in Production (Alexander Kouznetsov, Invita...
From Zero to Streaming Healthcare in Production (Alexander Kouznetsov, Invita...From Zero to Streaming Healthcare in Production (Alexander Kouznetsov, Invita...
From Zero to Streaming Healthcare in Production (Alexander Kouznetsov, Invita...
 
Website Monitoring with Distributed Messages/Tasks Processing (AMQP & RabbitM...
Website Monitoring with Distributed Messages/Tasks Processing (AMQP & RabbitM...Website Monitoring with Distributed Messages/Tasks Processing (AMQP & RabbitM...
Website Monitoring with Distributed Messages/Tasks Processing (AMQP & RabbitM...
 
Dust.js
Dust.jsDust.js
Dust.js
 
Lean and mean MongoDB
Lean and mean MongoDBLean and mean MongoDB
Lean and mean MongoDB
 
Company Visitor Management System Report.docx
Company Visitor Management System Report.docxCompany Visitor Management System Report.docx
Company Visitor Management System Report.docx
 
Creating a custom API for a headless Drupal
Creating a custom API for a headless DrupalCreating a custom API for a headless Drupal
Creating a custom API for a headless Drupal
 

Recently uploaded

➥🔝 7737669865 🔝▻ mahisagar Call-girls in Women Seeking Men 🔝mahisagar🔝 Esc...
➥🔝 7737669865 🔝▻ mahisagar Call-girls in Women Seeking Men  🔝mahisagar🔝   Esc...➥🔝 7737669865 🔝▻ mahisagar Call-girls in Women Seeking Men  🔝mahisagar🔝   Esc...
➥🔝 7737669865 🔝▻ mahisagar Call-girls in Women Seeking Men 🔝mahisagar🔝 Esc...
amitlee9823
 
Call Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night StandCall Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night Stand
amitlee9823
 
➥🔝 7737669865 🔝▻ Bangalore Call-girls in Women Seeking Men 🔝Bangalore🔝 Esc...
➥🔝 7737669865 🔝▻ Bangalore Call-girls in Women Seeking Men  🔝Bangalore🔝   Esc...➥🔝 7737669865 🔝▻ Bangalore Call-girls in Women Seeking Men  🔝Bangalore🔝   Esc...
➥🔝 7737669865 🔝▻ Bangalore Call-girls in Women Seeking Men 🔝Bangalore🔝 Esc...
amitlee9823
 
Call Girls In Nandini Layout ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Nandini Layout ☎ 7737669865 🥵 Book Your One night StandCall Girls In Nandini Layout ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Nandini Layout ☎ 7737669865 🥵 Book Your One night Stand
amitlee9823
 
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men 🔝malwa🔝 Escorts Ser...
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men  🔝malwa🔝   Escorts Ser...➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men  🔝malwa🔝   Escorts Ser...
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men 🔝malwa🔝 Escorts Ser...
amitlee9823
 
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
amitlee9823
 
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
amitlee9823
 
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
amitlee9823
 
➥🔝 7737669865 🔝▻ Mathura Call-girls in Women Seeking Men 🔝Mathura🔝 Escorts...
➥🔝 7737669865 🔝▻ Mathura Call-girls in Women Seeking Men  🔝Mathura🔝   Escorts...➥🔝 7737669865 🔝▻ Mathura Call-girls in Women Seeking Men  🔝Mathura🔝   Escorts...
➥🔝 7737669865 🔝▻ Mathura Call-girls in Women Seeking Men 🔝Mathura🔝 Escorts...
amitlee9823
 
Call Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night StandCall Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night Stand
amitlee9823
 
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get CytotecAbortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Riyadh +966572737505 get cytotec
 
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
amitlee9823
 
Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...
Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...
Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...
amitlee9823
 
➥🔝 7737669865 🔝▻ Thrissur Call-girls in Women Seeking Men 🔝Thrissur🔝 Escor...
➥🔝 7737669865 🔝▻ Thrissur Call-girls in Women Seeking Men  🔝Thrissur🔝   Escor...➥🔝 7737669865 🔝▻ Thrissur Call-girls in Women Seeking Men  🔝Thrissur🔝   Escor...
➥🔝 7737669865 🔝▻ Thrissur Call-girls in Women Seeking Men 🔝Thrissur🔝 Escor...
amitlee9823
 

Recently uploaded (20)

Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFx
 
➥🔝 7737669865 🔝▻ mahisagar Call-girls in Women Seeking Men 🔝mahisagar🔝 Esc...
➥🔝 7737669865 🔝▻ mahisagar Call-girls in Women Seeking Men  🔝mahisagar🔝   Esc...➥🔝 7737669865 🔝▻ mahisagar Call-girls in Women Seeking Men  🔝mahisagar🔝   Esc...
➥🔝 7737669865 🔝▻ mahisagar Call-girls in Women Seeking Men 🔝mahisagar🔝 Esc...
 
Call Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night StandCall Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night Stand
 
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% SecureCall me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
 
➥🔝 7737669865 🔝▻ Bangalore Call-girls in Women Seeking Men 🔝Bangalore🔝 Esc...
➥🔝 7737669865 🔝▻ Bangalore Call-girls in Women Seeking Men  🔝Bangalore🔝   Esc...➥🔝 7737669865 🔝▻ Bangalore Call-girls in Women Seeking Men  🔝Bangalore🔝   Esc...
➥🔝 7737669865 🔝▻ Bangalore Call-girls in Women Seeking Men 🔝Bangalore🔝 Esc...
 
Call Girls In Nandini Layout ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Nandini Layout ☎ 7737669865 🥵 Book Your One night StandCall Girls In Nandini Layout ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Nandini Layout ☎ 7737669865 🥵 Book Your One night Stand
 
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men 🔝malwa🔝 Escorts Ser...
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men  🔝malwa🔝   Escorts Ser...➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men  🔝malwa🔝   Escorts Ser...
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men 🔝malwa🔝 Escorts Ser...
 
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
 
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
 
April 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's AnalysisApril 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's Analysis
 
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
 
Predicting Loan Approval: A Data Science Project
Predicting Loan Approval: A Data Science ProjectPredicting Loan Approval: A Data Science Project
Predicting Loan Approval: A Data Science Project
 
Capstone Project on IBM Data Analytics Program
Capstone Project on IBM Data Analytics ProgramCapstone Project on IBM Data Analytics Program
Capstone Project on IBM Data Analytics Program
 
➥🔝 7737669865 🔝▻ Mathura Call-girls in Women Seeking Men 🔝Mathura🔝 Escorts...
➥🔝 7737669865 🔝▻ Mathura Call-girls in Women Seeking Men  🔝Mathura🔝   Escorts...➥🔝 7737669865 🔝▻ Mathura Call-girls in Women Seeking Men  🔝Mathura🔝   Escorts...
➥🔝 7737669865 🔝▻ Mathura Call-girls in Women Seeking Men 🔝Mathura🔝 Escorts...
 
Call Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night StandCall Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night Stand
 
hybrid Seed Production In Chilli & Capsicum.pptx
hybrid Seed Production In Chilli & Capsicum.pptxhybrid Seed Production In Chilli & Capsicum.pptx
hybrid Seed Production In Chilli & Capsicum.pptx
 
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get CytotecAbortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
 
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
 
Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...
Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...
Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...
 
➥🔝 7737669865 🔝▻ Thrissur Call-girls in Women Seeking Men 🔝Thrissur🔝 Escor...
➥🔝 7737669865 🔝▻ Thrissur Call-girls in Women Seeking Men  🔝Thrissur🔝   Escor...➥🔝 7737669865 🔝▻ Thrissur Call-girls in Women Seeking Men  🔝Thrissur🔝   Escor...
➥🔝 7737669865 🔝▻ Thrissur Call-girls in Women Seeking Men 🔝Thrissur🔝 Escor...
 

Spark Workflow Management

  • 1. Spark Workflow Management Romi Kuntsman Senior Big Data Engineer @ Totango romi@totango.com https://il.linkedin.com/in/romik „Big things are happening here“ Meetup 2015-04-29
  • 2. Agenda ● Totango and Customer Success ● Totango architecture overview ● Apache Spark computing framework ● Luigi workflow Engine ● Luigi in Totango
  • 3. Totango and Customer Success Your customers' success is your success
  • 4. SaaS Customer Journey DECREASE VALUE DECREASE VALUE CHURN CHURN GROW VALUE FIRST VALUE START INCREASE USERS INCREASE USAGE EXPAND FUNCTIONALITY CHURN ONGOING VALUE
  • 5. Customer Success Platform ● Analytics for SaaS companies ● Clear view of customer journey ● Proactively prevent churn ● Increase upsale ● Track feature, module and total usage ● Health score based on usages pattern ● Improve conversion from trial to paying
  • 9. About Totango ● Founded in 2010 ● Size: ~50 (half R&D) ● Offices in Tel Aviv, San Mateo CA ● 120+ customers ● ~70 million events per day ● ~1.5 billion indexed documents per month ● Hosted on Amazon Web Services
  • 10. Totango Architecture Overview From usage information to actionable analytics
  • 11. Terminology ● Service – Totango's customer (e.g. Zendesk) ● Account – Service's (Zendesk's) customer ● SDR (Service Data Record) – User activity event (e.g. user Joe from account Acme did activity Login in module Application)
  • 12. SDR reception ● Clients send SDRs to the gateway, where they are collected, filtered, packaged and finally stored in S3 for daily/hourly batch processing. ● Realtime processing also notified.
  • 14. Account Data Flow 1) Raw Data (SDRs) 2) Account Aging (MySQL - legacy) 3) Activity Aggregations (Hadoop – legacy) 4) Metrics (Spark) 5) Health (Spark) 6) Alerts (Spark) 7) Indexing to Elasticsearch
  • 15. Data Structure ● Account documents stored on Amazon S3 ● Hierarchial directory structure per task param: e.g. /s-1234/prod/2015-04-27/account/metrics ● Documents have a predefined JSON schema. JSON mapped directly to Java document class ● Each file is an immutable collection of documents One object per line – easily partitioned by lines
  • 16. Apache Spark One tool to rule all data transformations
  • 17. Resilient Distributed Datasets ● RDDs – distributed memory abstraction that lets programmers perform in-memory computations on large clusters in a fault-tolerant way ● Initial RDD created from stable storage ● Programmer defines a transformation from an immutable input object to a new output object ● Transformation function class can (read: should!) be built and tested separately from Spark
  • 18. Transformation flow Read: inputRows = sparkContext.textFile(inputPath) Decode: inputDocuments = inputRows.map(new jsonToAccountDocument()) Trasform: docsWithHealth = inputDocuments.map(new augmentDocumentWithHealth(healthCalcMetadata)) … other transformations may be done, all in memory … Encode: outputRows = docsWithHealth.map(new accountDocumentToJson()) Write: outputRows.saveAsTextFile(outputPath)
  • 19. Examples (Java) Class AugmentDocumentWithHealth implements Function<AccountDocument, AccountDocument> AccountDocument call(final AccountDocument document) throws Exception { … return document with health … } Class AccountHealthToAlerts implements FlatMapFunction<AccountDocument, EventDocument> Iterable<EventDocument> call(final AccountDocument document) throws Exception { … generate alerts … }
  • 20. Transformation function ● Passed as parameter to Spark transformation: map, reduce, filter, flatMap, mapPartitions ● Can (read: should!!) be checked in Unit Tests ● Serializable – sent to Spark worker serialized ● Function must be idempotent! ● May be passed immutable metadata
  • 21. Luigi Workflow Engine You build the tasks, it takes care of the plumbing
  • 22. Why a workflow engine? ● Managing many ETL jobs ● Dependencies between jobs ● Continue pipeline from point of failure ● Separate workflow per service per date ● Overview and drill-down status Web UI ● Manual intervention
  • 23. Workflow engines ● Azkaban, by LinkedIn (mostly for Hadoop) ● Oozie, by Apache (only for Hadoop) ● Amazon Simple Workflow Service (too generic) ● Amazon Data Pipeline (deeply tied to AWS) ● Luigi, by Spotify (customizable) – our choice!
  • 24. What is Luigi ● Like Makefile – but in Python, and for data ● Dependencies are managed directly in code ● Generic and easily extendable ● Visualization of task status and dependency ● Command-line interface
  • 25. Luigi Task Structure ● Extend luigi.Task Implement 4 methods: ● def input(self) (optional) ● def output(self) ● def depends(self) ● def run(self)
  • 27. Luigi Predefined Tasks ● HadoopJobTask ● SparkSubmitTask ● CopyToIndex (ES) ● HiveQueryTask ● PigJobTask ● CopyToTable (RDMS) ● … many others
  • 33. Luigi in Totango This is how we do it
  • 34. Our codebase is in Java Java class is called inside the task run method
  • 36. Gameboy ● Totango-specific controller for Luigi ● Provides high level overview ● Enable manual re-run of specific tasks ● Monitor progress, performance, run time, queue, worker load etc
  • 40. Summary ● Typical data flow – from raw data to insights ● We use Spark for fast in-memory transformations, all code is in Java ● Our batch processing pipeline consist of a series of tasks, which are managed in Luigi ● We don't use all of Luigi's python abilities, and we've added some new management abilities
  • 41. Questions? The end is only the beginning

Editor's Notes

  1. בחברות SaaS, אינם קונים רשיון אלא משלמים עבור שימוש.הם יישארו וישלמו כל עוד הם מרוצים, אך בכל שלב הם גם יכולים לעזוב בפתאומיות ולא לחדש את המנוי. כדי למנוע עזיבה, צריך להבין את מצב הלקוח, לפני שהוא קיבל את ההחלטה לעזוב כי אז כבר מאוחר מדי. גם ללקוח קיים שאינו חושב לעזוב, אפשר לעזוב לנצל את המוצר טוב יותר, להגדיל את אפשרויות השימוש שלו, להרחיב את המנוי וכו&amp;apos;. תחום ה-Customer Success הוא ניהול האינטראקציה עם הלקוחות בכל שלבי המסע שלהם.
  2. אז מה אנחנו מאפשרים? כלי ניתוח עבור חברות המספקות תוכנה כשירות. הצגה ברורה של מסע הלקוח, החל מהשלב שהוא מתנסה במוצר, כשהוא רוכש מנוי, כיצד הוא מפיק ערך, ועוד גילוי ירידה בשימוש לפני שהדבר הופך להחלטה לעזוב הגדלת מכירות של תכונות נוספות שהלקוח יפיק מהן ערך מעקב אחר שימוש ברמת תכונה, מודול או בסיכום כללי מדד בריאות המוגדר על בסיס דפוסי השימוש במוצר שיפור ההמרה של לקוחות מתנסים למשלמים
  3. ככה נראה ה-Health Console שלנו ניתן לראות סיכום של הלקוחות, לפי סגמנטיםלמשל לקוחות חדשים, לקוחות גדולים, וכו&amp;apos;
  4. ניתן לעקוב אחר שימוש במודולים שונים במערכת, על פני הזמן ובחלוקות לפי פרמטרים שונים
  5. אנחנו עושים dogfooding ומשתמשים במערכת שלנו על עצמנו כשאנחנו מכניסים פיצ&amp;apos;ר חדש, אנחנו מודדים את השימוש של חלקים שונים בו כדי להבין כיצד משתמשים בו, האם יש חלקים שחוששים להשתמש בהם או לא ברור איך הגרף מראה את הסיכום הכללי, וניתן ללחוץ ולהכנס לרשימת הלקוחות המפורטת ולראות מי השתמש במה
  6. קצת על Totango קיימת כ-5 שנים מונה כ-50 אנשים, אנשי הפיתוח בארץ והמכירות בחו“ל עשרות מליוני אירועים ביום מיליארדי מסמכים מאונדקסים מדי חודש כל התשתיות בענן של Amazon
  7. קצת על האריכטקטורה שבעזרתה המידע הגולמי אודות השימוש שנשלח אלינו למערכת הופך למידע שימוש אודות הלקוחות של הלקוחות שלנו
  8. שירות – לקוח שלנו חשבון – לקוח של הלקוח שלנו אס די אר – המידע שנשלח כאשר משתמש אצל הלקוח של הלקוח שלנו, מבצע פעולה במערכת של הלקוח שלנו
  9. האופן שהמידע זורם למערכת שלנו די סטנדרטי – נכנס מבחוץ לשרת gateway שם הוא עובר עיבוד ראשוני, ואז נארץ בקבצים על גבי S3 אני מניח שזה דפוס שימוש טיפוסי שבו משתמשים רבים על התשתית הזאת, נכון?
  10. מדי יום, וחלקית גם מדי שעה, המידע שהגיע עובר תהליך עיבוד התהליך מאותחל ע“י Jenkins שזו מערכת תזמון נפוצה את התהליך עצמו מנהל luigi שעליו ארחיב בהמשך עיבוד המידע נעשה ע“י Spark, וחלקית ע“י מערכות ישנות שעובדות על כלים אחרים לבסוף המידע מאונדקס ב-Elasticsearch ומשם מוצג בממשק המשתמש של Totango
  11. בקצרה – השלבים שעובר המידע אצלנו במערכת מתחילים במידע גולמי מעיפים חשבונות שאינם פעילים סוכמים את הפעילויות שמשתמשים עשו מחשבים מטריקות שונות על הנתונים מחשבים את מדד הבריאות על כל חשבון מייצרים התראות במקרה של שינויים הדורשים התייחסות ולבסוף כל המידע כאמור נשמר באינדקס
  12. המידע נשמר בפורמט JSON שממופה ישירות למבנים שאנחנו עובדים איתם בקוד נשמר בקבצי טקסט שבהם כל שורה היא אובייקט JSON הקבצים נשמרים במבנה תיקיות הירארכי ב-S3
  13. אז איך בעצם המידע עובר את העיבוד?
  14. ספארק מבוסס על הפשטה של עיבוד המידע פשוט: טוענים את המידע ממקור המידע ומגדירים סדרה של טרנספורמציות על המידע, כלומר סדרה של הוראות – איך להפוך את הקלט לפלט
  15. לדוגמה – זה הקוד שלנו שמעשיר את האובייקט של חשבון עם מדד הבריאות שלו בהתחלה טוענים את הרשומות מתוך הקובץ וממירים את שורות הטקסט לאובייקט ב-java אז קוראים לטרנספורמציה map ומעבירים לה פונקציה הפונקציה הזו, כפי שנראה תיכף, צריכה לדעת לעשות דבר אחד פשוט – לקחת רשומה בקלט ולהחזיר רשומה בפלט אפשר לבצע עוד טרנספורמציות כאלה והכל ייעשה בזכרון, זאת לעומת hadoop למשל שחייב בכל שלב לקרוא ולכתוב לדיסק לבסוף כותבים את מידע הקלט בחזרה לדיסק, או ליעד מידע אחר כלשהו
  16. לדוגמה פונקציה שמעשירה חשבון עם בריאות מקבלת ומחזירה אובייקט של חשבון פונקצייה שמייצרת התראות מקבל חשבון, ומחזירה רשימה של התראות
  17. הפונקציות הללו מועברות כפרמטר לטרנספורציות של ספארק את הפונקציה אפשר וכדאי לבדוק ב-Unit test, אין צורך להרים ספארק כדי לבדוק את הלוגיקה ואפשר לעשות זאת בנפרד לחלוטין (למעשה כך עשינו אצלנו) הפונקציה נשלחת אל המידע ולא המידע אל הפונקציה, לכן הפונקציה צריכה להיות ניתנת לאריזה על הפונקציה להיות אידמפוטנטית – כלומר להחזיר את אותו פלט בהינתן אותו קלט, בלי קשר לכמות ההרצות – בקיצור אסור לה לשנות state חיצוני כלשהו! ניתן להעביר לפונקציה ביצירה מידע כלשהו שהוא לקריאה בלבד
  18. אז יש לנו הרבה לקוחות, הרבה משימות עיבוד, איך מנהלים את כל זה?
  19. למה בכלל צריך מערכת לניהול זרימת העבודה? צריך לנהל הרבה משימות יש תלויות בין המשימות כשלון משימות הוא עניין של זמן, צריך לדעת להמשיך מאותו מקום בו השרשרת נכשלה להפריד בצורה ברורה בין הרצות לתאריכים שונים וללקוחות שונים לצפות בצורה קלה על המצב של המשימות, וגם להכנס לפרטים כדי להבין למה משימה נתקעה או נכשלה להתערב ידנית במקרה של טיפול בתקלה או פעילות יזומה
  20. בחנו כמה אפשרויות, חלקכם בטח שמעתם עליהם כמה כבר שאלו אותי לגבי אלה לא נתעכב עליהם לאחר סקירה של מערכות אלה ועוד, אנחנו בחרנו את Luigi
  21. אז מה זה לואיג&amp;apos;י? כמו קבצי הגדרות לבניית קוד תוכנה, רק שזה בפייטון ובשביל טיפול במידע ולא בניית קוד התלויות מנוהלות ישירות בקוד ולא בקובץ הגדרות כללי וניתן בקלות להרחבה ניתן לראות בצורה ויזואלית את המצב של המשימות והתלויות ביניהן יש גם ממשק בשורת פקודה, כך שזה נותן למפתחים להריץ משימה ישירות לפי הפרמטרים שלה
  22. בשביל להגדיר משימה בלואיג&amp;apos;י, צריך להגדיר לה: מה הקלט מה הפלט במה היא תלוייה ומה הקוד עצמו שמתבצע כשהיא רצה
  23. הנה דוגמא מ-Spotify המשימה תלויה במשימה קודמת שנקראת Streams היא פותחת קובץ, מבצעת עיבוד וכותבת לקובץ המטרה
  24. אפשר להשתמש בקלאסים אחרים שכבר יודעים לעשות דברים נפוצים, ואז רק צריך להגדיר להם את הפרמטרים המתאימים למשל ממשק ל-hadoop, spark, elasticsearch, hive, וכו&amp;apos;
  25. אפשר להעביר פרמטרים למשימה, והם יועברו למשתנה בקוד
  26. אפשר בקלות להריץ את המשימה בשורת הפקודה גם בלי השרת של luigi ולראות איך היא מתנהגת
  27. אפשר לראות בקלות אילו משימות מתבצעות עכשיו, מה הפרמטרים שלהן ומה הססטוס שלהן
  28. אפשר גם לראות גרף תלויות שמראה כל משימה ובמי היא תלויה או מי תלוי בה, ומה הסטטוסס הנוכחי שלהן למשל כאן רואים משימות ירוקות שסיימו, משימה בכחול שכרגע רצה ומשימות צהובות שמחכות לה אם משימה כלשהי הייתה נכשלת, היינו רואים אותה באדום ואפשר היה ללחוץ על העיגול האדום כדי לקבל פרטים על הכשלון
  29. כאן רואים גרף עם הרבה יותר תלויות
  30. אז איך אנחנו משתמשים ב-Luigi אצלנו ב-Totango?
  31. קודם כל, כל הקוד שלנו הוא ב-Java אנחנו משתמשים ב-luigi על מנת לנהל את התהליך והתלויות, אבל ההרצה עצמה בעצם קוראת לקוד שלנו ב-java ומעבירה לו את הפרטמרטים הרלוונטיים
  32. לואיג&amp;apos;י יודע לנהל את המשימות והתלות ביניהן, אך בהתחלה בשביל ליזום את ההרצה אנחנו משתמשים ב-Jenkins
  33. יש לנו כלי פנימי שנקרא Gameboy הוא מאפשר לנו לראות בצורה טובה יותר מידע רלוונטי אלינו אודות התהליכים שלנו שרצים במערכת וגם מאפשר לנו להריץ מחדש תהליכים מסוימים עם פרמטרים מסוימים
  34. כך נראה המסך הראשי ניתן לראות מי רץ כרגע ומה הסטטוס שלו
  35. ניתן לראות גם סטטוס לתאריך מסוים כאן רואים גרפים אודות כמה תהליכים רצים בכל מיני שעות על פני היום או השבוע וגם ניתן לראות ללקוחות שלנו מי כבר סיים עיבוד מידע ליום מסויים
  36. ניתן לבחור לקוח, לבחור תאריך, ולהריץ עליו את תהליך ה-batch החל משלב מסויים אנחנו עושים זאת במקרה של תקלות, או כאשר רוצים לעדכן נקודתית מידע מסוים