SlideShare une entreprise Scribd logo
1  sur  39
Télécharger pour lire hors ligne
Running Cassandra on
Amazon’s ECS



Anirvan Chakraborty 

@anirvan_c 

© 2016 Anirvan Chakraborty CC BY-NC-SA 4.0
Agenda
• Motivation
• Docker
• Cassandra
• Cassandra on Docker best practices
• EC2 Container Service ECS
• Cassandra on ECS
© 2016 Anirvan Chakraborty CC BY-NC-SA 4.0
Motivation
© 2016 Anirvan Chakraborty CC BY-NC-SA 4.0
Motivation
• Ease of development
• Support polyglot languages, frameworks and
components
• Operational simplicity
• Quick feedback loop
© 2016 Anirvan Chakraborty CC BY-NC-SA 4.0
Docker
© 2016 Anirvan Chakraborty CC BY-NC-SA 4.0
Docker history
• Came out of dotCloud, a PaaS company
• Was originally written in Python
• Got re-written in Golang in Feb, 2013
• Docker 0.1 was released on Mar, 2013
• Docker 1.11.1 is the latest release
© 2016 Anirvan Chakraborty CC BY-NC-SA 4.0
Docker tag line
Build, ship and run any app, anywhere
© 2016 Anirvan Chakraborty CC BY-NC-SA 4.0
Docker tag line
• Build: package your application in a container
• Ship: move it between machines
• Run: execute that container with your application
• Any application: as long as it runs on Linux
• Anywhere: local VM, bare metal, cloud instances
© 2016 Anirvan Chakraborty CC BY-NC-SA 4.0
Why Docker?
• Deploy reliably & consistently
• Execution is fast and light weight
• Simplicity
• Developer friendly workflow
• Fantastic community
© 2016 Anirvan Chakraborty CC BY-NC-SA 4.0
Apache Cassandra
© 2016 Anirvan Chakraborty CC BY-NC-SA 4.0
What is Apache Cassandra?
• Fast distributed database
• High Availability
• Linear Scalability
• Predictable performance
• No single point of failure
• Multi-DC
• Easy to manage
• Can use commodity hardware
• Not a drop in replacement for RDBMS
© 2016 Anirvan Chakraborty CC BY-NC-SA 4.0
Hash ring
• Data is partitioned around the ring
• Location of data in ring is determined by
partition key
• Data is replicated to N servers based on RF
• All nodes hold data and can answer read or
write queries
source: https://academy.datastax.com/courses/ds101-introduction-cassandra/introduction-cassandra-overview
© 2016 Anirvan Chakraborty CC BY-NC-SA 4.0
CAP Tradeoff
• During network partition it is impossible to be
both consistent and highly available
• Latency between data centres also makes
consistency impractical
• Cassandra chooses Availability & Partition tolerance
over Consistency
© 2016 Anirvan Chakraborty CC BY-NC-SA 4.0
Replication
• Choose “replication factor” or RF
• Data is always replicated to each replica
• If node is down, missing data is replayed via hinted
handoff
source: https://academy.datastax.com/courses/ds101-introduction-cassandra/introduction-cassandra-overview
© 2016 Anirvan Chakraborty CC BY-NC-SA 4.0
Consistency level
source: https://academy.datastax.com/courses/ds101-introduction-cassandra/introduction-cassandra-overview
• Per query consistency
• ALL, QUORUM, ONE
• How many replicas to respond OK for query to
succeed
© 2016 Anirvan Chakraborty CC BY-NC-SA 4.0
Cassandra on Docker
© 2016 Anirvan Chakraborty CC BY-NC-SA 4.0
Dockerize C* Dev Environment
• Make it run as slow, but as stable as possible!
• Super low memory settings in cassandra-env.sh
• MAX_HEAP_SIZE=“128M”
• HEAP_NEWSIZE=“24M”
• Remove caches in dev mode in cassandra.yml
• key_cache_size_in_mb: 0
• reduce_cache_sizes_at: 0
• reduce_cache_capacity_to: 0
© 2016 Anirvan Chakraborty CC BY-NC-SA 4.0
Dockerize C* Production
• Use host networking (—net=host) for better
network performance
• Put data, commitlog and saved_caches in volume
mount folders to the underlying host
• Run cassandra on the foreground using (-f)
• Tune JVM heap for optimal size
• Tune JVM garbage collector for your workload
© 2016 Anirvan Chakraborty CC BY-NC-SA 4.0
Amazon EC2
Container Service
© 2016 Anirvan Chakraborty CC BY-NC-SA 4.0
What is ECS?
…is a highly scalable, fast, container
management service that makes it easy to
run, stop, and manage Docker containers
on a cluster of Amazon EC2 instances.
http://docs.aws.amazon.com/AmazonECS/latest/developerguide/Welcome.html
© 2016 Anirvan Chakraborty CC BY-NC-SA 4.0
What is ECS?
Amazon Docker as a Service
https://www.expeditedssl.com/aws-in-plain-english
© 2016 Anirvan Chakraborty CC BY-NC-SA 4.0
How does ECS work?
http://www.allthingsdistributed.com/2015/07/under-the-hood-of-the-amazon-ec2-container-service.html
© 2016 Anirvan Chakraborty CC BY-NC-SA 4.0
Cluster
http://www.allthingsdistributed.com/2015/07/under-the-hood-of-the-amazon-ec2-container-service.html
© 2016 Anirvan Chakraborty CC BY-NC-SA 4.0
Container Instance
http://www.allthingsdistributed.com/2015/07/under-the-hood-of-the-amazon-ec2-container-service.html
© 2016 Anirvan Chakraborty CC BY-NC-SA 4.0
ECS Agent
http://www.allthingsdistributed.com/2015/07/under-the-hood-of-the-amazon-ec2-container-service.html
© 2016 Anirvan Chakraborty CC BY-NC-SA 4.0
Task
http://www.allthingsdistributed.com/2015/07/under-the-hood-of-the-amazon-ec2-container-service.html
© 2016 Anirvan Chakraborty CC BY-NC-SA 4.0
Task
http://www.allthingsdistributed.com/2015/07/under-the-hood-of-the-amazon-ec2-container-service.html
{
"containerDefinitions": [
{
"name": "wordpress",
"links": [
"mysql"
],
"image": "wordpress",
"essential": true,
"portMappings": [
{
"containerPort": 80,
"hostPort": 80
}
],
"memory": 500,
"cpu": 10
},
{
"name": "mysql",
"image": "mysql",
"cpu": 10,
"memory": 500,
"essential": true
}
],
"family": "hello_world"
}Task definition
Docker Container
Docker Container
© 2016 Anirvan Chakraborty CC BY-NC-SA 4.0
Service
http://www.allthingsdistributed.com/2015/07/under-the-hood-of-the-amazon-ec2-container-service.html
© 2016 Anirvan Chakraborty CC BY-NC-SA 4.0
ECS Service
http://www.allthingsdistributed.com/2015/07/under-the-hood-of-the-amazon-ec2-container-service.html
© 2016 Anirvan Chakraborty CC BY-NC-SA 4.0
Typical ECS workflow
• Build Docker image using whatever you want
• Push image to registry
• Create JSON file describing your task definition
• Register this task definition with ECS
• Make sure that your cluster has enough resources
• Start a new task from the task definition
© 2016 Anirvan Chakraborty CC BY-NC-SA 4.0
Cassandra on ECS
© 2016 Anirvan Chakraborty CC BY-NC-SA 4.0
Dockerize C* on ECS
• Simple service discovery using ECS API
• Custom Dockerfile and entry-point script to
control Cassandra configuration
• Cleanup downed node and repair cluster on
node startup
© 2016 Anirvan Chakraborty CC BY-NC-SA 4.0
Service Discovery
Using
• AWS EC2 API
• AWS ECS API
• AWS Metadata URL
1. Find all running tasks for a cluster
2.Find EC2 instance ids for the tasks
3.Find private IP addresses for the container
instances
© 2016 Anirvan Chakraborty CC BY-NC-SA 4.0
Custom Dockerfile
• Expose Cassandra configuration parameters as
Docker environment variables
• Update entry-point script to use Docker
environment variables to configure Cassandra
© 2016 Anirvan Chakraborty CC BY-NC-SA 4.0
Node Startup
1. Find the IPs of all running seed nodes
2.Check and identify any downed nodes in the
cluster nodetool status
3.Remove the downed nodes nodetool remove
4.Repair the cluster nodetool repair
5.Start a new Cassandra node
© 2016 Anirvan Chakraborty CC BY-NC-SA 4.0
Work in progress
© 2016 Anirvan Chakraborty CC BY-NC-SA 4.0
Where to next?
• Open source C* Dockerfile & entry-point script
• Use Consul for Service Discovery in ECS
• Consider Flocker for managing volumes with
Dockerized C*
• Consider Weave for forming C* cluster across
network domains
© 2016 Anirvan Chakraborty CC BY-NC-SA 4.0
Thanks!
Twitter: @cakesolutions

Tel: 0845 617 1200
Email: enquiries@cakesolutions.net
Jobs: http://www.cakesolutions.net/
careers
© 2016 Anirvan Chakraborty CC BY-NC-SA 4.0
Resources
https://academy.datastax.com/courses/ds101-introduction-cassandra
http://www.allthingsdistributed.com/2015/07/under-the-hood-of-the-amazon-ec2-
container-service.html
http://docs.aws.amazon.com/AmazonECS/latest/developerguide/Welcome.html
https://www.expeditedssl.com/aws-in-plain-english
https://github.com/aws/amazon-ecs-agent
https://blog.docker.com/2015/03/why-i-love-docker-and-why-youll-love-it-too/
http://www.datastax.com/resources/whitepapers/best-practices-running-datastax-
enterprise-within-docker

Contenu connexe

Dernier

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 

Dernier (20)

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 

En vedette

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 

En vedette (20)

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 

Atmosphere 2016 - Anirvan Chakraborty - Running Cassandra on Amazon's ECS

  • 1. Running Cassandra on Amazon’s ECS
 
 Anirvan Chakraborty 
 @anirvan_c 

  • 2. © 2016 Anirvan Chakraborty CC BY-NC-SA 4.0 Agenda • Motivation • Docker • Cassandra • Cassandra on Docker best practices • EC2 Container Service ECS • Cassandra on ECS
  • 3. © 2016 Anirvan Chakraborty CC BY-NC-SA 4.0 Motivation
  • 4. © 2016 Anirvan Chakraborty CC BY-NC-SA 4.0 Motivation • Ease of development • Support polyglot languages, frameworks and components • Operational simplicity • Quick feedback loop
  • 5. © 2016 Anirvan Chakraborty CC BY-NC-SA 4.0 Docker
  • 6. © 2016 Anirvan Chakraborty CC BY-NC-SA 4.0 Docker history • Came out of dotCloud, a PaaS company • Was originally written in Python • Got re-written in Golang in Feb, 2013 • Docker 0.1 was released on Mar, 2013 • Docker 1.11.1 is the latest release
  • 7. © 2016 Anirvan Chakraborty CC BY-NC-SA 4.0 Docker tag line Build, ship and run any app, anywhere
  • 8. © 2016 Anirvan Chakraborty CC BY-NC-SA 4.0 Docker tag line • Build: package your application in a container • Ship: move it between machines • Run: execute that container with your application • Any application: as long as it runs on Linux • Anywhere: local VM, bare metal, cloud instances
  • 9. © 2016 Anirvan Chakraborty CC BY-NC-SA 4.0 Why Docker? • Deploy reliably & consistently • Execution is fast and light weight • Simplicity • Developer friendly workflow • Fantastic community
  • 10. © 2016 Anirvan Chakraborty CC BY-NC-SA 4.0 Apache Cassandra
  • 11. © 2016 Anirvan Chakraborty CC BY-NC-SA 4.0 What is Apache Cassandra? • Fast distributed database • High Availability • Linear Scalability • Predictable performance • No single point of failure • Multi-DC • Easy to manage • Can use commodity hardware • Not a drop in replacement for RDBMS
  • 12. © 2016 Anirvan Chakraborty CC BY-NC-SA 4.0 Hash ring • Data is partitioned around the ring • Location of data in ring is determined by partition key • Data is replicated to N servers based on RF • All nodes hold data and can answer read or write queries source: https://academy.datastax.com/courses/ds101-introduction-cassandra/introduction-cassandra-overview
  • 13. © 2016 Anirvan Chakraborty CC BY-NC-SA 4.0 CAP Tradeoff • During network partition it is impossible to be both consistent and highly available • Latency between data centres also makes consistency impractical • Cassandra chooses Availability & Partition tolerance over Consistency
  • 14. © 2016 Anirvan Chakraborty CC BY-NC-SA 4.0 Replication • Choose “replication factor” or RF • Data is always replicated to each replica • If node is down, missing data is replayed via hinted handoff source: https://academy.datastax.com/courses/ds101-introduction-cassandra/introduction-cassandra-overview
  • 15. © 2016 Anirvan Chakraborty CC BY-NC-SA 4.0 Consistency level source: https://academy.datastax.com/courses/ds101-introduction-cassandra/introduction-cassandra-overview • Per query consistency • ALL, QUORUM, ONE • How many replicas to respond OK for query to succeed
  • 16. © 2016 Anirvan Chakraborty CC BY-NC-SA 4.0 Cassandra on Docker
  • 17. © 2016 Anirvan Chakraborty CC BY-NC-SA 4.0 Dockerize C* Dev Environment • Make it run as slow, but as stable as possible! • Super low memory settings in cassandra-env.sh • MAX_HEAP_SIZE=“128M” • HEAP_NEWSIZE=“24M” • Remove caches in dev mode in cassandra.yml • key_cache_size_in_mb: 0 • reduce_cache_sizes_at: 0 • reduce_cache_capacity_to: 0
  • 18. © 2016 Anirvan Chakraborty CC BY-NC-SA 4.0 Dockerize C* Production • Use host networking (—net=host) for better network performance • Put data, commitlog and saved_caches in volume mount folders to the underlying host • Run cassandra on the foreground using (-f) • Tune JVM heap for optimal size • Tune JVM garbage collector for your workload
  • 19. © 2016 Anirvan Chakraborty CC BY-NC-SA 4.0 Amazon EC2 Container Service
  • 20. © 2016 Anirvan Chakraborty CC BY-NC-SA 4.0 What is ECS? …is a highly scalable, fast, container management service that makes it easy to run, stop, and manage Docker containers on a cluster of Amazon EC2 instances. http://docs.aws.amazon.com/AmazonECS/latest/developerguide/Welcome.html
  • 21. © 2016 Anirvan Chakraborty CC BY-NC-SA 4.0 What is ECS? Amazon Docker as a Service https://www.expeditedssl.com/aws-in-plain-english
  • 22. © 2016 Anirvan Chakraborty CC BY-NC-SA 4.0 How does ECS work? http://www.allthingsdistributed.com/2015/07/under-the-hood-of-the-amazon-ec2-container-service.html
  • 23. © 2016 Anirvan Chakraborty CC BY-NC-SA 4.0 Cluster http://www.allthingsdistributed.com/2015/07/under-the-hood-of-the-amazon-ec2-container-service.html
  • 24. © 2016 Anirvan Chakraborty CC BY-NC-SA 4.0 Container Instance http://www.allthingsdistributed.com/2015/07/under-the-hood-of-the-amazon-ec2-container-service.html
  • 25. © 2016 Anirvan Chakraborty CC BY-NC-SA 4.0 ECS Agent http://www.allthingsdistributed.com/2015/07/under-the-hood-of-the-amazon-ec2-container-service.html
  • 26. © 2016 Anirvan Chakraborty CC BY-NC-SA 4.0 Task http://www.allthingsdistributed.com/2015/07/under-the-hood-of-the-amazon-ec2-container-service.html
  • 27. © 2016 Anirvan Chakraborty CC BY-NC-SA 4.0 Task http://www.allthingsdistributed.com/2015/07/under-the-hood-of-the-amazon-ec2-container-service.html { "containerDefinitions": [ { "name": "wordpress", "links": [ "mysql" ], "image": "wordpress", "essential": true, "portMappings": [ { "containerPort": 80, "hostPort": 80 } ], "memory": 500, "cpu": 10 }, { "name": "mysql", "image": "mysql", "cpu": 10, "memory": 500, "essential": true } ], "family": "hello_world" }Task definition Docker Container Docker Container
  • 28. © 2016 Anirvan Chakraborty CC BY-NC-SA 4.0 Service http://www.allthingsdistributed.com/2015/07/under-the-hood-of-the-amazon-ec2-container-service.html
  • 29. © 2016 Anirvan Chakraborty CC BY-NC-SA 4.0 ECS Service http://www.allthingsdistributed.com/2015/07/under-the-hood-of-the-amazon-ec2-container-service.html
  • 30. © 2016 Anirvan Chakraborty CC BY-NC-SA 4.0 Typical ECS workflow • Build Docker image using whatever you want • Push image to registry • Create JSON file describing your task definition • Register this task definition with ECS • Make sure that your cluster has enough resources • Start a new task from the task definition
  • 31. © 2016 Anirvan Chakraborty CC BY-NC-SA 4.0 Cassandra on ECS
  • 32. © 2016 Anirvan Chakraborty CC BY-NC-SA 4.0 Dockerize C* on ECS • Simple service discovery using ECS API • Custom Dockerfile and entry-point script to control Cassandra configuration • Cleanup downed node and repair cluster on node startup
  • 33. © 2016 Anirvan Chakraborty CC BY-NC-SA 4.0 Service Discovery Using • AWS EC2 API • AWS ECS API • AWS Metadata URL 1. Find all running tasks for a cluster 2.Find EC2 instance ids for the tasks 3.Find private IP addresses for the container instances
  • 34. © 2016 Anirvan Chakraborty CC BY-NC-SA 4.0 Custom Dockerfile • Expose Cassandra configuration parameters as Docker environment variables • Update entry-point script to use Docker environment variables to configure Cassandra
  • 35. © 2016 Anirvan Chakraborty CC BY-NC-SA 4.0 Node Startup 1. Find the IPs of all running seed nodes 2.Check and identify any downed nodes in the cluster nodetool status 3.Remove the downed nodes nodetool remove 4.Repair the cluster nodetool repair 5.Start a new Cassandra node
  • 36. © 2016 Anirvan Chakraborty CC BY-NC-SA 4.0 Work in progress
  • 37. © 2016 Anirvan Chakraborty CC BY-NC-SA 4.0 Where to next? • Open source C* Dockerfile & entry-point script • Use Consul for Service Discovery in ECS • Consider Flocker for managing volumes with Dockerized C* • Consider Weave for forming C* cluster across network domains
  • 38. © 2016 Anirvan Chakraborty CC BY-NC-SA 4.0 Thanks! Twitter: @cakesolutions
 Tel: 0845 617 1200 Email: enquiries@cakesolutions.net Jobs: http://www.cakesolutions.net/ careers
  • 39. © 2016 Anirvan Chakraborty CC BY-NC-SA 4.0 Resources https://academy.datastax.com/courses/ds101-introduction-cassandra http://www.allthingsdistributed.com/2015/07/under-the-hood-of-the-amazon-ec2- container-service.html http://docs.aws.amazon.com/AmazonECS/latest/developerguide/Welcome.html https://www.expeditedssl.com/aws-in-plain-english https://github.com/aws/amazon-ecs-agent https://blog.docker.com/2015/03/why-i-love-docker-and-why-youll-love-it-too/ http://www.datastax.com/resources/whitepapers/best-practices-running-datastax- enterprise-within-docker