SlideShare a Scribd company logo
Fire-fighting Java
big data problems
BIG
DATA
WHAT
THE ?!?!?!!?
WHOOPS
Format
Look at a real-life fire
Understand root cause
Put out the fire
Avoiding the fire
Alex Holmes
@grep_alex
You are skewed
Sprint 14:18 100%
Back The Boss More
My query has been running for
over 4 hours!!!
Our CEO needs this data
right now…
10110101010010
10001001101111
10110101010010
10001001101111
10110101010010
10001001101111
10110101010010
10001001101111
zip code, car status
Distributed FS
Spark
Storage
general-purpose distributed
data processing
distributed storage, e.g.
HDFS, S3, Azure, …
Fire-fighting java big data problems
Fire-fighting java big data problems
Fire-fighting java big data problems
Fire-fighting java big data problems
Fire-fighting java big data problems
Root cause
94043,speeding
94043,stopped
94103,under_limit
IoT data: zip code, car status
94043,Mountain View
94103,San Francisco
Reference data: zip code, city
94043,under_limit
94043,stopped
94043,speeding
IoT data: zip code, car status
Shuffle (hash join)
Normal distribution
Runtime
Sequential
Parallel
Zip code
Number of cars
Skew
94043,speeding
94043,stopped
94103,under_limit
94043,speeding,Mountain View
94043,stopped,Mountain View
94043,under_limit,Mountain View
94043,stopped,Mountain View
94043,speeding,Mountain View
94103,under_limit,San Francisco
IoT data: zip code, car status
94043,Mountain View
94103,San Francisco
Reference data: zip code, city
94043,under_limit
94043,stopped
94043,speeding
IoT data: zip code, car status
Shuffle (hash join)
Skew
Runtime
Sequential
Parallel
Fire-fighting java big data problems
The fix(es)
#1: understand your data
#2: filter-out the skew
#3: only include fields you need in
the result before the join
#4: broadcast join
JVM JVM
94043,Mountain View
94103,San Francisco
94043,Mountain View
94103,San Francisco
94043,Mountain View
94103,San Francisco
1) replicate the small
dataset to each JVM,
and cache in memory
#4: broadcast join
JVM JVM
94043,Mountain View
94103,San Francisco
94043,Mountain View
94103,San Francisco
94043,Mountain View
94103,San Francisco
1) replicate the small
dataset to each JVM,
and cache in memory
94043,speeding
94043,stopped
94103,under_limit
94043,under_limit
94043,stopped
94043,speeding
2) process large data
set and join with small
in-memory data set
#4: broadcast join
this explicitly tells Spark to do a broadcast join . .
. Spark may automatically do this for you if one
dataset is < 10MB
(spark.sql.autoBroadcastJoinThreshold)
How do we know whether Spark is
performing a hash or broadcast join?
#4: not a broadcast join
scala> iotData.join(zipCodes).where($”zip" === $"zip").explain
== Physical Plan ==
*SortMergeJoin [zip2#17], [zip#9], Inner
:- *Sort [zip2#17 ASC NULLS FIRST], false, 0
: +- Exchange hashpartitioning(zip2#17, 200)
#4: broadcast join
scala> iotData.join(broadcast(zipCodes)).where($”zip” ===
$"zip").explain
== Physical Plan ==
*BroadcastHashJoin [zip2#17], [zip#9], Inner, BuildRight
#4: broadcast join
By removing the shuffle, we remove the
impact data skew has on our processing
Only works if one data set fits entirely in
memory
Other advanced options
Filtered broadcast join
Salting + filtered salting
Bin packing
Takeaways
Spark isn’t a database
Check for skew - build join key histograms
Heavily filter + project your data
Avoid or minimize the network
Why can’t you just change?
Sprint 14:18 100%
Back The Boss More
Build me a dashboard to view
the top zip codes in real-time.
Queue
IoT front end
Analytics DB
Web app
Queue
IoT front end
Analytics DB
Web app
what data
format do you
use?
Queue
IoT front end
Analytics DB
Web app
Distributed FS
Schema
{
"type": "record",
"name": "IotData",
"fields" : [
{"name": "zip", “type": "string"},
{"name": "status", "type": "long"},
{"name": "created", "type": “long"}
]
}
Schema update
{
"type": "record",
"name": “IotData",
"fields" : [
{"name": "status", "type": "long"},
{"name": “zip", "type": "string"},
{"name": "created", "type": "long"}
]
}
Swap fields
Sprint 14:18 100%
Back Ops More
The IoT front end
deployment is complete.
Sprint 14:18 100%
Back Ops More
The analytics job is failing with an
java.io.EOFException!
Root cause
Fields are serialized in schema order
4
48
2
52
51
52
57
10
field=“zip”, contents = “94043”
field=“status”, contents = 1L
field=“created”, contents = 2L
bytes
{
"type": "record",
"name": "IotData",
"fields" : [
{"name": “zip", “type": "string"},
{"name": "status", "type": "long"},
{"name": "created", "type": “long"}
]
}
Serialized fields are reordered if you reorder them
in the schema
4
48
2
52
51
52
57
10
field=“zip”, contents = “94043”
field=“status”, contents = 1L
field=“created”, contents = 2L
bytes
52
2
57
10
48
51
4
52
field=“status”, contents = 1L
field=“zip”, contents = “94043”
field=“created”, contents = 2L
bytes
“zip” and “status”
reversed
Original
Avro serialization
Fields written in schema order
Field names aren’t included
Schema typically isn’t included
Avro deserialization
Fields read in schema order
Readers need the writers schema
Writers schema isn’t typically in message
Queue
IoT front end
Analytics DB
Web app
Only the producer is updated
Consumer doesn’t have
the updated schema
The fix
Put out the fire …
Update the consumer process with the new
schema
Skip over records you can’t process, or catch
exception and attempt with old schema
Avoid the fire…
Never change the schema
Include the schema in each message
Schema registry
Use a different data format
Queue
Application
Analytics DB
Confluent
schema registry
tag each message with
a schema version
push message schema
to registry
1
fetch message schema
from registry using
tag
3
deserialize the message using
the schema from the
registry
4
Avro supported evolutions
Deleting optional fields
Re-ordering fields
Changing field names
https://avro.apache.org/docs/1.8.2/
spec.html#Schema+Resolution
It could have been worse…
{
"type": "record",
"name": "IotData",
"fields" : [
{"name": "status", "type": "long"},
{"name": "created", "type": “long"}
]
}
{
"type": "record",
"name": "IotData",
"fields" : [
{"name": "created", "type": “long”},
{"name": “status", "type": "long"}
]
}
the following schema change wouldn’t have
resulted in any runtime errors …
Takeaways
Avro is brittle without a registry
Understand how schema evolution works with your
data format
Have a strategy for schema changes
Enforce schema evolution rules (Confluence schema
registry does this)
Test schema evolution in QA
Stop the firehose!!!
Sprint 14:18 100%
Back The Boss More
Our customers are complaining
that our portal isn’t showing
current data…what’s going on?
Kafka
Spark streaming
Receiver
Spark
batches of data
results pushed to
external system
DB
Fire-fighting java big data problems
Root cause
Spike in data
By default, Spark streaming will
perform an unbounded pull from
“current” to “latest”
Which means that it may take a
long time to catch up - if at all
The fix
Put out the fire …
Skip data + restart from latest
Give your application and database more
resources*
Avoid the fire…
Know your spike load and tune your cluster + DB
to handle it
Limit the amount of Kafka data pulled in each
batch (spark.streaming.kafka.maxRatePerPartition)
Automatically skip over spikes
Over-provision or implement a lambda architecture
Takeaways
Measure and alert on lag (wall clock - event
time)
Load-test beyond your expected max rate
before going to production
Have a strategy to handle unexpected spikes
I just wanted to take a look…
Near-real time
processing Cassandra
Web app
I wonder what the
data looks like...
SELECT *
FROM top_zips
LIMIT 1;
Fire-fighting java big data problems
Sprint 14:18 100%
Back SRE More
Our production database is
down!!! *^?@!#
Root cause
Node
Node Node
perform a token
scan
Client
Flash back to my 2015 J1 talk…
V VVV V VVVVV V
KKKKKKKKKKK
V VVV V VVVVV V
KKKKKKKKKKK
tombstone markers indicate that the
column has been deleted
deletes in Cassandra
are soft; deleted
columns are marked
with tombstones
these tombstoned
columns slow-down
reads
Node
Read all the data, keeping
deleted data in-memory until
you find the first non-deleted
record
Node
Read all the data, keeping
deleted data in-memory until
you find the first record
OOM!
The fix
Put out the fire …
Bounce Cassandra
Don’t run that query again
Avoid the fire …
Don’t treat Cassandra as a OLAP database
Don’t allow users to run arbitrary queries
Instead use Spark, Splunk, or a relational/
OLAP database
Takeaways
Cassandra isn’t a data warehouse
You will bring it to its knees if you treat it like one
Learn Cassandra schema design patterns to
avoid tombstones impacting your reads when
working with heavy delete workloads
What happened?
What’s worse than the issues we’ve seen?
Not knowing they happened
Or your customer discovering it
before you
Root cause
We don’t think of
failure as a first-class citizen
The fix
Update your SDLC to measure,
test and mitigate failure
Todo In Progress Done
Measure
everything
(latencies,
errors, TPS)
Soak tests
Load testing
beyond
expected
peaks
Define
runbook
Review
runbook +
alerts with
ops/SRE
Verify metrics
are live +
correct
Chaos
monkey
Have a plan for
extended
outages, or huge
data spikes
Takeaways
Measure failure
Anticipate failure
Try and break your systems (before production)
Alert when you fail
Mitigate for it
Learn and improve from it
Thank you!

More Related Content

PDF
Apache Drill Workshop
PDF
Data Exploration with Apache Drill: Day 1
PDF
Sasi, cassandra on full text search ride
PPT
Xapian vs sphinx
PDF
Project Tungsten: Bringing Spark Closer to Bare Metal
PPTX
Splunk bsides
PPTX
Large scale, interactive ad-hoc queries over different datastores with Apache...
PDF
Big Data made easy with a Spark
Apache Drill Workshop
Data Exploration with Apache Drill: Day 1
Sasi, cassandra on full text search ride
Xapian vs sphinx
Project Tungsten: Bringing Spark Closer to Bare Metal
Splunk bsides
Large scale, interactive ad-hoc queries over different datastores with Apache...
Big Data made easy with a Spark

What's hot (20)

PDF
Compiled Websites with Plone, Django, Xapian and SSI
PDF
From DataFrames to Tungsten: A Peek into Spark's Future-(Reynold Xin, Databri...
PDF
Elasticsearch quick Intro (English)
PDF
Strata NYC 2015: Sketching Big Data with Spark: randomized algorithms for lar...
PPT
Boosting Documents in Solr by Recency, Popularity, and User Preferences
PPT
Solr and Elasticsearch, a performance study
PPTX
Why Your Database Queries Stink -SeaGl.org November 11th, 2016
PDF
Side by Side with Elasticsearch & Solr, Part 2
PDF
Patterns of Streaming Applications
PDF
Patterns and Operational Insights from the First Users of Delta Lake
PDF
Spark Cassandra Connector Dataframes
PDF
The Lonesome LOD Cloud
PDF
How to use Parquet as a basis for ETL and analytics
PDF
Building a data processing pipeline in Python
PDF
Analyzing Log Data With Apache Spark
PPTX
OrientDB vs Neo4j - Comparison of query/speed/functionality
PPTX
Benchmarking Solr Performance at Scale
PDF
New developments in open source ecosystem spark3.0 koalas delta lake
PDF
Building a real time big data analytics platform with solr
PDF
Building Real-Time BI Systems with Kafka, Spark, and Kudu: Spark Summit East ...
Compiled Websites with Plone, Django, Xapian and SSI
From DataFrames to Tungsten: A Peek into Spark's Future-(Reynold Xin, Databri...
Elasticsearch quick Intro (English)
Strata NYC 2015: Sketching Big Data with Spark: randomized algorithms for lar...
Boosting Documents in Solr by Recency, Popularity, and User Preferences
Solr and Elasticsearch, a performance study
Why Your Database Queries Stink -SeaGl.org November 11th, 2016
Side by Side with Elasticsearch & Solr, Part 2
Patterns of Streaming Applications
Patterns and Operational Insights from the First Users of Delta Lake
Spark Cassandra Connector Dataframes
The Lonesome LOD Cloud
How to use Parquet as a basis for ETL and analytics
Building a data processing pipeline in Python
Analyzing Log Data With Apache Spark
OrientDB vs Neo4j - Comparison of query/speed/functionality
Benchmarking Solr Performance at Scale
New developments in open source ecosystem spark3.0 koalas delta lake
Building a real time big data analytics platform with solr
Building Real-Time BI Systems with Kafka, Spark, and Kudu: Spark Summit East ...
Ad

Similar to Fire-fighting java big data problems (20)

PPTX
Getting started with Splunk Breakout Session
PDF
Splunk app for stream
PDF
Open Security Operations Center - OpenSOC
PDF
Spark Based Distributed Deep Learning Framework For Big Data Applications
PPTX
Berlin Buzz Words - Apache Drill by Ted Dunning & Michael Hausenblas
PDF
Making Apache Spark Better with Delta Lake
PDF
Data Streaming Technology Overview
PPTX
Getting started with Splunk
PPTX
Getting started with Splunk - Break out Session
PDF
Writing Continuous Applications with Structured Streaming in PySpark
PPTX
A Deep Dive into Structured Streaming: Apache Spark Meetup at Bloomberg 2016
PDF
Data encoding and Metadata for Streams
PPTX
SplunkLive! Frankfurt 2018 - Data Onboarding Overview
PPTX
SplunkLive! - Getting started with Splunk
PPTX
ETL 2.0 Data Engineering for developers
PDF
DBA Fundamentals Group: Continuous SQL with Kafka and Flink
PPTX
SplunkLive! Munich 2018: Data Onboarding Overview
PDF
Learning the basics of Apache NiFi for iot OSS Europe 2020
PDF
Deep Dive into Stateful Stream Processing in Structured Streaming with Tathag...
PPTX
My Master's Thesis
Getting started with Splunk Breakout Session
Splunk app for stream
Open Security Operations Center - OpenSOC
Spark Based Distributed Deep Learning Framework For Big Data Applications
Berlin Buzz Words - Apache Drill by Ted Dunning & Michael Hausenblas
Making Apache Spark Better with Delta Lake
Data Streaming Technology Overview
Getting started with Splunk
Getting started with Splunk - Break out Session
Writing Continuous Applications with Structured Streaming in PySpark
A Deep Dive into Structured Streaming: Apache Spark Meetup at Bloomberg 2016
Data encoding and Metadata for Streams
SplunkLive! Frankfurt 2018 - Data Onboarding Overview
SplunkLive! - Getting started with Splunk
ETL 2.0 Data Engineering for developers
DBA Fundamentals Group: Continuous SQL with Kafka and Flink
SplunkLive! Munich 2018: Data Onboarding Overview
Learning the basics of Apache NiFi for iot OSS Europe 2020
Deep Dive into Stateful Stream Processing in Structured Streaming with Tathag...
My Master's Thesis
Ad

Recently uploaded (20)

PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PPTX
history of c programming in notes for students .pptx
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PDF
Nekopoi APK 2025 free lastest update
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PPTX
Transform Your Business with a Software ERP System
PDF
Understanding Forklifts - TECH EHS Solution
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
AI in Product Development-omnex systems
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
How Creative Agencies Leverage Project Management Software.pdf
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
medical staffing services at VALiNTRY
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
history of c programming in notes for students .pptx
Softaken Excel to vCard Converter Software.pdf
wealthsignaloriginal-com-DS-text-... (1).pdf
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
Nekopoi APK 2025 free lastest update
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Transform Your Business with a Software ERP System
Understanding Forklifts - TECH EHS Solution
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Operating system designcfffgfgggggggvggggggggg
How to Choose the Right IT Partner for Your Business in Malaysia
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
AI in Product Development-omnex systems
Wondershare Filmora 15 Crack With Activation Key [2025
How Creative Agencies Leverage Project Management Software.pdf
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
medical staffing services at VALiNTRY

Fire-fighting java big data problems