SlideShare a Scribd company logo
1 of 37
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

Viewers also liked

Viewers also liked (20)

Stellar Phoenix récupération de données
Stellar Phoenix récupération de donnéesStellar Phoenix récupération de données
Stellar Phoenix récupération de données
 
Unlocking value in your (big) data
Unlocking value in your (big) dataUnlocking value in your (big) data
Unlocking value in your (big) data
 
L'utilisation du Big Data en entreprise
L'utilisation du Big Data en entrepriseL'utilisation du Big Data en entreprise
L'utilisation du Big Data en entreprise
 
Analytics et Big Data, une histoire de cubes...
Analytics et Big Data, une histoire de cubes...Analytics et Big Data, une histoire de cubes...
Analytics et Big Data, une histoire de cubes...
 
Introduction à Cassandra
Introduction à CassandraIntroduction à Cassandra
Introduction à Cassandra
 
DataStax | Graph Computing with Apache TinkerPop (Marko Rodriguez) | Cassandr...
DataStax | Graph Computing with Apache TinkerPop (Marko Rodriguez) | Cassandr...DataStax | Graph Computing with Apache TinkerPop (Marko Rodriguez) | Cassandr...
DataStax | Graph Computing with Apache TinkerPop (Marko Rodriguez) | Cassandr...
 
Use In IoT : l’objet connecté de la board au dashboard
Use In IoT : l’objet connecté de la board au dashboardUse In IoT : l’objet connecté de la board au dashboard
Use In IoT : l’objet connecté de la board au dashboard
 
Hadoop Strata Talk - Uber, your hadoop has arrived
Hadoop Strata Talk - Uber, your hadoop has arrived Hadoop Strata Talk - Uber, your hadoop has arrived
Hadoop Strata Talk - Uber, your hadoop has arrived
 
Implementing the Lambda Architecture efficiently with Apache Spark
Implementing the Lambda Architecture efficiently with Apache SparkImplementing the Lambda Architecture efficiently with Apache Spark
Implementing the Lambda Architecture efficiently with Apache Spark
 
BI : Analyse des Données avec Mondrian
BI : Analyse des Données avec Mondrian BI : Analyse des Données avec Mondrian
BI : Analyse des Données avec Mondrian
 
Migration Best Practices: From RDBMS to Cassandra without a Hitch
Migration Best Practices: From RDBMS to Cassandra without a HitchMigration Best Practices: From RDBMS to Cassandra without a Hitch
Migration Best Practices: From RDBMS to Cassandra without a Hitch
 
Requêtes multi-critères avec Cassandra
Requêtes multi-critères avec CassandraRequêtes multi-critères avec Cassandra
Requêtes multi-critères avec Cassandra
 
OLAP with Cassandra and Spark
OLAP with Cassandra and SparkOLAP with Cassandra and Spark
OLAP with Cassandra and Spark
 
53 Claves para conocer Machine Learning
53 Claves para conocer Machine Learning53 Claves para conocer Machine Learning
53 Claves para conocer Machine Learning
 
Real-Time Analytics with Apache Cassandra and Apache Spark
Real-Time Analytics with Apache Cassandra and Apache SparkReal-Time Analytics with Apache Cassandra and Apache Spark
Real-Time Analytics with Apache Cassandra and Apache Spark
 
69 claves para conocer Big Data
69 claves para conocer Big Data69 claves para conocer Big Data
69 claves para conocer Big Data
 
Chp2 - Les Entrepôts de Données
Chp2 - Les Entrepôts de DonnéesChp2 - Les Entrepôts de Données
Chp2 - Les Entrepôts de Données
 
BI, Reporting and Analytics on Apache Cassandra
BI, Reporting and Analytics on Apache CassandraBI, Reporting and Analytics on Apache Cassandra
BI, Reporting and Analytics on Apache Cassandra
 
Chp1 - Introduction à l'Informatique Décisionnelle
Chp1 - Introduction à l'Informatique DécisionnelleChp1 - Introduction à l'Informatique Décisionnelle
Chp1 - Introduction à l'Informatique Décisionnelle
 
Big Data and Fast Data - Lambda Architecture in Action
Big Data and Fast Data - Lambda Architecture in ActionBig Data and Fast Data - Lambda Architecture in Action
Big Data and Fast Data - Lambda Architecture in Action
 

More from DataStax

More from DataStax (20)

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

Recently uploaded

Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdfMastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
mbmh111980
 

Recently uploaded (20)

A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
 
AI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in MichelangeloAI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in Michelangelo
 
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdfA Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
 
Crafting the Perfect Measurement Sheet with PLM Integration
Crafting the Perfect Measurement Sheet with PLM IntegrationCrafting the Perfect Measurement Sheet with PLM Integration
Crafting the Perfect Measurement Sheet with PLM Integration
 
SQL Injection Introduction and Prevention
SQL Injection Introduction and PreventionSQL Injection Introduction and Prevention
SQL Injection Introduction and Prevention
 
Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)
Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)
Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)
 
Microsoft 365 Copilot; An AI tool changing the world of work _PDF.pdf
Microsoft 365 Copilot; An AI tool changing the world of work _PDF.pdfMicrosoft 365 Copilot; An AI tool changing the world of work _PDF.pdf
Microsoft 365 Copilot; An AI tool changing the world of work _PDF.pdf
 
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdf
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdfImplementing KPIs and Right Metrics for Agile Delivery Teams.pdf
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdf
 
How to pick right visual testing tool.pdf
How to pick right visual testing tool.pdfHow to pick right visual testing tool.pdf
How to pick right visual testing tool.pdf
 
APVP,apvp apvp High quality supplier safe spot transport, 98% purity
APVP,apvp apvp High quality supplier safe spot transport, 98% purityAPVP,apvp apvp High quality supplier safe spot transport, 98% purity
APVP,apvp apvp High quality supplier safe spot transport, 98% purity
 
Agnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in KrakówAgnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in Kraków
 
Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdfMastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
 
Top Mobile App Development Companies 2024
Top Mobile App Development Companies 2024Top Mobile App Development Companies 2024
Top Mobile App Development Companies 2024
 
COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...
COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...
COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...
 
How to install and activate eGrabber JobGrabber
How to install and activate eGrabber JobGrabberHow to install and activate eGrabber JobGrabber
How to install and activate eGrabber JobGrabber
 
CompTIA Security+ (Study Notes) for cs.pdf
CompTIA Security+ (Study Notes) for cs.pdfCompTIA Security+ (Study Notes) for cs.pdf
CompTIA Security+ (Study Notes) for cs.pdf
 
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAGAI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
 
AI/ML Infra Meetup | Perspective on Deep Learning Framework
AI/ML Infra Meetup | Perspective on Deep Learning FrameworkAI/ML Infra Meetup | Perspective on Deep Learning Framework
AI/ML Infra Meetup | Perspective on Deep Learning Framework
 
OpenChain @ LF Japan Executive Briefing - May 2024
OpenChain @ LF Japan Executive Briefing - May 2024OpenChain @ LF Japan Executive Briefing - May 2024
OpenChain @ LF Japan Executive Briefing - May 2024
 
5 Reasons Driving Warehouse Management Systems Demand
5 Reasons Driving Warehouse Management Systems Demand5 Reasons Driving Warehouse Management Systems Demand
5 Reasons Driving Warehouse Management Systems Demand
 

Batch Processing 20+ Billion Txns in Oracle vs Cassandra/Spark/Kafka (Ananth Ram, Murali Kannan, Accenture) | 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

  1. Based on Accenture Lab Research Paper: http://www.accenture.com/SiteCollectionDocuments/PDF/Accenture-Data-Acceleration-Architecture-Modern-Data-Supply-Chain.pdf
  2. Based on Accenture Lab Research Paper: http://www.accenture.com/SiteCollectionDocuments/PDF/Accenture-Data-Acceleration-Architecture-Modern-Data-Supply-Chain.pdf