SlideShare a Scribd company logo
1 of 32
Download to read offline
CLICKSTREAM ANALYSIS WITH
SPARK – UNDERSTANDING
VISITORS IN REAL-TIME
Dr. Josef Adersberger
QAware GmbH, Germany
THE CHALLENGE
One Kettle to Rule ‘em All
Web Tracking Ad Tracking
ERP CRM
One Kettle to Rule ‘em All
Retention Reach
Monetarization
steer …
 Campaigns
 Offers
 Contents
THE CONCEPTS
by Randy Paulino
The First Sketch
(= real-time)
Tableau
User Journey Analysis
C V VT VT VT C X
C V
V V V V V V V
C V V C V V V
VT VT V V V VT C
V X
Event stream: User journeys:
Web / Ad tracking
KPIs:
 Unique users
 Conversions
 Ad costs / conversion value
 …
V
X
VT
C Click
View
View Time
Conversion
THE ARCHITECTURE
„Larry & Friends“ Architecture
Collector Aggregation
SQL DB
Runs not well for more
than 1 TB data in terms of
ingestion speed, query time
and optimization efforts
by adweek.com
Nope.
Sorry, no Big Data.
„Hadoop & Friends“ Architecture
Collector
Batch Processor
[Hadoop]
Collector Event Data Lake Batch Processor Analytics DB
JSON
Stream
Aggregation
takes too long
Cumbersome
programming model
(can be solved with
pig, cascading et al.)
Not
interactive
enough
Nope.
Too sluggish.
κ-Architecture
Collector Stream Processor
Analytics DB
Persistence
JSON
Stream
Cumbersome
programming model
Over-engineered: We only need
15min real-time ;-)
Stateful aggregations (unique x,
conversions) require a separate DB
with high throughput and fast
aggregations & lookups.
λ-Architecture
Collector
Event Processor
Event Data Lake Batch Processor
Analytics DB
Speed Layer
Batch Layer
JSON
Stream
Cumbersome
programming model
Complex
architecture
Redundant
logic
Feels Over-Engineered…
http://www.brainlazy.com/article/random-nonsense/over-engineered
The Final Architecture*
*) Maybe called μ-architecture one day ;-)
Functional Architecture
Strange Events
IngestionRaw Event
Stream
Collection Events Processing Analytics
Warehouse
Fact
Entries
Atomic Event
Frames
Data Lake
Master Data Integration
 Buffers load peeks
 Ensures message
delivery (fire & forget
for client)
 Create user journeys and
unique user sets
 Enrich dimensions
 Aggregate events to KPIs
 Ability to replay for schema
evolution
 The representation of truth
 Multidimensional data
model
 Interactive queries for
actions in realtime and
data exploration
 Eternal memory for all
events (even strange
ones)
 One schema per event
type. Time partitioned.
class Analytics Model
«fact»
WebFact
«dimension»
Zeit
«dimension»
Kampagne
Jahr
Quartal
Monat
Woche
Tag
Stunde
Minute
Kunde
+ Land: String
Partner
«dimension»
Tracking
Tracking Group
SensorTag
+ Typ: SensorTagType
Platzierung
+ Format: ImageSize
+ Kostenmodell: KostenmodellArt
Werbemittel
+ AdGroup: String
+ Format: ImageSize
+ Größe: KiloBytes
+ LandingPage: URL
+ Motif: URL
Kampagne
«dimension»
Client
Kategorie
Dev ice
+ Bezeichner: String
+ Hersteller: String
+ Typ: String
Browser
+ Typ: String
+ Version: int
«dimension»
Ausspielort
LandRegion
Stadt
«dimension»
Kanal
Kanal
«dimension»
Vermarktung
«enumeration»
SensorTagType
ORDER_TAG
MASTER_TAG
CUSTOM_TAG
Betriebssystem
+ Typ: String
+ Version: Version
⦁ Dimension: Unabhängiges Prädikat auf Metriken bei der Analyse ("kann isoliert darüber nachdenken / isoliert dazu Analysen
fahren")
⦁ Hierarchie: Sub-Prädikat auf Metriken. Erzeugt mehr als eine (zueinander diskunkte) Teilmengen der Metriken. Entspricht den gängigen
Drill-Down-Pfaden in den Reports bzw. den Batch-Aggregate-Up-Pfaden in der Aggregationslogik. Semantische Unterstrukturen: "ist Teil
von & kann nicht existieren ohne".
⦁ Asssoziation: Nicht verwendet. Separates Stammdatenmodell.
⦁ Attribut: Ermöglicht eine weitere (querschneidende) Einschränkung der Metrikmenge ergänzend zu den Hierarchien.
Domain
Website
Tracking Site
Vermarkter
Auslieferungs-
Domain
Referral
«enumerati...
KostenmodellArt
CPC
CPM
CPO
CPA
«abstract»
DimensionValue
+ id: int
+ name: String
+ sourceId: String
WebsiteFact
+ Bounces: int
+ Verweildauer: float
+ Visits: int
BasicAdFact
+ Clicks: int
+ Sichtbare Views: int
+ Validierte Clicks: int
+ View (angefragt): int
+ View (ausgeliefert): int
+ View (gemessen): int
«dimension»
Produkt
Shop
Produkt
+ Produktkategorie: String
«dimension»
Zeitfenster
Letzte X Tage
«dimension»
User
User Segment
«dimension»
Order
OrderStatus
+ Status: OrderStatus
«enumeration»
OrderStatus
IN_BEARBEITUNG
ERFOLGREICH (AKTIVIERT)
ABGELEHNT
NICHT_IN_BEARBEITUNG
UniquesFact
+ Unique Clicks: int
+ Unique Users: int
+ Unique Views: int
AdCostFact
+ CPC: int
+ Kosten: float
Conv ersionFact
+ PC: int
+ PR: int
+ PV: int
+ Umsatz PC: float
+ Umsatz PR: float
+ Umsatz PV: float
AdVisibilityFact
+ Sichtbarkeitsdauer: float
Activ atedOrderFact
+ Orders: int
+ Umsatz: float
TrackingFact
+ Orders: int
+ Page Impressions: int
+ Umsatz: float
X = {7, 14, 28, 30}
 Fault tolerant message handling
 Event handling: Apply schema, time-partitioning, De-dup, sanity
checks, pre-aggregation, filtering, fraud detection
 Tolerates delayed events
 High throughput, moderate latency (~ 1min)
Series Connection of Streaming
and Batching - all based on Spark.
IngestionRaw Event
Stream
Collection Event Data Lake Processing Analytics
Warehouse
Fact
Entries
SQL Interface
Atomic Event
Frames
 Cool programming model
 Uniform dev&ops
 Simple solution
 High compression ratio due to
column-oriented storage
 High scan speed
 Cool programming model
 Uniform dev&ops
 High performance
 Interface to R out-of-the-box
 Useful libs: MLlib, GraphX, NLP, …
 Good connectivity (JDBC,
ODBC, …)
 Interactive queries
 Uniform ops
 Can easily be replaced
due to Hive Metastore
 Obvious choice for
cloud-scale messaging
 Way the best throughput
and scalability of all
evaluated alternatives
LESSONS LEARNED
by: http://hochmeister-alpin.at
Technology Mapping
https://github.com/qaware/big-data-landscape
User Interface
Data Lake
Data Warehouse
Ingestion
Processing
Data Science Interactive Analysis Reporting & Dashboards
Data Sources
Analytics
Micro Analytics Services instead of reporting
servers.
Charting Libraries:Dashboards:
Analytics Frontends
Algorithm Libraries
Structured Data Lake: The eternal memory.
Efficient data serialization formats:
 Integated compression
 Column-oriented storage
 Predicate pushdown
Distributed Filesystem or NoSQL DB
Data Workflows ETL Jobs Massive
Parallelization
Pig Open Studio
Data Logicstics Stream
Processing
NewSQL: SQL meets NoSQL.
Polyglott Persistence
Index Machines: Fast aggregation and search.
In-Memory Databases: Fast access.
Time Series Databases
Atlas
Polyglott Analytics
Data Lake
Analytics
Warehouse
SQL
lane
R
lane
Timeseries
lane
Reporting Data Exploration
Data Science
Micro Analytics Services
Microservice
Dashboard
Microservice …
No Retention Paranoia
Data Lake
Analytics
Warehouse
 Eternal memory
 Close to raw events
 Allows replays and refills
into warehouse
Aggressive forgetting with clearly defined
retention policy per aggregation level like:
 15min:30d
 1h:4m
 …
Events
Strange Events
Continuous Tuning
IngestionRaw Event
Stream
Collection Event Data Lake Processing Analytics
Warehouse
Fact
Entries
SQL Interface
Atomic Event
Frames
Load
Generator Throughput & latency probes
In Numbers
Overall dev effort until the first release: 250 person days
Dimensions: 10 KPIs: 26
Integrated 3rd party systems: 7
Inbound data volume per day: 80GB
New data in DWH per day: 2GB
Total price of cheapest cluster which is able to handle production load:
THANK YOU.
@adersberger
josef.adersberger@qaware.de
Bonus Topic: Roadmap
SparkKafka HDFS
IaaS
Simplify Ops with Mesos
Faster aggregation & easier updates
with Spark-on-Solr
http://qaware.blogspot.de/2015/06/solr-with-sparks-or-how-to-submit-spark.html
Bonus Topic: Smart Aggregation
Ingestion Event Data Lake Processing Analytics
Warehouse
Fact
Entries
Analytics
Atomic Event
Frames
1 2
3
Architecture follows requirements
class Analytics Model
«fact»
WebFact
«dimension»
Zeit
«dimension»
Kampagne
Jahr
Quartal
Monat
Woche
Tag
Stunde
Minute
Kunde
+ Land: String
Partner
«dimension»
Tracking
Tracking Group
SensorTag
+ Typ: SensorTagType
Platzierung
+ Format: ImageSize
+ Kostenmodell: KostenmodellArt
Werbemittel
+ AdGroup: String
+ Format: ImageSize
+ Größe: KiloBytes
+ LandingPage: URL
+ Motif: URL
Kampagne
«dimension»
Client
Kategorie
Device
+ Bezeichner: String
+ Hersteller: String
+ Typ: String
Browser
+ Typ: String
+ Version: int
«dimension»
Ausspielort
LandRegion
Stadt
«dimension»
Kanal
Kanal
«dimension»
Vermarktung
«enumeration»
SensorTagType
ORDER_TAG
MASTER_TAG
CUSTOM_TAG
Betriebssystem
+ Typ: String
+ Version: Version
⦁ Dimension: Unabhängiges Prädikat auf Metriken bei der Analyse ("kann isoliert darüber nachdenken / isoliert dazu Analysen
fahren")
⦁ Hierarchie: Sub-Prädikat auf Metriken. Erzeugt mehr als eine (zueinander diskunkte) Teilmengen der Metriken. Entspricht den gängigen
Drill-Down-Pfaden in den Reports bzw. den Batch-Aggregate-Up-Pfaden in der Aggregationslogik. Semantische Unterstrukturen: "ist Teil
von & kann nicht existieren ohne".
⦁ Asssoziation: Nicht verwendet. Separates Stammdatenmodell.
⦁ Attribut: Ermöglicht eine weitere (querschneidende) Einschränkung der Metrikmenge ergänzend zu den Hierarchien.
Domain
Website
Tracking Site
Vermarkter
Auslieferungs-
Domain
Referral
«enumerati...
KostenmodellArt
CPC
CPM
CPO
CPA
«abstract»
DimensionValue
+ id: int
+ name: String
+ sourceId: String
WebsiteFact
+ Bounces: int
+ Verweildauer: float
+ Visits: int
BasicAdFact
+ Clicks: int
+ Sichtbare Views: int
+ Validierte Clicks: int
+ View (angefragt): int
+ View (ausgeliefert): int
+ View (gemessen): int
«dimension»
Produkt
Shop
Produkt
+ Produktkategorie: String
«dimension»
Zeitfenster
Letzte X Tage
«dimension»
User
User Segment
«dimension»
Order
OrderStatus
+ Status: OrderStatus
«enumeration»
OrderStatus
IN_BEARBEITUNG
ERFOLGREICH (AKTIVIERT)
ABGELEHNT
NICHT_IN_BEARBEITUNG
UniquesFact
+ Unique Clicks: int
+ Unique Users: int
+ Unique Views: int
AdCostFact
+ CPC: int
+ Kosten: float
ConversionFact
+ PC: int
+ PR: int
+ PV: int
+ Umsatz PC: float
+ Umsatz PR: float
+ Umsatz PV: float
AdVisibilityFact
+ Sichtbarkeitsdauer: float
ActivatedOrderFact
+ Orders: int
+ Umsatz: float
TrackingFact
+ Orders: int
+ Page Impressions: int
+ Umsatz: float
X = {7, 14, 28, 30}
act Processing
Processing
WebsiteOrderActivationAdCostConversionUniques+
Overlap
AdVisibilityBasicAdsTracking
Dimensionsv erzeichnis
aktualisieren
Page
Impressions
und Orders
zählen
Aggregation
TrackingFact
Ad
Impressions
zählen
Aggregation
BasicAdFact
CTR und
Sichtbarkeitsrate
berechnen
Inferenz der
Sichtbarkeitsdauer
Aggregation
AdVisibilityFact
Dimensionsraum
aufspannen
Pro Vektor die Ev ents und
die dort enthaltenen UserIds
und Interaktionsarten
ermitteln
Menge der UserIds pro
Interaktionsart erzeugen und deren
Mächtigkeit bestimmen
UniquesFact
User Journeys
erstellen (bzw.
LV/LC pro User)
Attribution v on Conv ersion
auf Basis v orkonfiguriertem
Conv ersion Modell
Conv ersions
zählen (PV, PC, PR)
Warenkorbwert ermitteln
bei Order-Conv ersion
(PV, PC, PR)
Aggregation
Conv ersionFact
Kosten pro
Ev ent
ermitteln Aggregation
Nicht zuweisbare
Kosten ermitteln
CostFact
Inferenz der Visits
Visits zählen
Bounces zählen
Analyse der Verweildauer
Aggregation
WebsiteFact
Order Status
ermitteln
Anzahl der nicht getrackten Orders ermitteln
Aggregation
Activ atedOrderFact
:Analytics Warehouse:Event Data Lake
«flow»
«flow»
«flow»
«flow»
«flow»
«flow»
«flow»
«flow»
«flow»
«flow»
«flow»
«flow»
«flow»
«flow»
«flow»
«flow»
«flow»
«flow»
«flow»
«flow»
«flow»
Data Processing WorkflowMultidimensional Data Model
Sample results
Geolocated and gender-
specific conversions.
Frequency of visits
Performance of an ad campaign

More Related Content

Viewers also liked

Secure Architecture and Programming 101
Secure Architecture and Programming 101Secure Architecture and Programming 101
Secure Architecture and Programming 101
QAware GmbH
 

Viewers also liked (20)

Clickstream Analysis with Apache Spark
Clickstream Analysis with Apache SparkClickstream Analysis with Apache Spark
Clickstream Analysis with Apache Spark
 
Managing Online Relationships
Managing Online RelationshipsManaging Online Relationships
Managing Online Relationships
 
Kubernetes 101 and Fun
Kubernetes 101 and FunKubernetes 101 and Fun
Kubernetes 101 and Fun
 
Hands-on K8s: Deployments, Pods and Fun
Hands-on K8s: Deployments, Pods and FunHands-on K8s: Deployments, Pods and Fun
Hands-on K8s: Deployments, Pods and Fun
 
Lightweight developer provisioning with gradle and seu as-code
Lightweight developer provisioning with gradle and seu as-codeLightweight developer provisioning with gradle and seu as-code
Lightweight developer provisioning with gradle and seu as-code
 
Microservices @ Work - A Practice Report of Developing Microservices
Microservices @ Work - A Practice Report of Developing MicroservicesMicroservices @ Work - A Practice Report of Developing Microservices
Microservices @ Work - A Practice Report of Developing Microservices
 
JEE on DC/OS - MesosCon Europe
JEE on DC/OS - MesosCon EuropeJEE on DC/OS - MesosCon Europe
JEE on DC/OS - MesosCon Europe
 
Cloud Native Unleashed
Cloud Native UnleashedCloud Native Unleashed
Cloud Native Unleashed
 
Everything as-code. Polyglotte Entwicklung in der Praxis. #oop2017
Everything as-code. Polyglotte Entwicklung in der Praxis. #oop2017Everything as-code. Polyglotte Entwicklung in der Praxis. #oop2017
Everything as-code. Polyglotte Entwicklung in der Praxis. #oop2017
 
Automotive Information Research driven by Apache Solr
Automotive Information Research driven by Apache SolrAutomotive Information Research driven by Apache Solr
Automotive Information Research driven by Apache Solr
 
Leveraging the Power of Solr with Spark
Leveraging the Power of Solr with SparkLeveraging the Power of Solr with Spark
Leveraging the Power of Solr with Spark
 
Secure Architecture and Programming 101
Secure Architecture and Programming 101Secure Architecture and Programming 101
Secure Architecture and Programming 101
 
Die Leichtigkeit des Seins: Bindings für Eclipse SmartHome entwickeln
Die Leichtigkeit des Seins: Bindings für Eclipse SmartHome entwickelnDie Leichtigkeit des Seins: Bindings für Eclipse SmartHome entwickeln
Die Leichtigkeit des Seins: Bindings für Eclipse SmartHome entwickeln
 
Der Cloud Native Stack in a Nutshell
Der Cloud Native Stack in a NutshellDer Cloud Native Stack in a Nutshell
Der Cloud Native Stack in a Nutshell
 
Big Data Analytics on AWS
Big Data Analytics on AWSBig Data Analytics on AWS
Big Data Analytics on AWS
 
Per Anhalter durch den Cloud Native Stack (extended edition)
Per Anhalter durch den Cloud Native Stack (extended edition)Per Anhalter durch den Cloud Native Stack (extended edition)
Per Anhalter durch den Cloud Native Stack (extended edition)
 
Real World Analytics with Solr Cloud and Spark
Real World Analytics with Solr Cloud and SparkReal World Analytics with Solr Cloud and Spark
Real World Analytics with Solr Cloud and Spark
 
From pets to cattle - powered by CoreOS, docker, Mesos & nginx
From pets to cattle - powered by CoreOS, docker, Mesos & nginxFrom pets to cattle - powered by CoreOS, docker, Mesos & nginx
From pets to cattle - powered by CoreOS, docker, Mesos & nginx
 
Automotive Information Research driven by Apache Solr
Automotive Information Research driven by Apache SolrAutomotive Information Research driven by Apache Solr
Automotive Information Research driven by Apache Solr
 
Vamp - The anti-fragilitiy platform for digital services
Vamp - The anti-fragilitiy platform for digital servicesVamp - The anti-fragilitiy platform for digital services
Vamp - The anti-fragilitiy platform for digital services
 

Similar to Clickstream Analysis with Spark - Understanding Visitors in Real Time

Analytic powerhouse parallel data warehouse und r
Analytic powerhouse parallel data warehouse und rAnalytic powerhouse parallel data warehouse und r
Analytic powerhouse parallel data warehouse und r
Marcel Franke
 
Data Is The New Oil
Data Is The New OilData Is The New Oil
Data Is The New Oil
ParStream
 
Skalierung & Performance
Skalierung & PerformanceSkalierung & Performance
Skalierung & Performance
glembotzky
 

Similar to Clickstream Analysis with Spark - Understanding Visitors in Real Time (20)

Big Data Webinar (Deutsch)
Big Data Webinar (Deutsch)Big Data Webinar (Deutsch)
Big Data Webinar (Deutsch)
 
Dataservices - Data Processing mit Microservices
Dataservices - Data Processing mit MicroservicesDataservices - Data Processing mit Microservices
Dataservices - Data Processing mit Microservices
 
worldiety GmbH - Datenanalyse
worldiety GmbH - Datenanalyse worldiety GmbH - Datenanalyse
worldiety GmbH - Datenanalyse
 
JavaFX Real-World Apps
JavaFX Real-World AppsJavaFX Real-World Apps
JavaFX Real-World Apps
 
Analytic powerhouse parallel data warehouse und r
Analytic powerhouse parallel data warehouse und rAnalytic powerhouse parallel data warehouse und r
Analytic powerhouse parallel data warehouse und r
 
Amazon Redshift
Amazon RedshiftAmazon Redshift
Amazon Redshift
 
Folien2 spss watson roadshow_predictive
Folien2 spss watson roadshow_predictiveFolien2 spss watson roadshow_predictive
Folien2 spss watson roadshow_predictive
 
EventDB - Hamburg 2013
EventDB - Hamburg 2013EventDB - Hamburg 2013
EventDB - Hamburg 2013
 
Innovationen aus der Cloud ganz einfach nutzen
Innovationen aus der Cloud ganz einfach nutzenInnovationen aus der Cloud ganz einfach nutzen
Innovationen aus der Cloud ganz einfach nutzen
 
Cloud Wars – what‘s the smartest data platform? Vergleich Microsoft Azure, Am...
Cloud Wars – what‘s the smartest data platform? Vergleich Microsoft Azure, Am...Cloud Wars – what‘s the smartest data platform? Vergleich Microsoft Azure, Am...
Cloud Wars – what‘s the smartest data platform? Vergleich Microsoft Azure, Am...
 
Data Vault DWH Automation
Data Vault DWH AutomationData Vault DWH Automation
Data Vault DWH Automation
 
Webcast: SAP on Azure für den Mittelstand - Erfolgsfaktor Integration
Webcast: SAP on Azure für den Mittelstand - Erfolgsfaktor IntegrationWebcast: SAP on Azure für den Mittelstand - Erfolgsfaktor Integration
Webcast: SAP on Azure für den Mittelstand - Erfolgsfaktor Integration
 
Warum sap hana sql data warehousing
Warum sap hana sql data warehousingWarum sap hana sql data warehousing
Warum sap hana sql data warehousing
 
Eine Referenzarchitektur für das Digitale Produkt
Eine Referenzarchitektur für das Digitale ProduktEine Referenzarchitektur für das Digitale Produkt
Eine Referenzarchitektur für das Digitale Produkt
 
Mit Prozessautomatisierung und Co-Creation zur Digitalisierung der Öffentlich...
Mit Prozessautomatisierung und Co-Creation zur Digitalisierung der Öffentlich...Mit Prozessautomatisierung und Co-Creation zur Digitalisierung der Öffentlich...
Mit Prozessautomatisierung und Co-Creation zur Digitalisierung der Öffentlich...
 
Technisches SEO 2019 Berlin SEO Campixx
Technisches SEO 2019 Berlin SEO CampixxTechnisches SEO 2019 Berlin SEO Campixx
Technisches SEO 2019 Berlin SEO Campixx
 
Amazon Web Services
Amazon Web ServicesAmazon Web Services
Amazon Web Services
 
Webinar Neues von der re:invent 2013 Teil 2: Kinesis, AppStream, WorkSpaces
Webinar Neues von der re:invent 2013 Teil 2: Kinesis, AppStream, WorkSpacesWebinar Neues von der re:invent 2013 Teil 2: Kinesis, AppStream, WorkSpaces
Webinar Neues von der re:invent 2013 Teil 2: Kinesis, AppStream, WorkSpaces
 
Data Is The New Oil
Data Is The New OilData Is The New Oil
Data Is The New Oil
 
Skalierung & Performance
Skalierung & PerformanceSkalierung & Performance
Skalierung & Performance
 

More from QAware GmbH

"Mixed" Scrum-Teams – Die richtige Mischung macht's!
"Mixed" Scrum-Teams – Die richtige Mischung macht's!"Mixed" Scrum-Teams – Die richtige Mischung macht's!
"Mixed" Scrum-Teams – Die richtige Mischung macht's!
QAware GmbH
 
Migration von stark regulierten Anwendungen in die Cloud: Dem Teufel die See...
 Migration von stark regulierten Anwendungen in die Cloud: Dem Teufel die See... Migration von stark regulierten Anwendungen in die Cloud: Dem Teufel die See...
Migration von stark regulierten Anwendungen in die Cloud: Dem Teufel die See...
QAware GmbH
 

More from QAware GmbH (20)

50 Shades of K8s Autoscaling #JavaLand24.pdf
50 Shades of K8s Autoscaling #JavaLand24.pdf50 Shades of K8s Autoscaling #JavaLand24.pdf
50 Shades of K8s Autoscaling #JavaLand24.pdf
 
Make Agile Great - PM-Erfahrungen aus zwei virtuellen internationalen SAFe-Pr...
Make Agile Great - PM-Erfahrungen aus zwei virtuellen internationalen SAFe-Pr...Make Agile Great - PM-Erfahrungen aus zwei virtuellen internationalen SAFe-Pr...
Make Agile Great - PM-Erfahrungen aus zwei virtuellen internationalen SAFe-Pr...
 
Fully-managed Cloud-native Databases: The path to indefinite scale @ CNN Mainz
Fully-managed Cloud-native Databases: The path to indefinite scale @ CNN MainzFully-managed Cloud-native Databases: The path to indefinite scale @ CNN Mainz
Fully-managed Cloud-native Databases: The path to indefinite scale @ CNN Mainz
 
Down the Ivory Tower towards Agile Architecture
Down the Ivory Tower towards Agile ArchitectureDown the Ivory Tower towards Agile Architecture
Down the Ivory Tower towards Agile Architecture
 
"Mixed" Scrum-Teams – Die richtige Mischung macht's!
"Mixed" Scrum-Teams – Die richtige Mischung macht's!"Mixed" Scrum-Teams – Die richtige Mischung macht's!
"Mixed" Scrum-Teams – Die richtige Mischung macht's!
 
Make Developers Fly: Principles for Platform Engineering
Make Developers Fly: Principles for Platform EngineeringMake Developers Fly: Principles for Platform Engineering
Make Developers Fly: Principles for Platform Engineering
 
Der Tod der Testpyramide? – Frontend-Testing mit Playwright
Der Tod der Testpyramide? – Frontend-Testing mit PlaywrightDer Tod der Testpyramide? – Frontend-Testing mit Playwright
Der Tod der Testpyramide? – Frontend-Testing mit Playwright
 
Was kommt nach den SPAs
Was kommt nach den SPAsWas kommt nach den SPAs
Was kommt nach den SPAs
 
Cloud Migration mit KI: der Turbo
Cloud Migration mit KI: der Turbo Cloud Migration mit KI: der Turbo
Cloud Migration mit KI: der Turbo
 
Migration von stark regulierten Anwendungen in die Cloud: Dem Teufel die See...
 Migration von stark regulierten Anwendungen in die Cloud: Dem Teufel die See... Migration von stark regulierten Anwendungen in die Cloud: Dem Teufel die See...
Migration von stark regulierten Anwendungen in die Cloud: Dem Teufel die See...
 
Aus blau wird grün! Ansätze und Technologien für nachhaltige Kubernetes-Cluster
Aus blau wird grün! Ansätze und Technologien für nachhaltige Kubernetes-Cluster Aus blau wird grün! Ansätze und Technologien für nachhaltige Kubernetes-Cluster
Aus blau wird grün! Ansätze und Technologien für nachhaltige Kubernetes-Cluster
 
Endlich gute API Tests. Boldly Testing APIs Where No One Has Tested Before.
Endlich gute API Tests. Boldly Testing APIs Where No One Has Tested Before.Endlich gute API Tests. Boldly Testing APIs Where No One Has Tested Before.
Endlich gute API Tests. Boldly Testing APIs Where No One Has Tested Before.
 
Kubernetes with Cilium in AWS - Experience Report!
Kubernetes with Cilium in AWS - Experience Report!Kubernetes with Cilium in AWS - Experience Report!
Kubernetes with Cilium in AWS - Experience Report!
 
50 Shades of K8s Autoscaling
50 Shades of K8s Autoscaling50 Shades of K8s Autoscaling
50 Shades of K8s Autoscaling
 
Kontinuierliche Sicherheitstests für APIs mit Testkube und OWASP ZAP
Kontinuierliche Sicherheitstests für APIs mit Testkube und OWASP ZAPKontinuierliche Sicherheitstests für APIs mit Testkube und OWASP ZAP
Kontinuierliche Sicherheitstests für APIs mit Testkube und OWASP ZAP
 
Service Mesh Pain & Gain. Experiences from a client project.
Service Mesh Pain & Gain. Experiences from a client project.Service Mesh Pain & Gain. Experiences from a client project.
Service Mesh Pain & Gain. Experiences from a client project.
 
50 Shades of K8s Autoscaling
50 Shades of K8s Autoscaling50 Shades of K8s Autoscaling
50 Shades of K8s Autoscaling
 
Blue turns green! Approaches and technologies for sustainable K8s clusters.
Blue turns green! Approaches and technologies for sustainable K8s clusters.Blue turns green! Approaches and technologies for sustainable K8s clusters.
Blue turns green! Approaches and technologies for sustainable K8s clusters.
 
Per Anhalter zu Cloud Nativen API Gateways
Per Anhalter zu Cloud Nativen API GatewaysPer Anhalter zu Cloud Nativen API Gateways
Per Anhalter zu Cloud Nativen API Gateways
 
Aus blau wird grün! Ansätze und Technologien für nachhaltige Kubernetes-Cluster
Aus blau wird grün! Ansätze und Technologien für nachhaltige Kubernetes-Cluster Aus blau wird grün! Ansätze und Technologien für nachhaltige Kubernetes-Cluster
Aus blau wird grün! Ansätze und Technologien für nachhaltige Kubernetes-Cluster
 

Clickstream Analysis with Spark - Understanding Visitors in Real Time

  • 1. CLICKSTREAM ANALYSIS WITH SPARK – UNDERSTANDING VISITORS IN REAL-TIME Dr. Josef Adersberger QAware GmbH, Germany
  • 3. One Kettle to Rule ‘em All Web Tracking Ad Tracking ERP CRM
  • 4. One Kettle to Rule ‘em All Retention Reach Monetarization steer …  Campaigns  Offers  Contents
  • 5.
  • 7. The First Sketch (= real-time) Tableau
  • 8. User Journey Analysis C V VT VT VT C X C V V V V V V V V C V V C V V V VT VT V V V VT C V X Event stream: User journeys: Web / Ad tracking KPIs:  Unique users  Conversions  Ad costs / conversion value  … V X VT C Click View View Time Conversion
  • 10. „Larry & Friends“ Architecture Collector Aggregation SQL DB Runs not well for more than 1 TB data in terms of ingestion speed, query time and optimization efforts
  • 12. „Hadoop & Friends“ Architecture Collector Batch Processor [Hadoop] Collector Event Data Lake Batch Processor Analytics DB JSON Stream Aggregation takes too long Cumbersome programming model (can be solved with pig, cascading et al.) Not interactive enough
  • 14. κ-Architecture Collector Stream Processor Analytics DB Persistence JSON Stream Cumbersome programming model Over-engineered: We only need 15min real-time ;-) Stateful aggregations (unique x, conversions) require a separate DB with high throughput and fast aggregations & lookups.
  • 15. λ-Architecture Collector Event Processor Event Data Lake Batch Processor Analytics DB Speed Layer Batch Layer JSON Stream Cumbersome programming model Complex architecture Redundant logic
  • 17. The Final Architecture* *) Maybe called μ-architecture one day ;-)
  • 18. Functional Architecture Strange Events IngestionRaw Event Stream Collection Events Processing Analytics Warehouse Fact Entries Atomic Event Frames Data Lake Master Data Integration  Buffers load peeks  Ensures message delivery (fire & forget for client)  Create user journeys and unique user sets  Enrich dimensions  Aggregate events to KPIs  Ability to replay for schema evolution  The representation of truth  Multidimensional data model  Interactive queries for actions in realtime and data exploration  Eternal memory for all events (even strange ones)  One schema per event type. Time partitioned. class Analytics Model «fact» WebFact «dimension» Zeit «dimension» Kampagne Jahr Quartal Monat Woche Tag Stunde Minute Kunde + Land: String Partner «dimension» Tracking Tracking Group SensorTag + Typ: SensorTagType Platzierung + Format: ImageSize + Kostenmodell: KostenmodellArt Werbemittel + AdGroup: String + Format: ImageSize + Größe: KiloBytes + LandingPage: URL + Motif: URL Kampagne «dimension» Client Kategorie Dev ice + Bezeichner: String + Hersteller: String + Typ: String Browser + Typ: String + Version: int «dimension» Ausspielort LandRegion Stadt «dimension» Kanal Kanal «dimension» Vermarktung «enumeration» SensorTagType ORDER_TAG MASTER_TAG CUSTOM_TAG Betriebssystem + Typ: String + Version: Version ⦁ Dimension: Unabhängiges Prädikat auf Metriken bei der Analyse ("kann isoliert darüber nachdenken / isoliert dazu Analysen fahren") ⦁ Hierarchie: Sub-Prädikat auf Metriken. Erzeugt mehr als eine (zueinander diskunkte) Teilmengen der Metriken. Entspricht den gängigen Drill-Down-Pfaden in den Reports bzw. den Batch-Aggregate-Up-Pfaden in der Aggregationslogik. Semantische Unterstrukturen: "ist Teil von & kann nicht existieren ohne". ⦁ Asssoziation: Nicht verwendet. Separates Stammdatenmodell. ⦁ Attribut: Ermöglicht eine weitere (querschneidende) Einschränkung der Metrikmenge ergänzend zu den Hierarchien. Domain Website Tracking Site Vermarkter Auslieferungs- Domain Referral «enumerati... KostenmodellArt CPC CPM CPO CPA «abstract» DimensionValue + id: int + name: String + sourceId: String WebsiteFact + Bounces: int + Verweildauer: float + Visits: int BasicAdFact + Clicks: int + Sichtbare Views: int + Validierte Clicks: int + View (angefragt): int + View (ausgeliefert): int + View (gemessen): int «dimension» Produkt Shop Produkt + Produktkategorie: String «dimension» Zeitfenster Letzte X Tage «dimension» User User Segment «dimension» Order OrderStatus + Status: OrderStatus «enumeration» OrderStatus IN_BEARBEITUNG ERFOLGREICH (AKTIVIERT) ABGELEHNT NICHT_IN_BEARBEITUNG UniquesFact + Unique Clicks: int + Unique Users: int + Unique Views: int AdCostFact + CPC: int + Kosten: float Conv ersionFact + PC: int + PR: int + PV: int + Umsatz PC: float + Umsatz PR: float + Umsatz PV: float AdVisibilityFact + Sichtbarkeitsdauer: float Activ atedOrderFact + Orders: int + Umsatz: float TrackingFact + Orders: int + Page Impressions: int + Umsatz: float X = {7, 14, 28, 30}  Fault tolerant message handling  Event handling: Apply schema, time-partitioning, De-dup, sanity checks, pre-aggregation, filtering, fraud detection  Tolerates delayed events  High throughput, moderate latency (~ 1min)
  • 19. Series Connection of Streaming and Batching - all based on Spark. IngestionRaw Event Stream Collection Event Data Lake Processing Analytics Warehouse Fact Entries SQL Interface Atomic Event Frames  Cool programming model  Uniform dev&ops  Simple solution  High compression ratio due to column-oriented storage  High scan speed  Cool programming model  Uniform dev&ops  High performance  Interface to R out-of-the-box  Useful libs: MLlib, GraphX, NLP, …  Good connectivity (JDBC, ODBC, …)  Interactive queries  Uniform ops  Can easily be replaced due to Hive Metastore  Obvious choice for cloud-scale messaging  Way the best throughput and scalability of all evaluated alternatives
  • 21. Technology Mapping https://github.com/qaware/big-data-landscape User Interface Data Lake Data Warehouse Ingestion Processing Data Science Interactive Analysis Reporting & Dashboards Data Sources Analytics Micro Analytics Services instead of reporting servers. Charting Libraries:Dashboards: Analytics Frontends Algorithm Libraries Structured Data Lake: The eternal memory. Efficient data serialization formats:  Integated compression  Column-oriented storage  Predicate pushdown Distributed Filesystem or NoSQL DB Data Workflows ETL Jobs Massive Parallelization Pig Open Studio Data Logicstics Stream Processing NewSQL: SQL meets NoSQL. Polyglott Persistence Index Machines: Fast aggregation and search. In-Memory Databases: Fast access. Time Series Databases Atlas
  • 24. No Retention Paranoia Data Lake Analytics Warehouse  Eternal memory  Close to raw events  Allows replays and refills into warehouse Aggressive forgetting with clearly defined retention policy per aggregation level like:  15min:30d  1h:4m  … Events Strange Events
  • 25. Continuous Tuning IngestionRaw Event Stream Collection Event Data Lake Processing Analytics Warehouse Fact Entries SQL Interface Atomic Event Frames Load Generator Throughput & latency probes
  • 26. In Numbers Overall dev effort until the first release: 250 person days Dimensions: 10 KPIs: 26 Integrated 3rd party systems: 7 Inbound data volume per day: 80GB New data in DWH per day: 2GB Total price of cheapest cluster which is able to handle production load:
  • 27.
  • 29. Bonus Topic: Roadmap SparkKafka HDFS IaaS Simplify Ops with Mesos Faster aggregation & easier updates with Spark-on-Solr http://qaware.blogspot.de/2015/06/solr-with-sparks-or-how-to-submit-spark.html
  • 30. Bonus Topic: Smart Aggregation Ingestion Event Data Lake Processing Analytics Warehouse Fact Entries Analytics Atomic Event Frames 1 2 3
  • 31. Architecture follows requirements class Analytics Model «fact» WebFact «dimension» Zeit «dimension» Kampagne Jahr Quartal Monat Woche Tag Stunde Minute Kunde + Land: String Partner «dimension» Tracking Tracking Group SensorTag + Typ: SensorTagType Platzierung + Format: ImageSize + Kostenmodell: KostenmodellArt Werbemittel + AdGroup: String + Format: ImageSize + Größe: KiloBytes + LandingPage: URL + Motif: URL Kampagne «dimension» Client Kategorie Device + Bezeichner: String + Hersteller: String + Typ: String Browser + Typ: String + Version: int «dimension» Ausspielort LandRegion Stadt «dimension» Kanal Kanal «dimension» Vermarktung «enumeration» SensorTagType ORDER_TAG MASTER_TAG CUSTOM_TAG Betriebssystem + Typ: String + Version: Version ⦁ Dimension: Unabhängiges Prädikat auf Metriken bei der Analyse ("kann isoliert darüber nachdenken / isoliert dazu Analysen fahren") ⦁ Hierarchie: Sub-Prädikat auf Metriken. Erzeugt mehr als eine (zueinander diskunkte) Teilmengen der Metriken. Entspricht den gängigen Drill-Down-Pfaden in den Reports bzw. den Batch-Aggregate-Up-Pfaden in der Aggregationslogik. Semantische Unterstrukturen: "ist Teil von & kann nicht existieren ohne". ⦁ Asssoziation: Nicht verwendet. Separates Stammdatenmodell. ⦁ Attribut: Ermöglicht eine weitere (querschneidende) Einschränkung der Metrikmenge ergänzend zu den Hierarchien. Domain Website Tracking Site Vermarkter Auslieferungs- Domain Referral «enumerati... KostenmodellArt CPC CPM CPO CPA «abstract» DimensionValue + id: int + name: String + sourceId: String WebsiteFact + Bounces: int + Verweildauer: float + Visits: int BasicAdFact + Clicks: int + Sichtbare Views: int + Validierte Clicks: int + View (angefragt): int + View (ausgeliefert): int + View (gemessen): int «dimension» Produkt Shop Produkt + Produktkategorie: String «dimension» Zeitfenster Letzte X Tage «dimension» User User Segment «dimension» Order OrderStatus + Status: OrderStatus «enumeration» OrderStatus IN_BEARBEITUNG ERFOLGREICH (AKTIVIERT) ABGELEHNT NICHT_IN_BEARBEITUNG UniquesFact + Unique Clicks: int + Unique Users: int + Unique Views: int AdCostFact + CPC: int + Kosten: float ConversionFact + PC: int + PR: int + PV: int + Umsatz PC: float + Umsatz PR: float + Umsatz PV: float AdVisibilityFact + Sichtbarkeitsdauer: float ActivatedOrderFact + Orders: int + Umsatz: float TrackingFact + Orders: int + Page Impressions: int + Umsatz: float X = {7, 14, 28, 30} act Processing Processing WebsiteOrderActivationAdCostConversionUniques+ Overlap AdVisibilityBasicAdsTracking Dimensionsv erzeichnis aktualisieren Page Impressions und Orders zählen Aggregation TrackingFact Ad Impressions zählen Aggregation BasicAdFact CTR und Sichtbarkeitsrate berechnen Inferenz der Sichtbarkeitsdauer Aggregation AdVisibilityFact Dimensionsraum aufspannen Pro Vektor die Ev ents und die dort enthaltenen UserIds und Interaktionsarten ermitteln Menge der UserIds pro Interaktionsart erzeugen und deren Mächtigkeit bestimmen UniquesFact User Journeys erstellen (bzw. LV/LC pro User) Attribution v on Conv ersion auf Basis v orkonfiguriertem Conv ersion Modell Conv ersions zählen (PV, PC, PR) Warenkorbwert ermitteln bei Order-Conv ersion (PV, PC, PR) Aggregation Conv ersionFact Kosten pro Ev ent ermitteln Aggregation Nicht zuweisbare Kosten ermitteln CostFact Inferenz der Visits Visits zählen Bounces zählen Analyse der Verweildauer Aggregation WebsiteFact Order Status ermitteln Anzahl der nicht getrackten Orders ermitteln Aggregation Activ atedOrderFact :Analytics Warehouse:Event Data Lake «flow» «flow» «flow» «flow» «flow» «flow» «flow» «flow» «flow» «flow» «flow» «flow» «flow» «flow» «flow» «flow» «flow» «flow» «flow» «flow» «flow» Data Processing WorkflowMultidimensional Data Model
  • 32. Sample results Geolocated and gender- specific conversions. Frequency of visits Performance of an ad campaign