SlideShare una empresa de Scribd logo
1 de 26
Descargar para leer sin conexión
Overview of
Cassandra
Outline
● History/motivation
● Semi structured data in Cassandra
  ○ CFs and SuperCFs
● Architecture of Cassandra system
  ○   Distribution of content
  ○   Replication of content
  ○   Consistency level
  ○   Node internals
  ○   Gossip
● Thrift API
● Design patterns - denormalization
History/motivation
● Initially developed by facebook for Inbox
  Search
  ○ in late 2007/early 2008
● Designed for
  ○ node failure - commodity hardware
  ○ scale - can increase number of nodes easily to
    accommodate increasing demand
  ○ fast write access while delivering good read
    performance
● Combination of Bigtable and Dynamo
● Was operational for over 2 years
  ○ Dropped in favour of HBase
History/motivation
● Released as open source in July 2008
● Apache liked it
  ○ Became Apache Incubator project in March 2009
  ○ Became Apache top level project in Feb 2010
● Active project with releases every few
  months
  ○ currently on version 1.1
    ■ production ready, but still evolving
Why it's interesting (in this
context)...
● Has seen significant growth in last couple of
  years
● Enough deployments to be credible
   ○ Netflix, Ooyala, Digg, Cisco,
● Is scalable and robust enough for big data
  problems
   ○ no single point of failure
● Complex system
   ○ perhaps excessively complex today
Cassandra - semi
structured data
● Column based database
  ○ has similarities to standard RDBMS
● Terminology:
  ○ Keystore -> database
  ○ ColumnFamily -> table
Cassandra - semi
structured data
● No specific schema is required
  ○ although it is possible to define schema
    ■ can include typing information for parts of
        schema to minimize data integrity problems
● Rows can have large numbers of columns
  ○ limit on number of columns is 2B
● Column values should not exceed some MB
● SuperColumns are columns embedded
  within columns
  ○ third level in a map
  ○ little discussion of SC here
Supercolumns depicted
Cassandra - secondary
indexing
● Columns can be indexed
  ○ so-called 'secondary indexing'
    ■ row keys form the primary index
● Some debate abt the merits of secondary
  indexing in cassandra
  ○ secondary indexing is an atomic operation
    ■ unlike alternative 'manual' indexing approach
  ○ causes change in thinking regarding NoSQL design
    ■ very similar to classical RDBMS thinking
Cassandra Architecture
● Cluster configuration typical
● All nodes peers
   ○ although there are some seeds which should be
     more reliable, larger nodes
● Peers have common view of tokenspace
   ○ tokenspace is a ring
      ■ of size 2^127
   ○ peers have responsibility for some part of ring
      ■ ie some range of tokens within ring
● Row key/keyspace mapped to token
   ○ used to determine which node is responsible for row
     data
Cassandra - Cluster and
Tokenspace
Cassandra - Data
Distribution
● Map from RowKey to token determines data
  distribution
● RandomPartitioner is most important map
  ○   generates MD5 hash of rowkey
  ○   distributes data evenly over nodes in cluster
  ○   highly preferred solution
  ○   constraint that it is not possible to iterate over rows
● OrderedPartitioner
  ○ generates token based on simply byte mapping of
    row key
  ○ most probably results in uneven distribution of data
  ○ can be used to iterate over rows
Cassandra - Data
Replication
● Multiple levels of replication supported
   ○ can support arbitrary level of replication
   ○ replication factors specified per keyspace
● Two replication strategies
   ○ RackUnaware
     ■ Make replicas in next n nodes along token ring
   ○ RackAware
     ■ Makes one replica in remote data centre
     ■ Make remaining replicas in next nodes along
       token ring
          ●   good ring configuration should result in diversity over data
              centres
Cassandra - Consistency
Level
● A mechanism to trade off latency with data
  consistency
  ○ Write case:
    ■ Faster response <-> less sure data written
       properly
  ○ Read case:
    ■ Faster response <-> less sure most recent data
       read
● Related to data replication above
  ○ replication factor determines meaningful levels for
    consistency level
Cassandra - Consistency
  Level - Write
Level     Behavior
ANY       Ensure that the write has been written to at least 1 node, including HintedHandoff recipients.
ONE       Ensure that the write has been written to at least 1 replica's commit log and memory table
          before responding to the client.
TWO       Ensure that the write has been written to at least 2 replica's before responding to the client.
THREE     Ensure that the write has been written to at least 3 replica's before responding to the client.
QUORUM    Ensure that the write has been written to N / 2 + 1 replicas before responding to the client.
LOCAL_Q   Ensure that the write has been written to <ReplicationFactor> / 2 + 1 nodes, within the local
UORUM     datacenter (requires NetworkTopologyStrategy)
EACH_QU   Ensure that the write has been written to <ReplicationFactor> / 2 + 1 nodes in each datacenter
ORUM      (requires NetworkTopologyStrategy)
ALL       Ensure that the write is written to all N replicas before responding to the client. Any
          unresponsive replicas will fail the operation.
Cassandra - Consistency
  Level - Read
Level     Behavior
ANY       Not supported. You probably want ONE instead.
ONE       Will return the record returned by the first replica to respond. A consistency check is always
          done in a background thread to fix any consistency issues when ConsistencyLevel.ONE is
          used. This means subsequent calls will have correct data even if the initial read gets an older
          value. (This is calledReadRepair)
TWO       Will query 2 replicas and return the record with the most recent timestamp. Again, the
          remaining replicas will be checked in the background.
THREE     Will query 3 replicas and return the record with the most recent timestamp.
QUORUM    Will query all replicas and return the record with the most recent timestamp once it has at least
          a majority of replicas (N / 2 + 1) reported. Again, the remaining replicas will be checked in the
          background.
LOCAL_Q   Returns the record with the most recent timestamp once a majority of replicas within the local
UORUM     datacenter have replied.
EACH_QU   Returns the record with the most recent timestamp once a majority of replicas within each
ORUM      datacenter have replied.
ALL       Will query all replicas and return the record with the most recent timestamp once all replicas
          have replied. Any unresponsive replicas will fail the operation.
Cassandra - Node Internals
● Node comprises
  ○ commit log
    ■ list of pending writes
  ○ memtable
    ■ data written to system resident in memory
  ○ SSTables
    ■ per CF file containing persistent data
● Memtable writes when out of space, too
  many keys or after time period
● SSTables comprise of
  ○ Data - sorted strings
  ○ Index, Bloom Filter
Cassandra - Node Internals
● Compaction occurs from time to time
  ○ cleans up SSTable
  ○ removes redundant rows
  ○ regenerates indexes
Cassandra - Behaviour -
Write
● Write properties:
  ○   No reads
  ○   No seeks
  ○   Fast!
  ○   Atomic within CF
  ○   Always writable
Cassandra - Behaviour -
Read
● Read Path:
  ○   Any node
  ○   Partitioner
  ○   Wait for R responses
  ○   Wait for N-R responses in background and perform
      read repair
● Read Properties:
  ○   Read multiple SSTables
  ○   Slower than writes (but stil fast)
  ○   Seeks can be mitigated with more RAM
  ○   Scales to billions of rows
Cassandra - Gossip
● Gossip protocol used to relay information
  between nodes in cluster
● Proactive communications mechanism to
  share information
  ○ nodes proactively share what they know with
    random other nodes
● Token space information exchanged via
  gossip
● Failure detection based on gossip
  ○ heartbeat mechanism
Thrift API - basic calls
● insert(key, column_parent, column,
    consistency_level)
    ○ key is row/keyspace identifier
    ○ column_parent is either column identifier
       ■ can be column name or super column idenfier
    ○ column is column data
●   get(key, column_path, consistency_level)
    ○ returns a column corresponding to the key
●   get_slice(key, column_parent,
    slice_predicate, consistency_level)
    ○ typically returns set of columns corresponding to key
Thrift API - other
operations
● get multiple rows
● delete row
● batch operations
  ○ important for speeding up system
  ○ can batch up mix of add, insert and delete
    operations
● keyspace and cluster management
Denormalization
● Cassandra requires query oriented design
  ○ determine queries first, design data models
    accordingly
  ○ in contrast to standard RDBMS
     ■ normalize data at design time
     ■ construct arbitrary queries usually based on joins
● Quite fundamental difference in approach
  ○ typically results in quite different data models
● Common use of valueless columns
  ○ column name contains data
    ■ good for time series data
  ○ can have very many columns in given row
Denormalization
● Standard SQL
   ○ SELECT * FROM USER WHERE CITY = 'Dublin'
● Typically create CF which groups users by
  city
   ○ row key is city identifer
   ○ columns are user IDs
● Can get UID of all users in given city by
  querying this CF
   ○ give city as row-key
Other considerations...
● SuperColumnFamily
  ○ when it is useful?
● Multi data centre deployments
  ○ Cassandra can leverage topology to maximize
    resiliency
● Reaction to node failure
● Reconfiguration of system
  ○ introduction of new nodes into existing system


● It is a complex system with many working
  parts

Más contenido relacionado

La actualidad más candente

Cassandra an overview
Cassandra an overviewCassandra an overview
Cassandra an overviewPritamKathar
 
An Overview of Apache Cassandra
An Overview of Apache CassandraAn Overview of Apache Cassandra
An Overview of Apache CassandraDataStax
 
Under the Hood of a Shard-per-Core Database Architecture
Under the Hood of a Shard-per-Core Database ArchitectureUnder the Hood of a Shard-per-Core Database Architecture
Under the Hood of a Shard-per-Core Database ArchitectureScyllaDB
 
The Proxy Wars - MySQL Router, ProxySQL, MariaDB MaxScale
The Proxy Wars - MySQL Router, ProxySQL, MariaDB MaxScaleThe Proxy Wars - MySQL Router, ProxySQL, MariaDB MaxScale
The Proxy Wars - MySQL Router, ProxySQL, MariaDB MaxScaleColin Charles
 
MySQL Load Balancers - Maxscale, ProxySQL, HAProxy, MySQL Router & nginx - A ...
MySQL Load Balancers - Maxscale, ProxySQL, HAProxy, MySQL Router & nginx - A ...MySQL Load Balancers - Maxscale, ProxySQL, HAProxy, MySQL Router & nginx - A ...
MySQL Load Balancers - Maxscale, ProxySQL, HAProxy, MySQL Router & nginx - A ...Severalnines
 
Getting started with MariaDB with Docker
Getting started with MariaDB with DockerGetting started with MariaDB with Docker
Getting started with MariaDB with DockerMariaDB plc
 
Tech Talk: RocksDB Slides by Dhruba Borthakur & Haobo Xu of Facebook
Tech Talk: RocksDB Slides by Dhruba Borthakur & Haobo Xu of FacebookTech Talk: RocksDB Slides by Dhruba Borthakur & Haobo Xu of Facebook
Tech Talk: RocksDB Slides by Dhruba Borthakur & Haobo Xu of FacebookThe Hive
 
Maxscale switchover, failover, and auto rejoin
Maxscale switchover, failover, and auto rejoinMaxscale switchover, failover, and auto rejoin
Maxscale switchover, failover, and auto rejoinWagner Bianchi
 
Oracle db performance tuning
Oracle db performance tuningOracle db performance tuning
Oracle db performance tuningSimon Huang
 
MySQL 初めてのチューニング
MySQL 初めてのチューニングMySQL 初めてのチューニング
MySQL 初めてのチューニングCraft works
 
Your first ClickHouse data warehouse
Your first ClickHouse data warehouseYour first ClickHouse data warehouse
Your first ClickHouse data warehouseAltinity Ltd
 
Modeling Data and Queries for Wide Column NoSQL
Modeling Data and Queries for Wide Column NoSQLModeling Data and Queries for Wide Column NoSQL
Modeling Data and Queries for Wide Column NoSQLScyllaDB
 
Scalability, Availability & Stability Patterns
Scalability, Availability & Stability PatternsScalability, Availability & Stability Patterns
Scalability, Availability & Stability PatternsJonas Bonér
 
Running MariaDB in multiple data centers
Running MariaDB in multiple data centersRunning MariaDB in multiple data centers
Running MariaDB in multiple data centersMariaDB plc
 
Cassandra at eBay - Cassandra Summit 2012
Cassandra at eBay - Cassandra Summit 2012Cassandra at eBay - Cassandra Summit 2012
Cassandra at eBay - Cassandra Summit 2012Jay Patel
 
MySQL 상태 메시지 분석 및 활용
MySQL 상태 메시지 분석 및 활용MySQL 상태 메시지 분석 및 활용
MySQL 상태 메시지 분석 및 활용I Goo Lee
 
Maximizing Amazon EC2 and Amazon EBS performance
Maximizing Amazon EC2 and Amazon EBS performanceMaximizing Amazon EC2 and Amazon EBS performance
Maximizing Amazon EC2 and Amazon EBS performanceAmazon Web Services
 

La actualidad más candente (20)

Cassandra an overview
Cassandra an overviewCassandra an overview
Cassandra an overview
 
An Overview of Apache Cassandra
An Overview of Apache CassandraAn Overview of Apache Cassandra
An Overview of Apache Cassandra
 
Under the Hood of a Shard-per-Core Database Architecture
Under the Hood of a Shard-per-Core Database ArchitectureUnder the Hood of a Shard-per-Core Database Architecture
Under the Hood of a Shard-per-Core Database Architecture
 
The Proxy Wars - MySQL Router, ProxySQL, MariaDB MaxScale
The Proxy Wars - MySQL Router, ProxySQL, MariaDB MaxScaleThe Proxy Wars - MySQL Router, ProxySQL, MariaDB MaxScale
The Proxy Wars - MySQL Router, ProxySQL, MariaDB MaxScale
 
MySQL Load Balancers - Maxscale, ProxySQL, HAProxy, MySQL Router & nginx - A ...
MySQL Load Balancers - Maxscale, ProxySQL, HAProxy, MySQL Router & nginx - A ...MySQL Load Balancers - Maxscale, ProxySQL, HAProxy, MySQL Router & nginx - A ...
MySQL Load Balancers - Maxscale, ProxySQL, HAProxy, MySQL Router & nginx - A ...
 
Amazon Aurora: Under the Hood
Amazon Aurora: Under the HoodAmazon Aurora: Under the Hood
Amazon Aurora: Under the Hood
 
Getting started with MariaDB with Docker
Getting started with MariaDB with DockerGetting started with MariaDB with Docker
Getting started with MariaDB with Docker
 
Tech Talk: RocksDB Slides by Dhruba Borthakur & Haobo Xu of Facebook
Tech Talk: RocksDB Slides by Dhruba Borthakur & Haobo Xu of FacebookTech Talk: RocksDB Slides by Dhruba Borthakur & Haobo Xu of Facebook
Tech Talk: RocksDB Slides by Dhruba Borthakur & Haobo Xu of Facebook
 
Cassandra 101
Cassandra 101Cassandra 101
Cassandra 101
 
Maxscale switchover, failover, and auto rejoin
Maxscale switchover, failover, and auto rejoinMaxscale switchover, failover, and auto rejoin
Maxscale switchover, failover, and auto rejoin
 
Oracle db performance tuning
Oracle db performance tuningOracle db performance tuning
Oracle db performance tuning
 
MySQL 初めてのチューニング
MySQL 初めてのチューニングMySQL 初めてのチューニング
MySQL 初めてのチューニング
 
Your first ClickHouse data warehouse
Your first ClickHouse data warehouseYour first ClickHouse data warehouse
Your first ClickHouse data warehouse
 
Deep Dive on Amazon Aurora
Deep Dive on Amazon AuroraDeep Dive on Amazon Aurora
Deep Dive on Amazon Aurora
 
Modeling Data and Queries for Wide Column NoSQL
Modeling Data and Queries for Wide Column NoSQLModeling Data and Queries for Wide Column NoSQL
Modeling Data and Queries for Wide Column NoSQL
 
Scalability, Availability & Stability Patterns
Scalability, Availability & Stability PatternsScalability, Availability & Stability Patterns
Scalability, Availability & Stability Patterns
 
Running MariaDB in multiple data centers
Running MariaDB in multiple data centersRunning MariaDB in multiple data centers
Running MariaDB in multiple data centers
 
Cassandra at eBay - Cassandra Summit 2012
Cassandra at eBay - Cassandra Summit 2012Cassandra at eBay - Cassandra Summit 2012
Cassandra at eBay - Cassandra Summit 2012
 
MySQL 상태 메시지 분석 및 활용
MySQL 상태 메시지 분석 및 활용MySQL 상태 메시지 분석 및 활용
MySQL 상태 메시지 분석 및 활용
 
Maximizing Amazon EC2 and Amazon EBS performance
Maximizing Amazon EC2 and Amazon EBS performanceMaximizing Amazon EC2 and Amazon EBS performance
Maximizing Amazon EC2 and Amazon EBS performance
 

Similar a Cassandra overview

An Introduction to Apache Cassandra
An Introduction to Apache CassandraAn Introduction to Apache Cassandra
An Introduction to Apache CassandraSaeid Zebardast
 
Introduction to Apache Cassandra
Introduction to Apache Cassandra Introduction to Apache Cassandra
Introduction to Apache Cassandra Knoldus Inc.
 
On Rails with Apache Cassandra
On Rails with Apache CassandraOn Rails with Apache Cassandra
On Rails with Apache CassandraStu Hood
 
Apache cassandra an introduction
Apache cassandra  an introductionApache cassandra  an introduction
Apache cassandra an introductionShehaaz Saif
 
Talk about apache cassandra, TWJUG 2011
Talk about apache cassandra, TWJUG 2011Talk about apache cassandra, TWJUG 2011
Talk about apache cassandra, TWJUG 2011Boris Yen
 
Talk About Apache Cassandra
Talk About Apache CassandraTalk About Apache Cassandra
Talk About Apache CassandraJacky Chu
 
Apache Cassandra at the Geek2Geek Berlin
Apache Cassandra at the Geek2Geek BerlinApache Cassandra at the Geek2Geek Berlin
Apache Cassandra at the Geek2Geek BerlinChristian Johannsen
 
Cassandra for mission critical data
Cassandra for mission critical dataCassandra for mission critical data
Cassandra for mission critical dataOleksandr Semenov
 
Cassandra Talk: Austin JUG
Cassandra Talk: Austin JUGCassandra Talk: Austin JUG
Cassandra Talk: Austin JUGStu Hood
 
The Hows and Whys of a Distributed SQL Database - Strange Loop 2017
The Hows and Whys of a Distributed SQL Database - Strange Loop 2017The Hows and Whys of a Distributed SQL Database - Strange Loop 2017
The Hows and Whys of a Distributed SQL Database - Strange Loop 2017Alex Robinson
 
How Optimizely (Safely) Maximizes Database Concurrency.pdf
How Optimizely (Safely) Maximizes Database Concurrency.pdfHow Optimizely (Safely) Maximizes Database Concurrency.pdf
How Optimizely (Safely) Maximizes Database Concurrency.pdfScyllaDB
 
Cassandra sharding and consistency (lightning talk)
Cassandra sharding and consistency (lightning talk)Cassandra sharding and consistency (lightning talk)
Cassandra sharding and consistency (lightning talk)Federico Razzoli
 
Introduction to Cassandra
Introduction to CassandraIntroduction to Cassandra
Introduction to Cassandrashimi_k
 

Similar a Cassandra overview (20)

An Introduction to Apache Cassandra
An Introduction to Apache CassandraAn Introduction to Apache Cassandra
An Introduction to Apache Cassandra
 
Introduction to Apache Cassandra
Introduction to Apache Cassandra Introduction to Apache Cassandra
Introduction to Apache Cassandra
 
Cassandra
CassandraCassandra
Cassandra
 
Cassandra
CassandraCassandra
Cassandra
 
On Rails with Apache Cassandra
On Rails with Apache CassandraOn Rails with Apache Cassandra
On Rails with Apache Cassandra
 
Apache cassandra an introduction
Apache cassandra  an introductionApache cassandra  an introduction
Apache cassandra an introduction
 
Talk about apache cassandra, TWJUG 2011
Talk about apache cassandra, TWJUG 2011Talk about apache cassandra, TWJUG 2011
Talk about apache cassandra, TWJUG 2011
 
Talk About Apache Cassandra
Talk About Apache CassandraTalk About Apache Cassandra
Talk About Apache Cassandra
 
Cassandra training
Cassandra trainingCassandra training
Cassandra training
 
Cassandra
CassandraCassandra
Cassandra
 
Apache Cassandra at the Geek2Geek Berlin
Apache Cassandra at the Geek2Geek BerlinApache Cassandra at the Geek2Geek Berlin
Apache Cassandra at the Geek2Geek Berlin
 
Cassandra for mission critical data
Cassandra for mission critical dataCassandra for mission critical data
Cassandra for mission critical data
 
Cassandra Talk: Austin JUG
Cassandra Talk: Austin JUGCassandra Talk: Austin JUG
Cassandra Talk: Austin JUG
 
The Hows and Whys of a Distributed SQL Database - Strange Loop 2017
The Hows and Whys of a Distributed SQL Database - Strange Loop 2017The Hows and Whys of a Distributed SQL Database - Strange Loop 2017
The Hows and Whys of a Distributed SQL Database - Strange Loop 2017
 
Intro to cassandra
Intro to cassandraIntro to cassandra
Intro to cassandra
 
How Optimizely (Safely) Maximizes Database Concurrency.pdf
How Optimizely (Safely) Maximizes Database Concurrency.pdfHow Optimizely (Safely) Maximizes Database Concurrency.pdf
How Optimizely (Safely) Maximizes Database Concurrency.pdf
 
Cassandra sharding and consistency (lightning talk)
Cassandra sharding and consistency (lightning talk)Cassandra sharding and consistency (lightning talk)
Cassandra sharding and consistency (lightning talk)
 
Introduction to Cassandra
Introduction to CassandraIntroduction to Cassandra
Introduction to Cassandra
 
Cassandra1.2
Cassandra1.2Cassandra1.2
Cassandra1.2
 
Apache Kafka
Apache KafkaApache Kafka
Apache Kafka
 

Más de Sean Murphy

Más de Sean Murphy (8)

Hadoop pig
Hadoop pigHadoop pig
Hadoop pig
 
Demonstration
DemonstrationDemonstration
Demonstration
 
Overview of no sql
Overview of no sqlOverview of no sql
Overview of no sql
 
No sql course introduction
No sql course   introductionNo sql course   introduction
No sql course introduction
 
Rss talk
Rss talkRss talk
Rss talk
 
Rss announcements
Rss announcementsRss announcements
Rss announcements
 
Rocco pres-v1
Rocco pres-v1Rocco pres-v1
Rocco pres-v1
 
UCD Android Workshop
UCD Android WorkshopUCD Android Workshop
UCD Android Workshop
 

Último

CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 

Último (20)

CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 

Cassandra overview

  • 2. Outline ● History/motivation ● Semi structured data in Cassandra ○ CFs and SuperCFs ● Architecture of Cassandra system ○ Distribution of content ○ Replication of content ○ Consistency level ○ Node internals ○ Gossip ● Thrift API ● Design patterns - denormalization
  • 3. History/motivation ● Initially developed by facebook for Inbox Search ○ in late 2007/early 2008 ● Designed for ○ node failure - commodity hardware ○ scale - can increase number of nodes easily to accommodate increasing demand ○ fast write access while delivering good read performance ● Combination of Bigtable and Dynamo ● Was operational for over 2 years ○ Dropped in favour of HBase
  • 4. History/motivation ● Released as open source in July 2008 ● Apache liked it ○ Became Apache Incubator project in March 2009 ○ Became Apache top level project in Feb 2010 ● Active project with releases every few months ○ currently on version 1.1 ■ production ready, but still evolving
  • 5. Why it's interesting (in this context)... ● Has seen significant growth in last couple of years ● Enough deployments to be credible ○ Netflix, Ooyala, Digg, Cisco, ● Is scalable and robust enough for big data problems ○ no single point of failure ● Complex system ○ perhaps excessively complex today
  • 6. Cassandra - semi structured data ● Column based database ○ has similarities to standard RDBMS ● Terminology: ○ Keystore -> database ○ ColumnFamily -> table
  • 7. Cassandra - semi structured data ● No specific schema is required ○ although it is possible to define schema ■ can include typing information for parts of schema to minimize data integrity problems ● Rows can have large numbers of columns ○ limit on number of columns is 2B ● Column values should not exceed some MB ● SuperColumns are columns embedded within columns ○ third level in a map ○ little discussion of SC here
  • 9. Cassandra - secondary indexing ● Columns can be indexed ○ so-called 'secondary indexing' ■ row keys form the primary index ● Some debate abt the merits of secondary indexing in cassandra ○ secondary indexing is an atomic operation ■ unlike alternative 'manual' indexing approach ○ causes change in thinking regarding NoSQL design ■ very similar to classical RDBMS thinking
  • 10. Cassandra Architecture ● Cluster configuration typical ● All nodes peers ○ although there are some seeds which should be more reliable, larger nodes ● Peers have common view of tokenspace ○ tokenspace is a ring ■ of size 2^127 ○ peers have responsibility for some part of ring ■ ie some range of tokens within ring ● Row key/keyspace mapped to token ○ used to determine which node is responsible for row data
  • 11. Cassandra - Cluster and Tokenspace
  • 12. Cassandra - Data Distribution ● Map from RowKey to token determines data distribution ● RandomPartitioner is most important map ○ generates MD5 hash of rowkey ○ distributes data evenly over nodes in cluster ○ highly preferred solution ○ constraint that it is not possible to iterate over rows ● OrderedPartitioner ○ generates token based on simply byte mapping of row key ○ most probably results in uneven distribution of data ○ can be used to iterate over rows
  • 13. Cassandra - Data Replication ● Multiple levels of replication supported ○ can support arbitrary level of replication ○ replication factors specified per keyspace ● Two replication strategies ○ RackUnaware ■ Make replicas in next n nodes along token ring ○ RackAware ■ Makes one replica in remote data centre ■ Make remaining replicas in next nodes along token ring ● good ring configuration should result in diversity over data centres
  • 14. Cassandra - Consistency Level ● A mechanism to trade off latency with data consistency ○ Write case: ■ Faster response <-> less sure data written properly ○ Read case: ■ Faster response <-> less sure most recent data read ● Related to data replication above ○ replication factor determines meaningful levels for consistency level
  • 15. Cassandra - Consistency Level - Write Level Behavior ANY Ensure that the write has been written to at least 1 node, including HintedHandoff recipients. ONE Ensure that the write has been written to at least 1 replica's commit log and memory table before responding to the client. TWO Ensure that the write has been written to at least 2 replica's before responding to the client. THREE Ensure that the write has been written to at least 3 replica's before responding to the client. QUORUM Ensure that the write has been written to N / 2 + 1 replicas before responding to the client. LOCAL_Q Ensure that the write has been written to <ReplicationFactor> / 2 + 1 nodes, within the local UORUM datacenter (requires NetworkTopologyStrategy) EACH_QU Ensure that the write has been written to <ReplicationFactor> / 2 + 1 nodes in each datacenter ORUM (requires NetworkTopologyStrategy) ALL Ensure that the write is written to all N replicas before responding to the client. Any unresponsive replicas will fail the operation.
  • 16. Cassandra - Consistency Level - Read Level Behavior ANY Not supported. You probably want ONE instead. ONE Will return the record returned by the first replica to respond. A consistency check is always done in a background thread to fix any consistency issues when ConsistencyLevel.ONE is used. This means subsequent calls will have correct data even if the initial read gets an older value. (This is calledReadRepair) TWO Will query 2 replicas and return the record with the most recent timestamp. Again, the remaining replicas will be checked in the background. THREE Will query 3 replicas and return the record with the most recent timestamp. QUORUM Will query all replicas and return the record with the most recent timestamp once it has at least a majority of replicas (N / 2 + 1) reported. Again, the remaining replicas will be checked in the background. LOCAL_Q Returns the record with the most recent timestamp once a majority of replicas within the local UORUM datacenter have replied. EACH_QU Returns the record with the most recent timestamp once a majority of replicas within each ORUM datacenter have replied. ALL Will query all replicas and return the record with the most recent timestamp once all replicas have replied. Any unresponsive replicas will fail the operation.
  • 17. Cassandra - Node Internals ● Node comprises ○ commit log ■ list of pending writes ○ memtable ■ data written to system resident in memory ○ SSTables ■ per CF file containing persistent data ● Memtable writes when out of space, too many keys or after time period ● SSTables comprise of ○ Data - sorted strings ○ Index, Bloom Filter
  • 18. Cassandra - Node Internals ● Compaction occurs from time to time ○ cleans up SSTable ○ removes redundant rows ○ regenerates indexes
  • 19. Cassandra - Behaviour - Write ● Write properties: ○ No reads ○ No seeks ○ Fast! ○ Atomic within CF ○ Always writable
  • 20. Cassandra - Behaviour - Read ● Read Path: ○ Any node ○ Partitioner ○ Wait for R responses ○ Wait for N-R responses in background and perform read repair ● Read Properties: ○ Read multiple SSTables ○ Slower than writes (but stil fast) ○ Seeks can be mitigated with more RAM ○ Scales to billions of rows
  • 21. Cassandra - Gossip ● Gossip protocol used to relay information between nodes in cluster ● Proactive communications mechanism to share information ○ nodes proactively share what they know with random other nodes ● Token space information exchanged via gossip ● Failure detection based on gossip ○ heartbeat mechanism
  • 22. Thrift API - basic calls ● insert(key, column_parent, column, consistency_level) ○ key is row/keyspace identifier ○ column_parent is either column identifier ■ can be column name or super column idenfier ○ column is column data ● get(key, column_path, consistency_level) ○ returns a column corresponding to the key ● get_slice(key, column_parent, slice_predicate, consistency_level) ○ typically returns set of columns corresponding to key
  • 23. Thrift API - other operations ● get multiple rows ● delete row ● batch operations ○ important for speeding up system ○ can batch up mix of add, insert and delete operations ● keyspace and cluster management
  • 24. Denormalization ● Cassandra requires query oriented design ○ determine queries first, design data models accordingly ○ in contrast to standard RDBMS ■ normalize data at design time ■ construct arbitrary queries usually based on joins ● Quite fundamental difference in approach ○ typically results in quite different data models ● Common use of valueless columns ○ column name contains data ■ good for time series data ○ can have very many columns in given row
  • 25. Denormalization ● Standard SQL ○ SELECT * FROM USER WHERE CITY = 'Dublin' ● Typically create CF which groups users by city ○ row key is city identifer ○ columns are user IDs ● Can get UID of all users in given city by querying this CF ○ give city as row-key
  • 26. Other considerations... ● SuperColumnFamily ○ when it is useful? ● Multi data centre deployments ○ Cassandra can leverage topology to maximize resiliency ● Reaction to node failure ● Reconfiguration of system ○ introduction of new nodes into existing system ● It is a complex system with many working parts