SlideShare a Scribd company logo
Designing & Optimizing micro batching systems with
Cassandra, Spark and
Kafka
Accenture
Copyright © 2014 Accenture. All rights reserved.
Designing & Optimizing
micro batching systems
with Cassandra, Spark and
Kafka
Copyright © 2012 Accenture All rights reserved. 3
• Ananth Ram
– Big Data & Oracle Solution Architect , Accenture
– (Accenture Enkitec Group)
– Ananth.ram@Accenture.com
• Rumeel Kazi
– Big Data Solution Architect , Accenture
– (Accenture Federal)
– rumeel.k.kazi@accenturefederal.com
• Rich Rein
– Solution Architect , Datastax
– Rich.rein@datastax.com
Speaker Details and Contact
Copyright © 2012 Accenture All rights reserved. 4
• Data Acceleration and Micro Batching
• Big data Architecture
– Technical Architecture
– Application Architecture
– Data Supply Chain Approach & Framework
• Application Design & Operations
– Design Considerations
– Data Flow
– Optimizations and Operations
• Application Access Patterns
– The Problems and Physics
– Idempotency
– Partition per Read
• Takeaways
Agenda
Copyright © 2012 Accenture All rights reserved. 5
• Data as Value Chain
• Data Acceleration
– Movement
– Processing
– Insights
• High throughput with Micro Batch
Data Acceleration & Micro Batch !
Copyright © 2012 Accenture All rights reserved. 6
Big Data Architecture
Copyright © 2012 Accenture All rights reserved. 7
IV Hardware Architecture
Oracle 12c
Technical Architecture – Sample
Cassandra
Spark
Solr
Hadoop
Kafka
Spark
Big Data
Interfaces
NAS
Clustered
MQ
Files
External
Databases
Prod
(A)
Prod
(B)
Prod
(C)
Prod
(D)
Oracle 12c
12 Blades
288 Cores
6TBRAM
12 Blades
288 Cores
6TBRAM
12 Blades
288 Cores
6TB RAM
12 Blades
288 Cores
6TB RAM
4 x 10G– RAC
Interconnect
Copyright © 2012 Accenture All rights reserved. 8
Data
Enrichment
44 nodes
RAC
4 nodes
Data Ingest
16 Nodes 23 Nodes
112 Nodes
Interfaces
12 Nodes
Technical Architecture – Additional Details
• Separate Datacenters for Cassandra and Solr.
• Spark is running in the same node as Cassandra for data locality.
• Kafka , java spring batch and spark streaming are used to enrich billions of
records a day
Java
Copyright © 2012 Accenture All rights reserved. 9
Application Architecture
• Data enriched using java spring batch and spark streaming using kafka as temporary
staging area.
• Cassandra is used for faster lookups, summary views and persistence storage.
Data Ingestion
&
Business Rules
Application Cache
External
System
Interfaces
TXN DATA
(MQ, FILES, DB LINK)
OPERATIONAL
EVENTS
(MQ)
REFERENCE DATA
(MQ, FILES)
Java spring batch
Enriched Data
Aggregated Views
Reference Data
DataStore
Events
Data
IN-MEMORY TABLES
Reporting
WEB PORTAL
(CANNEDREPORTS)
&
PUSH ALERTS
AD-HOCQUERIES
Spark
Streaming
& Kafka
Enrichment
Process 2
Enrichment
Process 1
Enriched
Data
EVENTSDATA
Aggregated Views
Cassandra , Solr
HDFS, HIVE, Spark,
Spark R
Copyright © 2012 Accenture All rights reserved. 10
• Cassandra
– Cassandra 400K/sec read/writes
– Cassandra - 1ms – 3ms Read Latency, 0.2 – 0.3 ms write.
Spark
– Spark Streaming processes 200K events/sec.
– Spark Streaming runs in the same host as Cassandra for data locality
• Kafka
– 800K/second total messages processed through 30 brokers.
– Kafka broker throughput is 30k/messages per broker.
– Snappy Compression gives up to 5X throughput in Benchmark. Yet to be tested in our apps.
• Java Apps
– Java spring batch processes 400K records/sec using 1000’s of threads in apps server.
– 32GB JVM with GC1 garbage collection with application cache gives this throughput.
Cassandra, Spark and Kafka Metrics
Copyright © 2012 Accenture All rights reserved. 11
Big Data Architecture Approach
Accenture-Data-Acceleration-Architecture-Modern-Data-Supply-Chain.pdf
*Accenture Labs Paper – Carl Dukatz
Copyright © 2012 Accenture All rights reserved. 12
Big Data Architecture Design Considerations - Criteria
Sample
Copyright © 2012 Accenture All rights reserved. 13
Big Data Design Considerations - Approach
Copyright © 2012 Accenture All rights reserved. 14
Design Considerations &
UseCases
Big Data Design Considerations
Copyright © 2012 Accenture All rights reserved. 15
Application Design and
Operations
Copyright © 2012 Accenture All rights reserved. 16
High Level Design Pattern
Copyright © 2012 Accenture All rights reserved. 17
Pipeline Stage 0 (Partial Data Enrichment)
Kafka Cluster
Topic A
Partition 0
Topic A
Partition 1
Topic A
Partition N
DSE Cassandra / Spark Cluster
Executor 0 Cache
Executor 1 Cache
Executor N Cache
Pipeline Stage 1 (Partial Data Enrichment)
Kafka Cluster
Topic B
Partition 0
Topic B
Partition 1
Topic B
Partition N
DSE Cassandra / Spark Cluster
Executor 0 Cache
Executor 1 Cache
Executor N Cache
Pipeline Stage 1 (Partial Data Enrichment)
Kafka Cluster
Topic C
Partition 0
Topic C
Partition 1
Topic C
Partition N
DSE Cassandra / Spark Cluster
Executor 0 Cache
Executor 1 Cache
Executor N Cache
Data Processing Pipeline
Copyright © 2012 Accenture All rights reserved. 18
 Application Metric Collection / Diagnostic Logging
 Include application level operational metrics as part of design. Collect Cassandra and Kafka
processing metrics including response times at object level.
 Executors report application functionality specific throughput and backlog metric to the driver
that then keeps aggregated count of point in time metrics for the process.
 Kafka / Cassandra data partitioning strategies
 Distribute partitioning keys evenly across the nodes on Cassandra and Kafka brokers. For
scenarios where this can’t be done easily when data is skewed to certain data entities that
need to be part of partitioning keys, add time windows as part of partitioning keys to avoid
data skewed to few nodes.
 Time-based partitioning to avoid data skewed to few nodes.
 Spark Executor Configurations
 Define Spark number of executors to match the number of partitions on the topic. Can have
more than one partition per executor depending on the throughput/latency need - keep it low
for reduced latency.
 Web / Solr Interface Consideration
 For consistency requirement, write at consistency-level of ALL on Solr data centers, if it fails
write local quorum. Additional sub-second overhead to be considered based on functional
needs.
Application Design Considerations
Copyright © 2012 Accenture All rights reserved. 19
 Compaction Strategies
 Date Tiered v/s Size Tiered Compactions – High resource utilization on over 50 TB sized
tables running size tiered compactions on high velocity data and need to consider Date
Tiered for time series data.
 “Hot Spots” monitoring and actions
 Partition keys are chosen to ensure hot data is distributed evenly over the nodes
 Application logs with query, keys, and duration for exceeded SLAs can make problems with
specific keys known.
 Instrument application to rerun the query with CQL trace enabled to see where time was
spent.
 OpsCenter table metrics can show which nodes contain hotspots
 Nodetool toppartitions also shows the hot partition keys on a node
Performance Considerations
Copyright © 2012 Accenture All rights reserved. 20
 Spark batch window optimization and max messages per partitions
 Optimize batch duration to not have wasted batch processing time.
 Define max messages per partition when executor spans multiple partitions. Prevents OOM
exceptions as well as keeps batch processing rate balanced.
 Dynamically change max rate based on wasted batch processing time.
 DataStax Driver Settings
 Separate Transaction data and Searched data into right sized data centers
 Search data to be read and written to the same DC.
 Use local data center aware strategy in conjunction with token aware.
 In-memory tables and Local caching
 Limit the number of in-memory tables to constantly changing but smaller tables that are
accessed very frequently.
 Consider local application caching for frequently accessed data.
Performance Considerations
Copyright © 2012 Accenture All rights reserved. 21
 Latency & Throughput Monitoring
 Application should drive the data instead of technology stacks
 Use Splunk or ELK to aggregate, correlate data across nodes
 Co-relating Errors
 Use tools like Splunk or ELK
 Build Custom tools
 For Cassandra ( Nodetool, data from Opscenter)
 JMX from kafka
 Aggregated data in metrics table
 Use Java profiler like Yourkit
 For Cassandra latency Debugging
 Java memory , CPU and contentions
 Identify bottlenecks causing by specific methods/calls
Application Operations
Copyright © 2012 Accenture All rights reserved. 22
Access Patterns
Copyright © 2012 Accenture All rights reserved. 23
High Speed, Never Stop
1. The pipeline should never stop or wait
2. No stopping to upgrade software or hardware
3. No time for rollback. Roll forward.
4. No delays that will disrupt the write pipeline or read
throughput.
5. No time for locks, slow reads, large reads, joins, or
read-modify-write.
6. All frequent operations are short.
Copyright © 2012 Accenture All rights reserved. 24
• Cost prohibits the frequent unnecessary
• No unnecessary frequently read data.
• No unnecessary frequently written data.
Affordable
Copyright © 2012 Accenture All rights reserved. 25
No
• Long operations – Use the correct access patterns
• Client congestion
– Threads, sockets, heap, CPU, Memory, NUMA Cache
• Node congestion
– Threads, sockets, heap, CPU, Memory, NUMA Cache
– Storage channels
– Un-tuned or inconsistently tuned Cassandra nodes
• Network and NIC congestion
Pipeline Delays
Copyright © 2012 Accenture All rights reserved. 26
If 2 ms is your target
• Think about how many requests can a node process
in that time window without congesting the client or
node.
• Web and IoT tend to be evenly distributed over time,
avoiding timeslot contention.
• Batch size that can be processed in the time slot?
• Careful parallelization may be needed.
Physics of the SLA Time Slot
Copyright © 2012 Accenture All rights reserved. 27
Hot Partitions
Physics of Partitions
Hot Batch or Traffic
Copyright © 2012 Accenture All rights reserved. 28
• Correct table partition keys and access patterns
– Scale from 6 nodes to 1000’s
• Incorrect
– Does not scale by adding nodes
– Will not handle more load
Get the Partition Access Patterns Right
Copyright © 2012 Accenture All rights reserved. 29
Physics of a single Partition
Microseconds Operation
0.1 Read and Write RAM
100 Write Partition
100 Read Partition from memory
2,000 Read Hash access to partition in memory and read SSD
20,000 Read Hash access to partition in memory and read Spindle
Copyright © 2012 Accenture All rights reserved. 30
• Avoid
– Lists (collection)
– Read-modify-write Updates
– Counters
– GUIDs only identification of real world objects or actions
• Allows client retry (roll-forward)
• Allows pipelining of updates without waits
Idempotency
Copyright © 2012 Accenture All rights reserved. 31
• Replace read-modify-write operations
– Counters
– Updated aggregates
– Lists (collection)
With
– data increment values which get aggregated in
microbatches
– Cassandra 3.0 Aggregates
– Sets (collection)
Replace Read-Modify-Write
Copyright © 2012 Accenture All rights reserved. 32
• Reads must wait
• API Reads are 25-50x slower than writes
• Reads consume 5x the resource bandwidth of a write
• Disk is far cheaper than RAM, CPU, and Rack
• So
– Design writes for reads
– De-normalization the same as for relational
• Multiple materialized views and temp tables
• Summary tables
Denormalize
Copyright © 2012 Accenture All rights reserved. 33
Nesting Rows in the Partitions – 1 of 3
Copyright © 2012 Accenture All rights reserved. 34
Write nested data to further reduce the read to 1 partition
Nesting Rows in the Partitions – 2 of 3
Copyright © 2012 Accenture All rights reserved. 35
Cassandra allows 3 levels to be nested in a single partition
Nesting Rows in the Partitions – 3 of 3
Copyright © 2012 Accenture All rights reserved. 36
Summary / Takeaways
Copyright © 2012 Accenture All rights reserved. 37
• Treat data pipeline as value chain and accelerate movement
using fit-for-purpose Bigdata stack.
• Design your apps to drive latency/throughput visibility
• Micro batch in every layer possible to get high throughput
• Enrich data in Kafka using spark/spark streaming as process
engine.
• Cache frequently accessed data closer to code to get best
throughput.
• Focus on datamodel and Access patterns
• Review distinct features of Bigdata technology platform for
data acceleration (Accenture Approach white paper).
Summary / Take Away

More Related Content

PDF
Micro-batching: High-performance Writes (Adam Zegelin, Instaclustr) | Cassand...
PPTX
Building a Pluggable Analytics Stack with Cassandra (Jim Peregord, Element Co...
PDF
C* for Deep Learning (Andrew Jefferson, Tracktable) | Cassandra Summit 2016
PDF
Develop Scalable Applications with DataStax Drivers (Alex Popescu, Bulat Shak...
PPTX
Cassandra Tools and Distributed Administration (Jeffrey Berger, Knewton) | C*...
PPTX
Tales From the Field: The Wrong Way of Using Cassandra (Carlos Rolo, Pythian)...
PDF
Cassandra at Instagram 2016 (Dikang Gu, Facebook) | Cassandra Summit 2016
PDF
DataStax | Building a Spark Streaming App with DSE File System (Rocco Varela)...
Micro-batching: High-performance Writes (Adam Zegelin, Instaclustr) | Cassand...
Building a Pluggable Analytics Stack with Cassandra (Jim Peregord, Element Co...
C* for Deep Learning (Andrew Jefferson, Tracktable) | Cassandra Summit 2016
Develop Scalable Applications with DataStax Drivers (Alex Popescu, Bulat Shak...
Cassandra Tools and Distributed Administration (Jeffrey Berger, Knewton) | C*...
Tales From the Field: The Wrong Way of Using Cassandra (Carlos Rolo, Pythian)...
Cassandra at Instagram 2016 (Dikang Gu, Facebook) | Cassandra Summit 2016
DataStax | Building a Spark Streaming App with DSE File System (Rocco Varela)...

What's hot (20)

PPTX
Processing 50,000 events per second with Cassandra and Spark
PPTX
Running 400-node Cassandra + Spark Clusters in Azure (Anubhav Kale, Microsoft...
PPTX
Everyday I’m scaling... Cassandra
PPT
An Effective Approach to Migrate Cassandra Thrift to CQL (Yabin Meng, Pythian...
PPTX
Building a Multi-Region Cluster at Target (Aaron Ploetz, Target) | Cassandra ...
PPTX
Deploying, Backups, and Restore w Datastax + Azure at Albertsons/Safeway (Gur...
PPTX
Cassandra Tuning - above and beyond
PDF
C* Keys: Partitioning, Clustering, & CrossFit (Adam Hutson, DataScale) | Cass...
PPTX
Lessons Learned From Running 1800 Clusters (Brooke Jensen, Instaclustr) | Cas...
PPTX
DataStax | DSE Search 5.0 and Beyond (Nick Panahi & Ariel Weisberg) | Cassand...
PDF
SASI: Cassandra on the Full Text Search Ride (DuyHai DOAN, DataStax) | C* Sum...
PDF
Cassandra CLuster Management by Japan Cassandra Community
PPTX
From Postgres to Cassandra (Rimas Silkaitis, Heroku) | C* Summit 2016
PDF
Scalable Data Modeling by Example (Carlos Alonso, Job and Talent) | Cassandra...
PPTX
Load testing Cassandra applications
PPTX
Myths of Big Partitions (Robert Stupp, DataStax) | Cassandra Summit 2016
PPTX
Large partition in Cassandra
PPTX
DataStax | Data Science with DataStax Enterprise (Brian Hess) | Cassandra Sum...
PPTX
DataStax - Analytics on Apache Cassandra - Paris Tech Talks meetup
PDF
Monitoring Cassandra at Scale (Jason Cacciatore, Netflix) | C* Summit 2016
Processing 50,000 events per second with Cassandra and Spark
Running 400-node Cassandra + Spark Clusters in Azure (Anubhav Kale, Microsoft...
Everyday I’m scaling... Cassandra
An Effective Approach to Migrate Cassandra Thrift to CQL (Yabin Meng, Pythian...
Building a Multi-Region Cluster at Target (Aaron Ploetz, Target) | Cassandra ...
Deploying, Backups, and Restore w Datastax + Azure at Albertsons/Safeway (Gur...
Cassandra Tuning - above and beyond
C* Keys: Partitioning, Clustering, & CrossFit (Adam Hutson, DataScale) | Cass...
Lessons Learned From Running 1800 Clusters (Brooke Jensen, Instaclustr) | Cas...
DataStax | DSE Search 5.0 and Beyond (Nick Panahi & Ariel Weisberg) | Cassand...
SASI: Cassandra on the Full Text Search Ride (DuyHai DOAN, DataStax) | C* Sum...
Cassandra CLuster Management by Japan Cassandra Community
From Postgres to Cassandra (Rimas Silkaitis, Heroku) | C* Summit 2016
Scalable Data Modeling by Example (Carlos Alonso, Job and Talent) | Cassandra...
Load testing Cassandra applications
Myths of Big Partitions (Robert Stupp, DataStax) | Cassandra Summit 2016
Large partition in Cassandra
DataStax | Data Science with DataStax Enterprise (Brian Hess) | Cassandra Sum...
DataStax - Analytics on Apache Cassandra - Paris Tech Talks meetup
Monitoring Cassandra at Scale (Jason Cacciatore, Netflix) | C* Summit 2016
Ad

Viewers also liked (9)

PPTX
A look at the CQL changes in 3.x (Benjamin Lerer, Datastax) | Cassandra Summi...
PPTX
Cassandra Tuning - Above and Beyond (Matija Gobec, SmartCat) | Cassandra Summ...
PDF
Advanced Cassandra Operations via JMX (Nate McCall, The Last Pickle) | C* Sum...
PPTX
Deletes Without Tombstones or TTLs (Eric Stevens, ProtectWise) | Cassandra Su...
PPTX
Optimizing Cassandra in AWS
PDF
KillrVideo: Data Modeling Evolved (Patrick McFadin, Datastax) | Cassandra Sum...
PPTX
C* Capacity Forecasting (Ajay Upadhyay, Jyoti Shandil, Arun Agrawal, Netflix)...
PDF
Light Weight Transactions Under Stress (Christopher Batey, The Last Pickle) ...
PDF
Operations, Consistency, Failover for Multi-DC Clusters (Alexander Dejanovski...
A look at the CQL changes in 3.x (Benjamin Lerer, Datastax) | Cassandra Summi...
Cassandra Tuning - Above and Beyond (Matija Gobec, SmartCat) | Cassandra Summ...
Advanced Cassandra Operations via JMX (Nate McCall, The Last Pickle) | C* Sum...
Deletes Without Tombstones or TTLs (Eric Stevens, ProtectWise) | Cassandra Su...
Optimizing Cassandra in AWS
KillrVideo: Data Modeling Evolved (Patrick McFadin, Datastax) | Cassandra Sum...
C* Capacity Forecasting (Ajay Upadhyay, Jyoti Shandil, Arun Agrawal, Netflix)...
Light Weight Transactions Under Stress (Christopher Batey, The Last Pickle) ...
Operations, Consistency, Failover for Multi-DC Clusters (Alexander Dejanovski...
Ad

Similar to Designing & Optimizing Micro Batching Systems Using 100+ Nodes (Ananth Ram, Rumeel Kazi, Accenture / Rich Rein, DataStax) | C* Summit 2016 (20)

PPTX
Spark One Platform Webinar
PDF
Apache Spark for RDBMS Practitioners: How I Learned to Stop Worrying and Lov...
PPTX
The Future of Hadoop: A deeper look at Apache Spark
PPTX
Big Data_Architecture.pptx
PDF
DoneDeal - AWS Data Analytics Platform
PDF
Kafka & Hadoop in Rakuten
PPTX
Real time analytics
PPTX
Using Kafka and Kudu for fast, low-latency SQL analytics on streaming data
PDF
ADV Slides: When and How Data Lakes Fit into a Modern Data Architecture
PDF
Sa introduction to big data pipelining with cassandra & spark west mins...
PDF
Engineering Machine Learning Data Pipelines Series: Streaming New Data as It ...
PDF
20160331 sa introduction to big data pipelining berlin meetup 0.3
PDF
Large Scale Data Analytics with Spark and Cassandra on the DSE Platform
PDF
Mastering Query Optimization Techniques for Modern Data Engineers
PPTX
Part 2: Apache Kudu: Extending the Capabilities of Operational and Analytic D...
PPT
Everything You Need to Know About Sharding
PDF
Big Telco Real-Time Network Analytics
PDF
Big Telco - Yousun Jeong
PDF
Data Pipelines with Spark & DataStax Enterprise
PDF
First in Class: Optimizing the Data Lake for Tighter Integration
Spark One Platform Webinar
Apache Spark for RDBMS Practitioners: How I Learned to Stop Worrying and Lov...
The Future of Hadoop: A deeper look at Apache Spark
Big Data_Architecture.pptx
DoneDeal - AWS Data Analytics Platform
Kafka & Hadoop in Rakuten
Real time analytics
Using Kafka and Kudu for fast, low-latency SQL analytics on streaming data
ADV Slides: When and How Data Lakes Fit into a Modern Data Architecture
Sa introduction to big data pipelining with cassandra & spark west mins...
Engineering Machine Learning Data Pipelines Series: Streaming New Data as It ...
20160331 sa introduction to big data pipelining berlin meetup 0.3
Large Scale Data Analytics with Spark and Cassandra on the DSE Platform
Mastering Query Optimization Techniques for Modern Data Engineers
Part 2: Apache Kudu: Extending the Capabilities of Operational and Analytic D...
Everything You Need to Know About Sharding
Big Telco Real-Time Network Analytics
Big Telco - Yousun Jeong
Data Pipelines with Spark & DataStax Enterprise
First in Class: Optimizing the Data Lake for Tighter Integration

More from DataStax (20)

PPTX
Is Your Enterprise Ready to Shine This Holiday Season?
PPTX
Designing Fault-Tolerant Applications with DataStax Enterprise and Apache Cas...
PPTX
Running DataStax Enterprise in VMware Cloud and Hybrid Environments
PPTX
Best Practices for Getting to Production with DataStax Enterprise Graph
PPTX
Webinar | Data Management for Hybrid and Multi-Cloud: A Four-Step Journey
PPTX
Webinar | How to Understand Apache Cassandra™ Performance Through Read/Writ...
PDF
Webinar | Better Together: Apache Cassandra and Apache Kafka
PDF
Top 10 Best Practices for Apache Cassandra and DataStax Enterprise
PDF
Introduction to Apache Cassandra™ + What’s New in 4.0
PPTX
Webinar: How Active Everywhere Database Architecture Accelerates Hybrid Cloud...
PPTX
Webinar | Aligning GDPR Requirements with Today's Hybrid Cloud Realities
PDF
Designing a Distributed Cloud Database for Dummies
PDF
How to Power Innovation with Geo-Distributed Data Management in Hybrid Cloud
PDF
How to Evaluate Cloud Databases for eCommerce
PPTX
Webinar: DataStax Enterprise 6: 10 Ways to Multiply the Power of Apache Cassa...
PPTX
Webinar: DataStax and Microsoft Azure: Empowering the Right-Now Enterprise wi...
PPTX
Webinar - Real-Time Customer Experience for the Right-Now Enterprise featurin...
PPTX
Datastax - The Architect's guide to customer experience (CX)
PPTX
An Operational Data Layer is Critical for Transformative Banking Applications
PPTX
Becoming a Customer-Centric Enterprise Via Real-Time Data and Design Thinking
Is Your Enterprise Ready to Shine This Holiday Season?
Designing Fault-Tolerant Applications with DataStax Enterprise and Apache Cas...
Running DataStax Enterprise in VMware Cloud and Hybrid Environments
Best Practices for Getting to Production with DataStax Enterprise Graph
Webinar | Data Management for Hybrid and Multi-Cloud: A Four-Step Journey
Webinar | How to Understand Apache Cassandra™ Performance Through Read/Writ...
Webinar | Better Together: Apache Cassandra and Apache Kafka
Top 10 Best Practices for Apache Cassandra and DataStax Enterprise
Introduction to Apache Cassandra™ + What’s New in 4.0
Webinar: How Active Everywhere Database Architecture Accelerates Hybrid Cloud...
Webinar | Aligning GDPR Requirements with Today's Hybrid Cloud Realities
Designing a Distributed Cloud Database for Dummies
How to Power Innovation with Geo-Distributed Data Management in Hybrid Cloud
How to Evaluate Cloud Databases for eCommerce
Webinar: DataStax Enterprise 6: 10 Ways to Multiply the Power of Apache Cassa...
Webinar: DataStax and Microsoft Azure: Empowering the Right-Now Enterprise wi...
Webinar - Real-Time Customer Experience for the Right-Now Enterprise featurin...
Datastax - The Architect's guide to customer experience (CX)
An Operational Data Layer is Critical for Transformative Banking Applications
Becoming a Customer-Centric Enterprise Via Real-Time Data and Design Thinking

Recently uploaded (20)

PDF
System and Network Administration Chapter 2
PDF
top salesforce developer skills in 2025.pdf
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PPTX
history of c programming in notes for students .pptx
PPTX
Introduction to Artificial Intelligence
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
System and Network Administraation Chapter 3
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PPTX
ai tools demonstartion for schools and inter college
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
How Creative Agencies Leverage Project Management Software.pdf
PPTX
Transform Your Business with a Software ERP System
PPTX
ISO 45001 Occupational Health and Safety Management System
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
System and Network Administration Chapter 2
top salesforce developer skills in 2025.pdf
Design an Analysis of Algorithms I-SECS-1021-03
history of c programming in notes for students .pptx
Introduction to Artificial Intelligence
2025 Textile ERP Trends: SAP, Odoo & Oracle
Adobe Illustrator 28.6 Crack My Vision of Vector Design
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
VVF-Customer-Presentation2025-Ver1.9.pptx
Odoo Companies in India – Driving Business Transformation.pdf
System and Network Administraation Chapter 3
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
ai tools demonstartion for schools and inter college
CHAPTER 2 - PM Management and IT Context
How Creative Agencies Leverage Project Management Software.pdf
Transform Your Business with a Software ERP System
ISO 45001 Occupational Health and Safety Management System
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...

Designing & Optimizing Micro Batching Systems Using 100+ Nodes (Ananth Ram, Rumeel Kazi, Accenture / Rich Rein, DataStax) | C* Summit 2016

  • 1. Designing & Optimizing micro batching systems with Cassandra, Spark and Kafka Accenture
  • 2. Copyright © 2014 Accenture. All rights reserved. Designing & Optimizing micro batching systems with Cassandra, Spark and Kafka
  • 3. Copyright © 2012 Accenture All rights reserved. 3 • Ananth Ram – Big Data & Oracle Solution Architect , Accenture – (Accenture Enkitec Group) – Ananth.ram@Accenture.com • Rumeel Kazi – Big Data Solution Architect , Accenture – (Accenture Federal) – rumeel.k.kazi@accenturefederal.com • Rich Rein – Solution Architect , Datastax – Rich.rein@datastax.com Speaker Details and Contact
  • 4. Copyright © 2012 Accenture All rights reserved. 4 • Data Acceleration and Micro Batching • Big data Architecture – Technical Architecture – Application Architecture – Data Supply Chain Approach & Framework • Application Design & Operations – Design Considerations – Data Flow – Optimizations and Operations • Application Access Patterns – The Problems and Physics – Idempotency – Partition per Read • Takeaways Agenda
  • 5. Copyright © 2012 Accenture All rights reserved. 5 • Data as Value Chain • Data Acceleration – Movement – Processing – Insights • High throughput with Micro Batch Data Acceleration & Micro Batch !
  • 6. Copyright © 2012 Accenture All rights reserved. 6 Big Data Architecture
  • 7. Copyright © 2012 Accenture All rights reserved. 7 IV Hardware Architecture Oracle 12c Technical Architecture – Sample Cassandra Spark Solr Hadoop Kafka Spark Big Data Interfaces NAS Clustered MQ Files External Databases Prod (A) Prod (B) Prod (C) Prod (D) Oracle 12c 12 Blades 288 Cores 6TBRAM 12 Blades 288 Cores 6TBRAM 12 Blades 288 Cores 6TB RAM 12 Blades 288 Cores 6TB RAM 4 x 10G– RAC Interconnect
  • 8. Copyright © 2012 Accenture All rights reserved. 8 Data Enrichment 44 nodes RAC 4 nodes Data Ingest 16 Nodes 23 Nodes 112 Nodes Interfaces 12 Nodes Technical Architecture – Additional Details • Separate Datacenters for Cassandra and Solr. • Spark is running in the same node as Cassandra for data locality. • Kafka , java spring batch and spark streaming are used to enrich billions of records a day Java
  • 9. Copyright © 2012 Accenture All rights reserved. 9 Application Architecture • Data enriched using java spring batch and spark streaming using kafka as temporary staging area. • Cassandra is used for faster lookups, summary views and persistence storage. Data Ingestion & Business Rules Application Cache External System Interfaces TXN DATA (MQ, FILES, DB LINK) OPERATIONAL EVENTS (MQ) REFERENCE DATA (MQ, FILES) Java spring batch Enriched Data Aggregated Views Reference Data DataStore Events Data IN-MEMORY TABLES Reporting WEB PORTAL (CANNEDREPORTS) & PUSH ALERTS AD-HOCQUERIES Spark Streaming & Kafka Enrichment Process 2 Enrichment Process 1 Enriched Data EVENTSDATA Aggregated Views Cassandra , Solr HDFS, HIVE, Spark, Spark R
  • 10. Copyright © 2012 Accenture All rights reserved. 10 • Cassandra – Cassandra 400K/sec read/writes – Cassandra - 1ms – 3ms Read Latency, 0.2 – 0.3 ms write. Spark – Spark Streaming processes 200K events/sec. – Spark Streaming runs in the same host as Cassandra for data locality • Kafka – 800K/second total messages processed through 30 brokers. – Kafka broker throughput is 30k/messages per broker. – Snappy Compression gives up to 5X throughput in Benchmark. Yet to be tested in our apps. • Java Apps – Java spring batch processes 400K records/sec using 1000’s of threads in apps server. – 32GB JVM with GC1 garbage collection with application cache gives this throughput. Cassandra, Spark and Kafka Metrics
  • 11. Copyright © 2012 Accenture All rights reserved. 11 Big Data Architecture Approach Accenture-Data-Acceleration-Architecture-Modern-Data-Supply-Chain.pdf *Accenture Labs Paper – Carl Dukatz
  • 12. Copyright © 2012 Accenture All rights reserved. 12 Big Data Architecture Design Considerations - Criteria Sample
  • 13. Copyright © 2012 Accenture All rights reserved. 13 Big Data Design Considerations - Approach
  • 14. Copyright © 2012 Accenture All rights reserved. 14 Design Considerations & UseCases Big Data Design Considerations
  • 15. Copyright © 2012 Accenture All rights reserved. 15 Application Design and Operations
  • 16. Copyright © 2012 Accenture All rights reserved. 16 High Level Design Pattern
  • 17. Copyright © 2012 Accenture All rights reserved. 17 Pipeline Stage 0 (Partial Data Enrichment) Kafka Cluster Topic A Partition 0 Topic A Partition 1 Topic A Partition N DSE Cassandra / Spark Cluster Executor 0 Cache Executor 1 Cache Executor N Cache Pipeline Stage 1 (Partial Data Enrichment) Kafka Cluster Topic B Partition 0 Topic B Partition 1 Topic B Partition N DSE Cassandra / Spark Cluster Executor 0 Cache Executor 1 Cache Executor N Cache Pipeline Stage 1 (Partial Data Enrichment) Kafka Cluster Topic C Partition 0 Topic C Partition 1 Topic C Partition N DSE Cassandra / Spark Cluster Executor 0 Cache Executor 1 Cache Executor N Cache Data Processing Pipeline
  • 18. Copyright © 2012 Accenture All rights reserved. 18  Application Metric Collection / Diagnostic Logging  Include application level operational metrics as part of design. Collect Cassandra and Kafka processing metrics including response times at object level.  Executors report application functionality specific throughput and backlog metric to the driver that then keeps aggregated count of point in time metrics for the process.  Kafka / Cassandra data partitioning strategies  Distribute partitioning keys evenly across the nodes on Cassandra and Kafka brokers. For scenarios where this can’t be done easily when data is skewed to certain data entities that need to be part of partitioning keys, add time windows as part of partitioning keys to avoid data skewed to few nodes.  Time-based partitioning to avoid data skewed to few nodes.  Spark Executor Configurations  Define Spark number of executors to match the number of partitions on the topic. Can have more than one partition per executor depending on the throughput/latency need - keep it low for reduced latency.  Web / Solr Interface Consideration  For consistency requirement, write at consistency-level of ALL on Solr data centers, if it fails write local quorum. Additional sub-second overhead to be considered based on functional needs. Application Design Considerations
  • 19. Copyright © 2012 Accenture All rights reserved. 19  Compaction Strategies  Date Tiered v/s Size Tiered Compactions – High resource utilization on over 50 TB sized tables running size tiered compactions on high velocity data and need to consider Date Tiered for time series data.  “Hot Spots” monitoring and actions  Partition keys are chosen to ensure hot data is distributed evenly over the nodes  Application logs with query, keys, and duration for exceeded SLAs can make problems with specific keys known.  Instrument application to rerun the query with CQL trace enabled to see where time was spent.  OpsCenter table metrics can show which nodes contain hotspots  Nodetool toppartitions also shows the hot partition keys on a node Performance Considerations
  • 20. Copyright © 2012 Accenture All rights reserved. 20  Spark batch window optimization and max messages per partitions  Optimize batch duration to not have wasted batch processing time.  Define max messages per partition when executor spans multiple partitions. Prevents OOM exceptions as well as keeps batch processing rate balanced.  Dynamically change max rate based on wasted batch processing time.  DataStax Driver Settings  Separate Transaction data and Searched data into right sized data centers  Search data to be read and written to the same DC.  Use local data center aware strategy in conjunction with token aware.  In-memory tables and Local caching  Limit the number of in-memory tables to constantly changing but smaller tables that are accessed very frequently.  Consider local application caching for frequently accessed data. Performance Considerations
  • 21. Copyright © 2012 Accenture All rights reserved. 21  Latency & Throughput Monitoring  Application should drive the data instead of technology stacks  Use Splunk or ELK to aggregate, correlate data across nodes  Co-relating Errors  Use tools like Splunk or ELK  Build Custom tools  For Cassandra ( Nodetool, data from Opscenter)  JMX from kafka  Aggregated data in metrics table  Use Java profiler like Yourkit  For Cassandra latency Debugging  Java memory , CPU and contentions  Identify bottlenecks causing by specific methods/calls Application Operations
  • 22. Copyright © 2012 Accenture All rights reserved. 22 Access Patterns
  • 23. Copyright © 2012 Accenture All rights reserved. 23 High Speed, Never Stop 1. The pipeline should never stop or wait 2. No stopping to upgrade software or hardware 3. No time for rollback. Roll forward. 4. No delays that will disrupt the write pipeline or read throughput. 5. No time for locks, slow reads, large reads, joins, or read-modify-write. 6. All frequent operations are short.
  • 24. Copyright © 2012 Accenture All rights reserved. 24 • Cost prohibits the frequent unnecessary • No unnecessary frequently read data. • No unnecessary frequently written data. Affordable
  • 25. Copyright © 2012 Accenture All rights reserved. 25 No • Long operations – Use the correct access patterns • Client congestion – Threads, sockets, heap, CPU, Memory, NUMA Cache • Node congestion – Threads, sockets, heap, CPU, Memory, NUMA Cache – Storage channels – Un-tuned or inconsistently tuned Cassandra nodes • Network and NIC congestion Pipeline Delays
  • 26. Copyright © 2012 Accenture All rights reserved. 26 If 2 ms is your target • Think about how many requests can a node process in that time window without congesting the client or node. • Web and IoT tend to be evenly distributed over time, avoiding timeslot contention. • Batch size that can be processed in the time slot? • Careful parallelization may be needed. Physics of the SLA Time Slot
  • 27. Copyright © 2012 Accenture All rights reserved. 27 Hot Partitions Physics of Partitions Hot Batch or Traffic
  • 28. Copyright © 2012 Accenture All rights reserved. 28 • Correct table partition keys and access patterns – Scale from 6 nodes to 1000’s • Incorrect – Does not scale by adding nodes – Will not handle more load Get the Partition Access Patterns Right
  • 29. Copyright © 2012 Accenture All rights reserved. 29 Physics of a single Partition Microseconds Operation 0.1 Read and Write RAM 100 Write Partition 100 Read Partition from memory 2,000 Read Hash access to partition in memory and read SSD 20,000 Read Hash access to partition in memory and read Spindle
  • 30. Copyright © 2012 Accenture All rights reserved. 30 • Avoid – Lists (collection) – Read-modify-write Updates – Counters – GUIDs only identification of real world objects or actions • Allows client retry (roll-forward) • Allows pipelining of updates without waits Idempotency
  • 31. Copyright © 2012 Accenture All rights reserved. 31 • Replace read-modify-write operations – Counters – Updated aggregates – Lists (collection) With – data increment values which get aggregated in microbatches – Cassandra 3.0 Aggregates – Sets (collection) Replace Read-Modify-Write
  • 32. Copyright © 2012 Accenture All rights reserved. 32 • Reads must wait • API Reads are 25-50x slower than writes • Reads consume 5x the resource bandwidth of a write • Disk is far cheaper than RAM, CPU, and Rack • So – Design writes for reads – De-normalization the same as for relational • Multiple materialized views and temp tables • Summary tables Denormalize
  • 33. Copyright © 2012 Accenture All rights reserved. 33 Nesting Rows in the Partitions – 1 of 3
  • 34. Copyright © 2012 Accenture All rights reserved. 34 Write nested data to further reduce the read to 1 partition Nesting Rows in the Partitions – 2 of 3
  • 35. Copyright © 2012 Accenture All rights reserved. 35 Cassandra allows 3 levels to be nested in a single partition Nesting Rows in the Partitions – 3 of 3
  • 36. Copyright © 2012 Accenture All rights reserved. 36 Summary / Takeaways
  • 37. Copyright © 2012 Accenture All rights reserved. 37 • Treat data pipeline as value chain and accelerate movement using fit-for-purpose Bigdata stack. • Design your apps to drive latency/throughput visibility • Micro batch in every layer possible to get high throughput • Enrich data in Kafka using spark/spark streaming as process engine. • Cache frequently accessed data closer to code to get best throughput. • Focus on datamodel and Access patterns • Review distinct features of Bigdata technology platform for data acceleration (Accenture Approach white paper). Summary / Take Away

Editor's Notes

  • #14: Based on Accenture Lab Research Paper: http://www.accenture.com/SiteCollectionDocuments/PDF/Accenture-Data-Acceleration-Architecture-Modern-Data-Supply-Chain.pdf
  • #15: Based on Accenture Lab Research Paper: http://www.accenture.com/SiteCollectionDocuments/PDF/Accenture-Data-Acceleration-Architecture-Modern-Data-Supply-Chain.pdf