SlideShare a Scribd company logo
1 of 40
Download to read offline
Cassandra Compute Cloud 
An Elastic Cassandra Infrastructure 
Gurashish Singh Brar 
Member of Technical Staff @ BloomReach
Abstract 
Dynamically scaling Cassandra to serve hundreds of map-reduce jobs that come at an unpredictable rate and at 
the same time providing access to the data in real time to front-end application with strict TP95 latency 
guarantees is a hard problem. 
We present a system for managing Cassandra clusters which provide following functionality: 
1) Dynamic scaling of capacity to serve high throughput map-reduce jobs 
2) Provide access to data generated by map-reduce jobs in realtime to front-end applications while providing 
latency SLAs for TP95 
3) Maintain a low cost by leveraging Amazon Spot Instances and through demand based scaling. 
At the heart of this infrastructure lies a custom data replication service that makes it possible to stream data to 
new nodes as needed
What is it about ? 
• Dynamically scaling the infrastructure to support large EMR jobs 
• Throughput SLA to backend applications 
• TP95 latency SLA to frontend applications 
• Cassandra 2.0 using vnodes
Agenda 
• Application requirements 
• Major issues we encountered 
• Solutions to the issues
Application Requirements 
• Backend EMR jobs performing scans, lookups and writes 
Heterogeneous applications with varying degree of throughput SLAs. 
Very high peak loads 
Always available (no maintenance periods or planned downtimes) 
• Frontend applications performing lookups 
Data from backend applications expected in realtime 
Low latencies 
• Developer support
How we started 
Frontend Applications 
Frontend 
DC 
Backend 
DC 
Cassandra Cluster 
EMR Jobs
Frontend isolation using multiple DCs 
Frontend DC 
Cassandra Cluster 
Backend DC
Frontend Issue: Spillover Reads 
Frontend DC 
Cassandra Cluster 
Backend DC
Frontend Issue: Latencies vs Replication load 
Frontend Applications 
Cassandra Cluster 
Frontend 
DC 
Backend 
DC 
EMR Jobs
Backend Issue: Fixed resource 
Backend 
DC 
Cassandra Cluster 
EMR Jobs 
EMR Jobs
Backend Issue: Fixed Resource 
Cassandra Cluster 
Backend 
DC 
EMR Jobs 
EMR Jobs 
EMR Jobs 
EMR Jobs 
EMR Jobs 
EMR Jobs 
EMR Jobs 
EMR Jobs
Backend Issue: Starvation 
Backend 
DC 
Cassandra Cluster 
Large EMR Jobs 
with 
relaxed SLA 
Small EMR job 
with 
tighter SLA
Summary of Issues 
• Frontend isolation is not perfect 
• Frontend latencies are impacted by backend write load 
• EMR jobs can overwhelm the Cassandra cluster 
• Large EMR jobs can starve smaller ones
Rate Limiter 
Frontend Applications 
Frontend 
DC 
Backend 
DC 
Cassandra Cluster 
EMR Jobs 
Token Server 
(Redis)
Rate Limiter 
• QPS allocated on per operation and application level 
• Operations can be: scans, reads, writes, prepare, alter, create … etc 
• Each mapper/reducer obtains permits for 1 minute (configurable). 
• The token bucket is periodically refreshed with allocated capacity 
• Quotas are dynamically adjusted to take advantage of unused quotas of applications 
( We do want to maximize the cluster usage)
Why Redis ? 
• High load from all EMR nodes 
• Low latency 
• Support high number of concurrent connections 
• Support atomic fetch and add
Cost of Rate Limiter 
• We converted EMR from an elastic resource to a fixed resource 
• To scale EMR we have to scale Cassandra 
• Adding capacity to Cassandra cluster is not trivial 
• Adding capacity under heavy load is harder 
• Auto scaling and reducing under heavy load is even harder
Managing capacity - Requirements 
• Time to increase capacity should be in minutes 
• Programmatic management and not manual 
• Minimum load on the production cluster during the operation
C* increasing capacity 
C* 
Cluster 
Adding nodes is 
expensive
C* increasing capacity 
C* 
Cluster 
C* 
Sol: Replicate to a Cluster 
new cluster
Custom Replication Service 
Source 
Cluster 
Destination 
Cluster 
SSTable file copy
Custom Replication Service
Custom Replication Service 
• Replication Service (source node) takes snapshot of column family 
• SSTables in snapshot are evenly streamed on destination cluster 
• Replication Service (destination node) splits a single source SSTable to N SSTables 
• Splits computed using SSTableReader & SSTableWriter classes. A single SSTable can 
be split in parallel by multiple threads
Custom Replication Service 
• Once split the new SSTables are streamed to correct destination nodes 
• Rolling restart is initiated on the destination cluster (we could have used nodetool refresh, 
but it was unreliable) 
• The cluster is ready for use 
• In parallel trigger compaction on destination cluster for optimizing reads
Cluster Provisioning 
• Estimate the required cluster size based on column family disk size on source cluster 
• Provision machines on AWS (Cassandra is pre-installed on AMI , so no setup required) 
• Generate yaml and topology file with the new cluster and create a backend datacenter 
(Application agnostic) 
• Copy schema from source cluster to destination cluster 
• Call replication service on source cluster to replicate data
C* Compute Cloud 
Source 
Cluster 
Cluster Management 
service 
On-demand cluster 
On-demand cluster 
On-demand cluster 
On-demand cluster 
EMR Jobs
C* Compute Cloud 
• Very high throughput in moving raw data from source to destination cluster (10 X 
increase in network usage compared to normal) 
• Little CPU/Memory load on the source cluster 
• Leverage the size of destination cluster to compute new SSTables for the new ring 
• Time to provision varies between 10 minutes to 40 minutes 
• API driven so automatically scales up and down with demand 
• Application agnostic
C* Compute Cloud - Limitations 
• Snapshot model : Take a snapshot of production and operate on it 
This works really well for some use cases, good for most, but not all 
• Provisioning time order of minutes 
Works for EMR jobs which themselves take few minutes to provision but does not work for 
dedicated backend applications 
• Writes still need to happen on production reserved cluster
Where we are now 
Frontend Applications 
Frontend 
DC 
Backend 
DC 
Cassandra Cluster 
EMR Jobs 
On-demand cluster 
Token Server (Redis) 
On-demand cluster 
On-demand cluster 
Replication 
Cluster Management 
service
Exploiting the C* compute cloud 
• Key feature: Easy, automated and fast cluster provisioning with 
production data 
• Use Spot Instances instead of On-Demand 
• Failures in few nodes are survivable due to C* redundancy 
• In case of too many failures, just rebuild on retry (its fast ! & automatic)
Spot Instances 
• Service supports all instance types in AWS and all AZs 
• Pick the optimal Spot Instance type & AZ that is the cheapest and 
satisfies the constraints 
• Further reduces cost and improves reliability of the service 
• If r3.2xlarge spot price spikes on retry service might pick c3.8xlarge 
• Auto expire clusters to adjust automatically to cheaper instances
Cost or Capacity (take your pick) 
Capacity of C* compute cloud on spot instances 
~= 
(5 to 10) X C* cluster using on-demand instances 
for same $ value
Issues Addressed 
• Backend Read Capacity can scale linearly with C* compute cloud 
• Frontend latencies are protected from write load through rate limit
Remaining issues 
• Read load on backend DC can spillover to frontend DC causing spikes 
• Write capacity is still defined by frontend latencies
Issue: Spillover Reads 
Frontend DC 
Cassandra Cluster 
Backend DC
Spillover Reads Fix: Fail the read 
Frontend DC 
Cassandra Cluster 
Backend DC 
X
Addressing the Write Capacity 
• The obvious : Only push the updates that are new and not the same 
Big improvement, 80-90% data did not change 
• Add more nodes : With the backend read load off production it is lot 
easier to expand capacity 
• But we are still operating at ~ 3rd or 5th the write capacity to keep read 
latencies low
Addressing the Write Capacity 
• Experimental changes under evaluation 
• Prioritize reads over writes on frontend 
Pause write stage during a read 
• Reduce replication load to frontend DC from backend DC 
ColumnLevel replication strategy 
Most frontend applications operate on a subset view of backend data
Key Takeaways 
• Scale Cassandra dynamically for backend load by creating snapshot 
clusters 
• Use rate limiter to protect the production cluster from spiky and 
unexpected backend traffic 
• Build better isolation between frontend DC and backend DC 
• Writes throughput from backend to frontend is a challenge
Questions ? 
Thank you

More Related Content

What's hot

What's hot (20)

Redis For Distributed & Fault Tolerant Data Plumbing Infrastructure
Redis For Distributed & Fault Tolerant Data Plumbing Infrastructure Redis For Distributed & Fault Tolerant Data Plumbing Infrastructure
Redis For Distributed & Fault Tolerant Data Plumbing Infrastructure
 
AWS re:Invent 2016: [JK REPEAT] Deep Dive on Amazon EC2 Instances, Featuring ...
AWS re:Invent 2016: [JK REPEAT] Deep Dive on Amazon EC2 Instances, Featuring ...AWS re:Invent 2016: [JK REPEAT] Deep Dive on Amazon EC2 Instances, Featuring ...
AWS re:Invent 2016: [JK REPEAT] Deep Dive on Amazon EC2 Instances, Featuring ...
 
Redshift
RedshiftRedshift
Redshift
 
AWS re:Invent 2016: Amazon Aurora Deep Dive (GPST402)
AWS re:Invent 2016: Amazon Aurora Deep Dive (GPST402)AWS re:Invent 2016: Amazon Aurora Deep Dive (GPST402)
AWS re:Invent 2016: Amazon Aurora Deep Dive (GPST402)
 
Best Practices for NoSQL Workloads on Amazon EC2 and Amazon EBS - February 20...
Best Practices for NoSQL Workloads on Amazon EC2 and Amazon EBS - February 20...Best Practices for NoSQL Workloads on Amazon EC2 and Amazon EBS - February 20...
Best Practices for NoSQL Workloads on Amazon EC2 and Amazon EBS - February 20...
 
Getting Started with Amazon EC2 and Compute Services
Getting Started with Amazon EC2 and Compute ServicesGetting Started with Amazon EC2 and Compute Services
Getting Started with Amazon EC2 and Compute Services
 
AWS RDS Migration Tool
AWS RDS Migration Tool AWS RDS Migration Tool
AWS RDS Migration Tool
 
Re invent 2018 meetup presentation
Re invent 2018 meetup presentationRe invent 2018 meetup presentation
Re invent 2018 meetup presentation
 
AWS Summit London 2014 | Maximising EC2 and EBC Performance (400)
AWS Summit London 2014 | Maximising EC2 and EBC Performance (400)AWS Summit London 2014 | Maximising EC2 and EBC Performance (400)
AWS Summit London 2014 | Maximising EC2 and EBC Performance (400)
 
Solving Problems At Scale With Redis
Solving Problems At Scale With RedisSolving Problems At Scale With Redis
Solving Problems At Scale With Redis
 
Consolidate MySQL Shards Into Amazon Aurora Using AWS Database Migration Serv...
Consolidate MySQL Shards Into Amazon Aurora Using AWS Database Migration Serv...Consolidate MySQL Shards Into Amazon Aurora Using AWS Database Migration Serv...
Consolidate MySQL Shards Into Amazon Aurora Using AWS Database Migration Serv...
 
Should you read Kafka as a stream or in batch? Should you even care? | Ido Na...
Should you read Kafka as a stream or in batch? Should you even care? | Ido Na...Should you read Kafka as a stream or in batch? Should you even care? | Ido Na...
Should you read Kafka as a stream or in batch? Should you even care? | Ido Na...
 
NEW LAUNCH! Introducing PostgreSQL compatibility for Amazon Aurora
NEW LAUNCH! Introducing PostgreSQL compatibility for Amazon AuroraNEW LAUNCH! Introducing PostgreSQL compatibility for Amazon Aurora
NEW LAUNCH! Introducing PostgreSQL compatibility for Amazon Aurora
 
Migrating Your Oracle Database to PostgreSQL - AWS Online Tech Talks
Migrating Your Oracle Database to PostgreSQL - AWS Online Tech TalksMigrating Your Oracle Database to PostgreSQL - AWS Online Tech Talks
Migrating Your Oracle Database to PostgreSQL - AWS Online Tech Talks
 
AWS Partner Webcast - Disaster Recovery: Implementing DR Across On-premises a...
AWS Partner Webcast - Disaster Recovery: Implementing DR Across On-premises a...AWS Partner Webcast - Disaster Recovery: Implementing DR Across On-premises a...
AWS Partner Webcast - Disaster Recovery: Implementing DR Across On-premises a...
 
C* Summit 2013: Large Scale Data Ingestion, Processing and Analysis: Then, No...
C* Summit 2013: Large Scale Data Ingestion, Processing and Analysis: Then, No...C* Summit 2013: Large Scale Data Ingestion, Processing and Analysis: Then, No...
C* Summit 2013: Large Scale Data Ingestion, Processing and Analysis: Then, No...
 
Introduction to Amazon Relational Database Service
Introduction to Amazon Relational Database ServiceIntroduction to Amazon Relational Database Service
Introduction to Amazon Relational Database Service
 
Consolidate MySQL Shards Into Amazon Aurora Using AWS Database Migration Serv...
Consolidate MySQL Shards Into Amazon Aurora Using AWS Database Migration Serv...Consolidate MySQL Shards Into Amazon Aurora Using AWS Database Migration Serv...
Consolidate MySQL Shards Into Amazon Aurora Using AWS Database Migration Serv...
 
(BDT305) Lessons Learned and Best Practices for Running Hadoop on AWS | AWS r...
(BDT305) Lessons Learned and Best Practices for Running Hadoop on AWS | AWS r...(BDT305) Lessons Learned and Best Practices for Running Hadoop on AWS | AWS r...
(BDT305) Lessons Learned and Best Practices for Running Hadoop on AWS | AWS r...
 
What's New in Amazon Aurora
What's New in Amazon AuroraWhat's New in Amazon Aurora
What's New in Amazon Aurora
 

Similar to Cassandra Summit 2014: Cassandra Compute Cloud: An elastic Cassandra Infrastructure

Similar to Cassandra Summit 2014: Cassandra Compute Cloud: An elastic Cassandra Infrastructure (20)

Scalable analytics for iaas cloud availability
Scalable analytics for iaas cloud availabilityScalable analytics for iaas cloud availability
Scalable analytics for iaas cloud availability
 
QoS-Aware Data Replication for Data-Intensive Applications in Cloud Computing...
QoS-Aware Data Replication for Data-Intensive Applications in Cloud Computing...QoS-Aware Data Replication for Data-Intensive Applications in Cloud Computing...
QoS-Aware Data Replication for Data-Intensive Applications in Cloud Computing...
 
C* Summit 2013: Netflix Open Source Tools and Benchmarks for Cassandra by Adr...
C* Summit 2013: Netflix Open Source Tools and Benchmarks for Cassandra by Adr...C* Summit 2013: Netflix Open Source Tools and Benchmarks for Cassandra by Adr...
C* Summit 2013: Netflix Open Source Tools and Benchmarks for Cassandra by Adr...
 
High Performance Computing with AWS
High Performance Computing with AWSHigh Performance Computing with AWS
High Performance Computing with AWS
 
Tokyo azure meetup #12 service fabric internals
Tokyo azure meetup #12   service fabric internalsTokyo azure meetup #12   service fabric internals
Tokyo azure meetup #12 service fabric internals
 
AWS re:Invent 2016: AWS Database State of the Union (DAT320)
AWS re:Invent 2016: AWS Database State of the Union (DAT320)AWS re:Invent 2016: AWS Database State of the Union (DAT320)
AWS re:Invent 2016: AWS Database State of the Union (DAT320)
 
[よくわかるAmazon Redshift in 大阪]Amazon Redshift最新情報と導入事例のご紹介
[よくわかるAmazon Redshift in 大阪]Amazon Redshift最新情報と導入事例のご紹介[よくわかるAmazon Redshift in 大阪]Amazon Redshift最新情報と導入事例のご紹介
[よくわかるAmazon Redshift in 大阪]Amazon Redshift最新情報と導入事例のご紹介
 
Amazon relational database service (rds)
Amazon relational database service (rds)Amazon relational database service (rds)
Amazon relational database service (rds)
 
Building a Just-in-Time Application Stack for Analysts
Building a Just-in-Time Application Stack for AnalystsBuilding a Just-in-Time Application Stack for Analysts
Building a Just-in-Time Application Stack for Analysts
 
Cloud Architecture Tutorial - Running in the Cloud (3of3)
Cloud Architecture Tutorial - Running in the Cloud (3of3)Cloud Architecture Tutorial - Running in the Cloud (3of3)
Cloud Architecture Tutorial - Running in the Cloud (3of3)
 
How to Set Up ApsaraDB for RDS on Alibaba Cloud
How to Set Up ApsaraDB for RDS on Alibaba CloudHow to Set Up ApsaraDB for RDS on Alibaba Cloud
How to Set Up ApsaraDB for RDS on Alibaba Cloud
 
Serverlessusecase workshop feb3_v2
Serverlessusecase workshop feb3_v2Serverlessusecase workshop feb3_v2
Serverlessusecase workshop feb3_v2
 
Serverless Architecture Patterns
Serverless Architecture PatternsServerless Architecture Patterns
Serverless Architecture Patterns
 
serverless_architecture_patterns_london_loft.pdf
serverless_architecture_patterns_london_loft.pdfserverless_architecture_patterns_london_loft.pdf
serverless_architecture_patterns_london_loft.pdf
 
(DAT303) Oracle on AWS and Amazon RDS: Secure, Fast, and Scalable
(DAT303) Oracle on AWS and Amazon RDS: Secure, Fast, and Scalable(DAT303) Oracle on AWS and Amazon RDS: Secure, Fast, and Scalable
(DAT303) Oracle on AWS and Amazon RDS: Secure, Fast, and Scalable
 
(DAT202) Managed Database Options on AWS
(DAT202) Managed Database Options on AWS(DAT202) Managed Database Options on AWS
(DAT202) Managed Database Options on AWS
 
EC2 BY RASHMI GR.pptx
EC2  BY RASHMI GR.pptxEC2  BY RASHMI GR.pptx
EC2 BY RASHMI GR.pptx
 
[よくわかるAmazon Redshift]Amazon Redshift最新情報と導入事例のご紹介
[よくわかるAmazon Redshift]Amazon Redshift最新情報と導入事例のご紹介[よくわかるAmazon Redshift]Amazon Redshift最新情報と導入事例のご紹介
[よくわかるAmazon Redshift]Amazon Redshift最新情報と導入事例のご紹介
 
AWS re:Invent 2013 Recap
AWS re:Invent 2013 RecapAWS re:Invent 2013 Recap
AWS re:Invent 2013 Recap
 
Introduction to Amazon Relational Database Service
Introduction to Amazon Relational Database ServiceIntroduction to Amazon Relational Database Service
Introduction to Amazon Relational Database Service
 

More from DataStax Academy

Cassandra on Docker @ Walmart Labs
Cassandra on Docker @ Walmart LabsCassandra on Docker @ Walmart Labs
Cassandra on Docker @ Walmart Labs
DataStax Academy
 
Cassandra Adoption on Cisco UCS & Open stack
Cassandra Adoption on Cisco UCS & Open stackCassandra Adoption on Cisco UCS & Open stack
Cassandra Adoption on Cisco UCS & Open stack
DataStax Academy
 
Cassandra @ Netflix: Monitoring C* at Scale, Gossip and Tickler & Python
Cassandra @ Netflix: Monitoring C* at Scale, Gossip and Tickler & PythonCassandra @ Netflix: Monitoring C* at Scale, Gossip and Tickler & Python
Cassandra @ Netflix: Monitoring C* at Scale, Gossip and Tickler & Python
DataStax Academy
 
Standing Up Your First Cluster
Standing Up Your First ClusterStanding Up Your First Cluster
Standing Up Your First Cluster
DataStax Academy
 
Real Time Analytics with Dse
Real Time Analytics with DseReal Time Analytics with Dse
Real Time Analytics with Dse
DataStax Academy
 
Introduction to Data Modeling with Apache Cassandra
Introduction to Data Modeling with Apache CassandraIntroduction to Data Modeling with Apache Cassandra
Introduction to Data Modeling with Apache Cassandra
DataStax Academy
 
Enabling Search in your Cassandra Application with DataStax Enterprise
Enabling Search in your Cassandra Application with DataStax EnterpriseEnabling Search in your Cassandra Application with DataStax Enterprise
Enabling Search in your Cassandra Application with DataStax Enterprise
DataStax Academy
 
Advanced Data Modeling with Apache Cassandra
Advanced Data Modeling with Apache CassandraAdvanced Data Modeling with Apache Cassandra
Advanced Data Modeling with Apache Cassandra
DataStax Academy
 

More from DataStax Academy (20)

Forrester CXNYC 2017 - Delivering great real-time cx is a true craft
Forrester CXNYC 2017 - Delivering great real-time cx is a true craftForrester CXNYC 2017 - Delivering great real-time cx is a true craft
Forrester CXNYC 2017 - Delivering great real-time cx is a true craft
 
Introduction to DataStax Enterprise Graph Database
Introduction to DataStax Enterprise Graph DatabaseIntroduction to DataStax Enterprise Graph Database
Introduction to DataStax Enterprise Graph Database
 
Introduction to DataStax Enterprise Advanced Replication with Apache Cassandra
Introduction to DataStax Enterprise Advanced Replication with Apache CassandraIntroduction to DataStax Enterprise Advanced Replication with Apache Cassandra
Introduction to DataStax Enterprise Advanced Replication with Apache Cassandra
 
Cassandra on Docker @ Walmart Labs
Cassandra on Docker @ Walmart LabsCassandra on Docker @ Walmart Labs
Cassandra on Docker @ Walmart Labs
 
Cassandra 3.0 Data Modeling
Cassandra 3.0 Data ModelingCassandra 3.0 Data Modeling
Cassandra 3.0 Data Modeling
 
Cassandra Adoption on Cisco UCS & Open stack
Cassandra Adoption on Cisco UCS & Open stackCassandra Adoption on Cisco UCS & Open stack
Cassandra Adoption on Cisco UCS & Open stack
 
Data Modeling for Apache Cassandra
Data Modeling for Apache CassandraData Modeling for Apache Cassandra
Data Modeling for Apache Cassandra
 
Coursera Cassandra Driver
Coursera Cassandra DriverCoursera Cassandra Driver
Coursera Cassandra Driver
 
Production Ready Cassandra
Production Ready CassandraProduction Ready Cassandra
Production Ready Cassandra
 
Cassandra @ Netflix: Monitoring C* at Scale, Gossip and Tickler & Python
Cassandra @ Netflix: Monitoring C* at Scale, Gossip and Tickler & PythonCassandra @ Netflix: Monitoring C* at Scale, Gossip and Tickler & Python
Cassandra @ Netflix: Monitoring C* at Scale, Gossip and Tickler & Python
 
Cassandra @ Sony: The good, the bad, and the ugly part 1
Cassandra @ Sony: The good, the bad, and the ugly part 1Cassandra @ Sony: The good, the bad, and the ugly part 1
Cassandra @ Sony: The good, the bad, and the ugly part 1
 
Cassandra @ Sony: The good, the bad, and the ugly part 2
Cassandra @ Sony: The good, the bad, and the ugly part 2Cassandra @ Sony: The good, the bad, and the ugly part 2
Cassandra @ Sony: The good, the bad, and the ugly part 2
 
Standing Up Your First Cluster
Standing Up Your First ClusterStanding Up Your First Cluster
Standing Up Your First Cluster
 
Real Time Analytics with Dse
Real Time Analytics with DseReal Time Analytics with Dse
Real Time Analytics with Dse
 
Introduction to Data Modeling with Apache Cassandra
Introduction to Data Modeling with Apache CassandraIntroduction to Data Modeling with Apache Cassandra
Introduction to Data Modeling with Apache Cassandra
 
Cassandra Core Concepts
Cassandra Core ConceptsCassandra Core Concepts
Cassandra Core Concepts
 
Enabling Search in your Cassandra Application with DataStax Enterprise
Enabling Search in your Cassandra Application with DataStax EnterpriseEnabling Search in your Cassandra Application with DataStax Enterprise
Enabling Search in your Cassandra Application with DataStax Enterprise
 
Bad Habits Die Hard
Bad Habits Die Hard Bad Habits Die Hard
Bad Habits Die Hard
 
Advanced Data Modeling with Apache Cassandra
Advanced Data Modeling with Apache CassandraAdvanced Data Modeling with Apache Cassandra
Advanced Data Modeling with Apache Cassandra
 
Advanced Cassandra
Advanced CassandraAdvanced Cassandra
Advanced Cassandra
 

Recently uploaded

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 

Cassandra Summit 2014: Cassandra Compute Cloud: An elastic Cassandra Infrastructure

  • 1. Cassandra Compute Cloud An Elastic Cassandra Infrastructure Gurashish Singh Brar Member of Technical Staff @ BloomReach
  • 2. Abstract Dynamically scaling Cassandra to serve hundreds of map-reduce jobs that come at an unpredictable rate and at the same time providing access to the data in real time to front-end application with strict TP95 latency guarantees is a hard problem. We present a system for managing Cassandra clusters which provide following functionality: 1) Dynamic scaling of capacity to serve high throughput map-reduce jobs 2) Provide access to data generated by map-reduce jobs in realtime to front-end applications while providing latency SLAs for TP95 3) Maintain a low cost by leveraging Amazon Spot Instances and through demand based scaling. At the heart of this infrastructure lies a custom data replication service that makes it possible to stream data to new nodes as needed
  • 3. What is it about ? • Dynamically scaling the infrastructure to support large EMR jobs • Throughput SLA to backend applications • TP95 latency SLA to frontend applications • Cassandra 2.0 using vnodes
  • 4. Agenda • Application requirements • Major issues we encountered • Solutions to the issues
  • 5. Application Requirements • Backend EMR jobs performing scans, lookups and writes Heterogeneous applications with varying degree of throughput SLAs. Very high peak loads Always available (no maintenance periods or planned downtimes) • Frontend applications performing lookups Data from backend applications expected in realtime Low latencies • Developer support
  • 6. How we started Frontend Applications Frontend DC Backend DC Cassandra Cluster EMR Jobs
  • 7. Frontend isolation using multiple DCs Frontend DC Cassandra Cluster Backend DC
  • 8. Frontend Issue: Spillover Reads Frontend DC Cassandra Cluster Backend DC
  • 9. Frontend Issue: Latencies vs Replication load Frontend Applications Cassandra Cluster Frontend DC Backend DC EMR Jobs
  • 10. Backend Issue: Fixed resource Backend DC Cassandra Cluster EMR Jobs EMR Jobs
  • 11. Backend Issue: Fixed Resource Cassandra Cluster Backend DC EMR Jobs EMR Jobs EMR Jobs EMR Jobs EMR Jobs EMR Jobs EMR Jobs EMR Jobs
  • 12. Backend Issue: Starvation Backend DC Cassandra Cluster Large EMR Jobs with relaxed SLA Small EMR job with tighter SLA
  • 13. Summary of Issues • Frontend isolation is not perfect • Frontend latencies are impacted by backend write load • EMR jobs can overwhelm the Cassandra cluster • Large EMR jobs can starve smaller ones
  • 14. Rate Limiter Frontend Applications Frontend DC Backend DC Cassandra Cluster EMR Jobs Token Server (Redis)
  • 15. Rate Limiter • QPS allocated on per operation and application level • Operations can be: scans, reads, writes, prepare, alter, create … etc • Each mapper/reducer obtains permits for 1 minute (configurable). • The token bucket is periodically refreshed with allocated capacity • Quotas are dynamically adjusted to take advantage of unused quotas of applications ( We do want to maximize the cluster usage)
  • 16. Why Redis ? • High load from all EMR nodes • Low latency • Support high number of concurrent connections • Support atomic fetch and add
  • 17. Cost of Rate Limiter • We converted EMR from an elastic resource to a fixed resource • To scale EMR we have to scale Cassandra • Adding capacity to Cassandra cluster is not trivial • Adding capacity under heavy load is harder • Auto scaling and reducing under heavy load is even harder
  • 18. Managing capacity - Requirements • Time to increase capacity should be in minutes • Programmatic management and not manual • Minimum load on the production cluster during the operation
  • 19. C* increasing capacity C* Cluster Adding nodes is expensive
  • 20. C* increasing capacity C* Cluster C* Sol: Replicate to a Cluster new cluster
  • 21. Custom Replication Service Source Cluster Destination Cluster SSTable file copy
  • 23. Custom Replication Service • Replication Service (source node) takes snapshot of column family • SSTables in snapshot are evenly streamed on destination cluster • Replication Service (destination node) splits a single source SSTable to N SSTables • Splits computed using SSTableReader & SSTableWriter classes. A single SSTable can be split in parallel by multiple threads
  • 24. Custom Replication Service • Once split the new SSTables are streamed to correct destination nodes • Rolling restart is initiated on the destination cluster (we could have used nodetool refresh, but it was unreliable) • The cluster is ready for use • In parallel trigger compaction on destination cluster for optimizing reads
  • 25. Cluster Provisioning • Estimate the required cluster size based on column family disk size on source cluster • Provision machines on AWS (Cassandra is pre-installed on AMI , so no setup required) • Generate yaml and topology file with the new cluster and create a backend datacenter (Application agnostic) • Copy schema from source cluster to destination cluster • Call replication service on source cluster to replicate data
  • 26. C* Compute Cloud Source Cluster Cluster Management service On-demand cluster On-demand cluster On-demand cluster On-demand cluster EMR Jobs
  • 27. C* Compute Cloud • Very high throughput in moving raw data from source to destination cluster (10 X increase in network usage compared to normal) • Little CPU/Memory load on the source cluster • Leverage the size of destination cluster to compute new SSTables for the new ring • Time to provision varies between 10 minutes to 40 minutes • API driven so automatically scales up and down with demand • Application agnostic
  • 28. C* Compute Cloud - Limitations • Snapshot model : Take a snapshot of production and operate on it This works really well for some use cases, good for most, but not all • Provisioning time order of minutes Works for EMR jobs which themselves take few minutes to provision but does not work for dedicated backend applications • Writes still need to happen on production reserved cluster
  • 29. Where we are now Frontend Applications Frontend DC Backend DC Cassandra Cluster EMR Jobs On-demand cluster Token Server (Redis) On-demand cluster On-demand cluster Replication Cluster Management service
  • 30. Exploiting the C* compute cloud • Key feature: Easy, automated and fast cluster provisioning with production data • Use Spot Instances instead of On-Demand • Failures in few nodes are survivable due to C* redundancy • In case of too many failures, just rebuild on retry (its fast ! & automatic)
  • 31. Spot Instances • Service supports all instance types in AWS and all AZs • Pick the optimal Spot Instance type & AZ that is the cheapest and satisfies the constraints • Further reduces cost and improves reliability of the service • If r3.2xlarge spot price spikes on retry service might pick c3.8xlarge • Auto expire clusters to adjust automatically to cheaper instances
  • 32. Cost or Capacity (take your pick) Capacity of C* compute cloud on spot instances ~= (5 to 10) X C* cluster using on-demand instances for same $ value
  • 33. Issues Addressed • Backend Read Capacity can scale linearly with C* compute cloud • Frontend latencies are protected from write load through rate limit
  • 34. Remaining issues • Read load on backend DC can spillover to frontend DC causing spikes • Write capacity is still defined by frontend latencies
  • 35. Issue: Spillover Reads Frontend DC Cassandra Cluster Backend DC
  • 36. Spillover Reads Fix: Fail the read Frontend DC Cassandra Cluster Backend DC X
  • 37. Addressing the Write Capacity • The obvious : Only push the updates that are new and not the same Big improvement, 80-90% data did not change • Add more nodes : With the backend read load off production it is lot easier to expand capacity • But we are still operating at ~ 3rd or 5th the write capacity to keep read latencies low
  • 38. Addressing the Write Capacity • Experimental changes under evaluation • Prioritize reads over writes on frontend Pause write stage during a read • Reduce replication load to frontend DC from backend DC ColumnLevel replication strategy Most frontend applications operate on a subset view of backend data
  • 39. Key Takeaways • Scale Cassandra dynamically for backend load by creating snapshot clusters • Use rate limiter to protect the production cluster from spiky and unexpected backend traffic • Build better isolation between frontend DC and backend DC • Writes throughput from backend to frontend is a challenge