SlideShare ist ein Scribd-Unternehmen logo
1 von 42
Downloaden Sie, um offline zu lesen
PYCON INDIA 2012

                         Pycassa – Python
                          Cassandrified
28-30th September 2012            Ramesh Rajini
   Dharmaram Vidya               Infosys Limited,
       Kshetram          Education & Research, Bangalore
 Bangalore, Karnataka
Session Plan
•   Need & Introduction to NoSQL DB
•   Cassandra Introduction
•   Data model creation
•   Pycassa in action
Heard of NO - SQL?
•   Stands for Not Only SQL
•   Class of non-relational data storage systems
•   No fixed table schema
•   No Joins!
•   Relax one or more of the ACID properties & will
    implement BASE & CAP Theorem!
Do we “REALLY” need them ?



                    •   RDBMS …So strong
                    •   so crisp
                    •   so vast
                    •   And WE know it well!
Trends shrends!


 – Gartner‟s 10 key IT trends for 2012
    • unstructured data will grow some 80% over the
      course of the next five years




                       5
What made some apps go No-SQLized?
•   Explosion of social media sites with large data needs
•   Open-source community
•   Upsurge of cloud-based solutions
•   Migration to dynamically-typed languages
RDBMS..hmmm
• Normalization => Joins => Slow Queries /Complications
• Consistency => locks /transactions => Performance issues in
  distributed environments
• Scalability becomes a mess as our apps grow in size and
  demand
Current Approach to Scalability
•   Add hardware
•   Upgrade hardware
•   More machines
•   Turn off unwanted services
•   Caching
•   De-normalize…
RDBMS ..tends to



   Massive [terabytes]

   Elastic scalability

   Easily achieve Fault tolerance

   Tunable Consistency
But Why..


 • ACID
 • - transaction slow under heavy load
 • - in distributed /replicated environment = 2 phase
   commit => infinite wait by either NODE or Coordinator
But RDBMS is still holding up!!
•   Yes..it is
•   Will continue to Co-exist with NOSQL
•   What if data is no more a problem to me!
•   What new problems will I like to have?
Seeds of NoSQL
• Three major papers
   – BigTable (Google)
   – Dynamo (Amazon)
      • Gossip protocol (discovery and error detection)
      • Distributed key-value data store
      • Eventual consistency
   – CAP Theorem
Brewer’s CAP Theorem
• Properties of a system:
   – Consistency
   – Availability
   – Partitions
Brewer’s CAP Theorem
• You can have it good, you can have it fast, you can have
  it cheap: pick two




                          14
BASE Vs ACID - Eventual Consistency
• No updates for a long duration => eventually all updates
  will propagate through the system => all the nodes will
  be consistent
• Any given accepted update and a given node, eventually
  either the update reaches the node or the node is
  removed from service
• Known as BASE (Basically Available, Soft state,
  Eventual consistency)
What kinds of NoSQL
• 2 Major areas:
   – Key/Value or „the big hash table‟.
      • Dynamo
      • Voldemort
      • Scalaris
   – Schema-less
      • column-based, document-based or graph-based.
          –   Cassandra (column-based)
          –   CouchDB (document-based)
          –   Neo4J (graph-based)
          –   HBase (column-based)
Any users?
Cassandra to the Rescue!
  – , source,
  Open

  Distributed, Decentralized,

  Elastically scalable

  Highly available / fault-tolerant

  Tune ably consistent

  Column-oriented database

  Automatic sharding

  Gossip Architecture




                         18
Distributed and Decentralized




        Can be running             Decentralized
        on multiple                • that there is no single
        machines                     point of failure.
        • appearing to users as    • All the nodes in
          single instance            cluster function
                                     exactly the same
                                     [server symmetry]




                              19
Elastic Scalability


• Vertical scaling :
   – more hardware capacity /memory


• Horizontal scaling :
      • More machines that have all or some
        of the data
      • So that no machine is bearing the
        complete load



                         20
Elastic Scalability , No single point failure
• Elastic scalability :
   – Cluster will be able to scale up & down
• Master Slave issue




                          21
Scale UP & Scale down

• Add nodes and they can start serving clients!
   – NO server restart / NO query change / NO
     balancing
   – JUST add an another machine.
• Just unplug the system.
   – Since cassandra has multiple copies of the same
     data in more than one node [configurable] there
     wont be any loss of data.
High Availability and Fault Tolerance
• High availability + central server based system = problem
   – Internal Hard ware redundancy
   – Sounds cool but Extremely Costly




                         23
High Availability and Fault Tolerance
  – Cassandra allows to :
     • replace failed nodes in with no downtime
     • replicate data to multiple data centers to prevent
       downtime [automatic]
Tuneable Consistency
• Consistency : All Reads return the most recently written
  value
   – Cassandra is “eventually consistent” model by
     default.




                          25
But then!


 • Amazon, Facebook, Google, Twitter which uses this
   model.
    – DATA is their main sales item
    – High performance!
Setting up Apache Cassandra
• From the DataStax community Project
   – www.datastax.com/download
• From the Apache Cassandra project:
   – http://cassandra.apache.org/


                  Believe it.. It‟s easy to
                     install & set up!
Keyspace & Column Family creation



 Column family 1
Key1            ColumnName1           ColumnName2
                Value                 Value
Key2            ColumnName1           ColumnName2
                Value                 Value
Key3            ColumnName1           ColumnName2     ColumnName3
                Value                 Value           Value

 Column family 2
 Key1   ColumnName1           ColumnName2     ColumnName3
        Value                 Value           Value
Data makes sense..



 Column family Close Friends
 010051         Mail id                tweets
                Ramesh_Rajini          Hello
 010052         Mail id                tweets
                Vinz_Raj               I‟m logged in!
 010053         Mail id                tweet1              tweet2
                Ragh_Rao               Hey, how r u ?      Movie..

  Column family Colleagues
 020061   Mail id               City               Likes
          Puru_lal              Bangalore          Ladoos!
Cassandra Data Structure



 key space

   Ex:
            column family
  Colony
  Name,
 UserIDs,
              Ex:
            Address,    column
 EmpIDs     Tweets,
             Likes,      name    value   timestamp
            Skill Set
Key-in the Key space..




                         31
Pycassa in action!
Multi-level Dictionary

  {“FriendsInfo”:          Keyspace
         {“closefriends”:          Column Family
     Key        {010053: OrderedDict(
                       [(“MailId”:“Ragh_Rao”),
  Columns              (“tweet1”:“Hey, how r u ?”),
                       (“tweet2”: “Movie..”)])

                OrderedDict(
                     ..
   }}                    ColumnKeys         ColumnValues
Can I insert in bulk?
• Yes, luckily as an ordered dict..
 col_fam.batch_insert(
{'010054': {'Name': 'Vinayak', 'Id': „9308'},
 '010057': {'Name': 'Poorvi'}
})
__________________________________
for i in range(1000, 1010):
... col_fam.insert('EmpIDs', {str(i): 'Hello'})

                                      34
Is the data stored?
• With Key , get all details:
 col_fam.get('010052')
        OrderedDict
        ([('Maild', 'Vinz_Raj'), ('tweets', 'Im loggedin!')])

• With Key, get specific details:
 col_fam.get('010053', columns=['MaiID', 'tweet2'])
         OrderedDict([('tweet2', 'Movie..')])
• Specifying start & end columns:
  col_fam.get('EmpIDs', column_start='1002', column_finish='1006')
           OrderedDict([('1002', 'Hello'), ('1003', 'Hello'), ('1004', 'Hello'),
           ('1005', 'Hello'), ('1006', 'Hello')])


                                                   35
Can the columns be sliced?
• Specifying the reverse way
    col_fam.get('EmpIDs', column_reversed=True, column_count=3)
    OrderedDict([('1009', 'Hello'), ('1008', 'Hello'), ('1007', 'Hello')])
• Fetching multiple rows
    col_fam.multiget(['010053', '010051'])
    OrderedDict(
    [('010053',
    OrderedDict([('Maild', 'Ragh_Rao'), ('tweet1', 'Hey, how r u?'),
                      ('tweet2', 'Movie..')])),
    ('010051',
    OrderedDict([('Mailid', 'Ramesh_Rajini'), ('tweets', 'Hello')]))])

                                                   36
Counting..
• get_count()
   Count the number of columns in the row with key .
• multiget_count()
   Perform a column count in parallel on a set of rows.
   Similar parameters as for multiget(), except that a list
    of keys may be used.
   A dictionary of the form {key: int} is returned.




                                       37
What Next?
• Explore more on Pycassa modules..
   – http://pycassa.github.com/pycassa/api/index.html
• Start using it.. I‟m sure you‟ll enjoy because it is simply
  superb!




                                         38
Recap
•   Need & Introduction to NoSQL DB
•   Cassandra Introduction
•   Data model creation
•   Pycassa in action




                                      39
References
• Cassandra, The Definitive Guide – O‟reilly
  Publication,Eben Hewitt
• http://www.datastax.com/
• http://pycassa.github.com/pycassa/
• https://github.com/twissandra/twissandra
• https://groups.google.com/forum/?fromgroups#!forum/py
  cassa-discuss




                                    40
Time for R&R?
                - Requests & Responses
Thank you!




      - R&R
                                  Ramesh Rajini


Disclaimer : All logos and images belong to the creator and companies which own them

Weitere ähnliche Inhalte

Was ist angesagt?

Tokyo cassandra conference 2014
Tokyo cassandra conference 2014Tokyo cassandra conference 2014
Tokyo cassandra conference 2014jbellis
 
Advanced Data Modeling with Apache Cassandra
Advanced Data Modeling with Apache CassandraAdvanced Data Modeling with Apache Cassandra
Advanced Data Modeling with Apache CassandraDataStax Academy
 
Apache Cassandra and Drivers
Apache Cassandra and DriversApache Cassandra and Drivers
Apache Cassandra and DriversDataStax Academy
 
Cassandra 3.0 Data Modeling
Cassandra 3.0 Data ModelingCassandra 3.0 Data Modeling
Cassandra 3.0 Data ModelingDataStax 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 CassandraDataStax Academy
 
Cassandra - PHP
Cassandra - PHPCassandra - PHP
Cassandra - PHPmauritsl
 
Apache Cassandra Lesson: Data Modelling and CQL3
Apache Cassandra Lesson: Data Modelling and CQL3Apache Cassandra Lesson: Data Modelling and CQL3
Apache Cassandra Lesson: Data Modelling and CQL3Markus Klems
 
AWS Cloud School | London - Part 2
AWS Cloud School | London - Part 2AWS Cloud School | London - Part 2
AWS Cloud School | London - Part 2Amazon Web Services
 
Cassandra Intro -- TheEdge2012
Cassandra Intro -- TheEdge2012Cassandra Intro -- TheEdge2012
Cassandra Intro -- TheEdge2012robosonia Mar
 
MariaDB Cassandra Interoperability
MariaDB Cassandra InteroperabilityMariaDB Cassandra Interoperability
MariaDB Cassandra InteroperabilityColin Charles
 
MariaDB and Cassandra Interoperability
MariaDB and Cassandra InteroperabilityMariaDB and Cassandra Interoperability
MariaDB and Cassandra InteroperabilityColin Charles
 
On Cassandra Development: Past, Present and Future
On Cassandra Development: Past, Present and FutureOn Cassandra Development: Past, Present and Future
On Cassandra Development: Past, Present and Futurepcmanus
 
C* Summit 2013: Searching for a Needle in a Big Data Haystack by Jason Ruther...
C* Summit 2013: Searching for a Needle in a Big Data Haystack by Jason Ruther...C* Summit 2013: Searching for a Needle in a Big Data Haystack by Jason Ruther...
C* Summit 2013: Searching for a Needle in a Big Data Haystack by Jason Ruther...DataStax Academy
 
Clustrix Database Percona Ruby on Rails benchmark
Clustrix Database Percona Ruby on Rails benchmarkClustrix Database Percona Ruby on Rails benchmark
Clustrix Database Percona Ruby on Rails benchmarkClustrix
 
Time series with apache cassandra strata
Time series with apache cassandra   strataTime series with apache cassandra   strata
Time series with apache cassandra strataPatrick McFadin
 
Developers summit cassandraで見るNoSQL
Developers summit cassandraで見るNoSQLDevelopers summit cassandraで見るNoSQL
Developers summit cassandraで見るNoSQLRyu Kobayashi
 
Run Cloud Native MySQL NDB Cluster in Kubernetes
Run Cloud Native MySQL NDB Cluster in KubernetesRun Cloud Native MySQL NDB Cluster in Kubernetes
Run Cloud Native MySQL NDB Cluster in KubernetesBernd Ocklin
 

Was ist angesagt? (20)

Tokyo cassandra conference 2014
Tokyo cassandra conference 2014Tokyo cassandra conference 2014
Tokyo cassandra conference 2014
 
Advanced Data Modeling with Apache Cassandra
Advanced Data Modeling with Apache CassandraAdvanced Data Modeling with Apache Cassandra
Advanced Data Modeling with Apache Cassandra
 
Apache Cassandra and Drivers
Apache Cassandra and DriversApache Cassandra and Drivers
Apache Cassandra and Drivers
 
Cassandra 3.0 Data Modeling
Cassandra 3.0 Data ModelingCassandra 3.0 Data Modeling
Cassandra 3.0 Data Modeling
 
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 - PHP
Cassandra - PHPCassandra - PHP
Cassandra - PHP
 
Apache Cassandra Lesson: Data Modelling and CQL3
Apache Cassandra Lesson: Data Modelling and CQL3Apache Cassandra Lesson: Data Modelling and CQL3
Apache Cassandra Lesson: Data Modelling and CQL3
 
Mysql all
Mysql allMysql all
Mysql all
 
AWS Cloud School | London - Part 2
AWS Cloud School | London - Part 2AWS Cloud School | London - Part 2
AWS Cloud School | London - Part 2
 
Coursera Cassandra Driver
Coursera Cassandra DriverCoursera Cassandra Driver
Coursera Cassandra Driver
 
Cassandra Intro -- TheEdge2012
Cassandra Intro -- TheEdge2012Cassandra Intro -- TheEdge2012
Cassandra Intro -- TheEdge2012
 
MariaDB Cassandra Interoperability
MariaDB Cassandra InteroperabilityMariaDB Cassandra Interoperability
MariaDB Cassandra Interoperability
 
MariaDB and Cassandra Interoperability
MariaDB and Cassandra InteroperabilityMariaDB and Cassandra Interoperability
MariaDB and Cassandra Interoperability
 
On Cassandra Development: Past, Present and Future
On Cassandra Development: Past, Present and FutureOn Cassandra Development: Past, Present and Future
On Cassandra Development: Past, Present and Future
 
C* Summit 2013: Searching for a Needle in a Big Data Haystack by Jason Ruther...
C* Summit 2013: Searching for a Needle in a Big Data Haystack by Jason Ruther...C* Summit 2013: Searching for a Needle in a Big Data Haystack by Jason Ruther...
C* Summit 2013: Searching for a Needle in a Big Data Haystack by Jason Ruther...
 
Clustrix Database Percona Ruby on Rails benchmark
Clustrix Database Percona Ruby on Rails benchmarkClustrix Database Percona Ruby on Rails benchmark
Clustrix Database Percona Ruby on Rails benchmark
 
Introduction Mysql
Introduction Mysql Introduction Mysql
Introduction Mysql
 
Time series with apache cassandra strata
Time series with apache cassandra   strataTime series with apache cassandra   strata
Time series with apache cassandra strata
 
Developers summit cassandraで見るNoSQL
Developers summit cassandraで見るNoSQLDevelopers summit cassandraで見るNoSQL
Developers summit cassandraで見るNoSQL
 
Run Cloud Native MySQL NDB Cluster in Kubernetes
Run Cloud Native MySQL NDB Cluster in KubernetesRun Cloud Native MySQL NDB Cluster in Kubernetes
Run Cloud Native MySQL NDB Cluster in Kubernetes
 

Andere mochten auch

SwampDragon presentation: The Copenhagen Django Meetup Group
SwampDragon presentation: The Copenhagen Django Meetup GroupSwampDragon presentation: The Copenhagen Django Meetup Group
SwampDragon presentation: The Copenhagen Django Meetup GroupErnest Jumbe
 
Developing Software using Python and Django to solve real life problems
Developing Software using Python and Django to solve real life problemsDeveloping Software using Python and Django to solve real life problems
Developing Software using Python and Django to solve real life problemsamakarudze
 
Music video analysis django django
Music video analysis django djangoMusic video analysis django django
Music video analysis django djangoEughan Wooding
 
Real time web_apps_pycon2012-v1
Real time web_apps_pycon2012-v1Real time web_apps_pycon2012-v1
Real time web_apps_pycon2012-v1Avinash Prasad
 
Real world Django deployment using Chef
Real world Django deployment using ChefReal world Django deployment using Chef
Real world Django deployment using Chefcoderanger
 
Implementing real time web applications with Django
Implementing real time web applications with DjangoImplementing real time web applications with Django
Implementing real time web applications with DjangoKristian Houlberg Øllegaard
 
Life in a Queue - Using Message Queue with django
Life in a Queue - Using Message Queue with djangoLife in a Queue - Using Message Queue with django
Life in a Queue - Using Message Queue with djangoTareque Hossain
 

Andere mochten auch (8)

SwampDragon presentation: The Copenhagen Django Meetup Group
SwampDragon presentation: The Copenhagen Django Meetup GroupSwampDragon presentation: The Copenhagen Django Meetup Group
SwampDragon presentation: The Copenhagen Django Meetup Group
 
Developing Software using Python and Django to solve real life problems
Developing Software using Python and Django to solve real life problemsDeveloping Software using Python and Django to solve real life problems
Developing Software using Python and Django to solve real life problems
 
Music video analysis django django
Music video analysis django djangoMusic video analysis django django
Music video analysis django django
 
Real time web_apps_pycon2012-v1
Real time web_apps_pycon2012-v1Real time web_apps_pycon2012-v1
Real time web_apps_pycon2012-v1
 
Real world Django deployment using Chef
Real world Django deployment using ChefReal world Django deployment using Chef
Real world Django deployment using Chef
 
Real-Time Django
Real-Time DjangoReal-Time Django
Real-Time Django
 
Implementing real time web applications with Django
Implementing real time web applications with DjangoImplementing real time web applications with Django
Implementing real time web applications with Django
 
Life in a Queue - Using Message Queue with django
Life in a Queue - Using Message Queue with djangoLife in a Queue - Using Message Queue with django
Life in a Queue - Using Message Queue with django
 

Ähnlich wie Slide presentation pycassa_upload

Deep Dive into Cassandra
Deep Dive into CassandraDeep Dive into Cassandra
Deep Dive into CassandraBrent Theisen
 
Jan 2015 - Cassandra101 Manchester Meetup
Jan 2015 - Cassandra101 Manchester MeetupJan 2015 - Cassandra101 Manchester Meetup
Jan 2015 - Cassandra101 Manchester MeetupChristopher Batey
 
Cassandra
CassandraCassandra
Cassandraexsuns
 
cassandra_presentation_final
cassandra_presentation_finalcassandra_presentation_final
cassandra_presentation_finalSergioBruno21
 
Cassandra Basics, Counters and Time Series Modeling
Cassandra Basics, Counters and Time Series ModelingCassandra Basics, Counters and Time Series Modeling
Cassandra Basics, Counters and Time Series ModelingVassilis Bekiaris
 
To SQL or NoSQL, that is the question
To SQL or NoSQL, that is the questionTo SQL or NoSQL, that is the question
To SQL or NoSQL, that is the questionKrishnakumar S
 
NoSQL - Cassandra & MongoDB.pptx
NoSQL -  Cassandra & MongoDB.pptxNoSQL -  Cassandra & MongoDB.pptx
NoSQL - Cassandra & MongoDB.pptxNaveen Kumar
 
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019Dave Stokes
 
NoSQL Intro with cassandra
NoSQL Intro with cassandraNoSQL Intro with cassandra
NoSQL Intro with cassandraBrian Enochson
 
Cassandra implementation for collecting data and presenting data
Cassandra implementation for collecting data and presenting dataCassandra implementation for collecting data and presenting data
Cassandra implementation for collecting data and presenting dataChen Robert
 
Appache Cassandra
Appache Cassandra  Appache Cassandra
Appache Cassandra nehabsairam
 
Cassandra
Cassandra Cassandra
Cassandra Pooja GV
 
Vienna Feb 2015: Cassandra: How it works and what it's good for!
Vienna Feb 2015: Cassandra: How it works and what it's good for!Vienna Feb 2015: Cassandra: How it works and what it's good for!
Vienna Feb 2015: Cassandra: How it works and what it's good for!Christopher Batey
 
Use Your MySQL Knowledge to Become an Instant Cassandra Guru
Use Your MySQL Knowledge to Become an Instant Cassandra GuruUse Your MySQL Knowledge to Become an Instant Cassandra Guru
Use Your MySQL Knowledge to Become an Instant Cassandra GuruTim Callaghan
 
MySQL Cluster Scaling to a Billion Queries
MySQL Cluster Scaling to a Billion QueriesMySQL Cluster Scaling to a Billion Queries
MySQL Cluster Scaling to a Billion QueriesBernd Ocklin
 
Cassandra Tutorial
Cassandra TutorialCassandra Tutorial
Cassandra Tutorialmubarakss
 
How & When to Use NoSQL at Websummit Dublin
How & When to Use NoSQL at Websummit DublinHow & When to Use NoSQL at Websummit Dublin
How & When to Use NoSQL at Websummit DublinAmazon Web Services
 
Introduction to cassandra
Introduction to cassandraIntroduction to cassandra
Introduction to cassandraTarun Garg
 
Storage Systems For Scalable systems
Storage Systems For Scalable systemsStorage Systems For Scalable systems
Storage Systems For Scalable systemselliando dias
 

Ähnlich wie Slide presentation pycassa_upload (20)

Deep Dive into Cassandra
Deep Dive into CassandraDeep Dive into Cassandra
Deep Dive into Cassandra
 
Jan 2015 - Cassandra101 Manchester Meetup
Jan 2015 - Cassandra101 Manchester MeetupJan 2015 - Cassandra101 Manchester Meetup
Jan 2015 - Cassandra101 Manchester Meetup
 
Cassandra
CassandraCassandra
Cassandra
 
cassandra_presentation_final
cassandra_presentation_finalcassandra_presentation_final
cassandra_presentation_final
 
Cassandra Basics, Counters and Time Series Modeling
Cassandra Basics, Counters and Time Series ModelingCassandra Basics, Counters and Time Series Modeling
Cassandra Basics, Counters and Time Series Modeling
 
How and when to use NoSQL
How and when to use NoSQLHow and when to use NoSQL
How and when to use NoSQL
 
To SQL or NoSQL, that is the question
To SQL or NoSQL, that is the questionTo SQL or NoSQL, that is the question
To SQL or NoSQL, that is the question
 
NoSQL - Cassandra & MongoDB.pptx
NoSQL -  Cassandra & MongoDB.pptxNoSQL -  Cassandra & MongoDB.pptx
NoSQL - Cassandra & MongoDB.pptx
 
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
 
NoSQL Intro with cassandra
NoSQL Intro with cassandraNoSQL Intro with cassandra
NoSQL Intro with cassandra
 
Cassandra implementation for collecting data and presenting data
Cassandra implementation for collecting data and presenting dataCassandra implementation for collecting data and presenting data
Cassandra implementation for collecting data and presenting data
 
Appache Cassandra
Appache Cassandra  Appache Cassandra
Appache Cassandra
 
Cassandra
Cassandra Cassandra
Cassandra
 
Vienna Feb 2015: Cassandra: How it works and what it's good for!
Vienna Feb 2015: Cassandra: How it works and what it's good for!Vienna Feb 2015: Cassandra: How it works and what it's good for!
Vienna Feb 2015: Cassandra: How it works and what it's good for!
 
Use Your MySQL Knowledge to Become an Instant Cassandra Guru
Use Your MySQL Knowledge to Become an Instant Cassandra GuruUse Your MySQL Knowledge to Become an Instant Cassandra Guru
Use Your MySQL Knowledge to Become an Instant Cassandra Guru
 
MySQL Cluster Scaling to a Billion Queries
MySQL Cluster Scaling to a Billion QueriesMySQL Cluster Scaling to a Billion Queries
MySQL Cluster Scaling to a Billion Queries
 
Cassandra Tutorial
Cassandra TutorialCassandra Tutorial
Cassandra Tutorial
 
How & When to Use NoSQL at Websummit Dublin
How & When to Use NoSQL at Websummit DublinHow & When to Use NoSQL at Websummit Dublin
How & When to Use NoSQL at Websummit Dublin
 
Introduction to cassandra
Introduction to cassandraIntroduction to cassandra
Introduction to cassandra
 
Storage Systems For Scalable systems
Storage Systems For Scalable systemsStorage Systems For Scalable systems
Storage Systems For Scalable systems
 

Kürzlich hochgeladen

Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxCeline George
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...Amil baba
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsKarakKing
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Pooja Bhuva
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxmarlenawright1
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxDr. Ravikiran H M Gowda
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxJisc
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxPooja Bhuva
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17Celine George
 

Kürzlich hochgeladen (20)

Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 

Slide presentation pycassa_upload

  • 1. PYCON INDIA 2012 Pycassa – Python Cassandrified 28-30th September 2012 Ramesh Rajini Dharmaram Vidya Infosys Limited, Kshetram Education & Research, Bangalore Bangalore, Karnataka
  • 2. Session Plan • Need & Introduction to NoSQL DB • Cassandra Introduction • Data model creation • Pycassa in action
  • 3. Heard of NO - SQL? • Stands for Not Only SQL • Class of non-relational data storage systems • No fixed table schema • No Joins! • Relax one or more of the ACID properties & will implement BASE & CAP Theorem!
  • 4. Do we “REALLY” need them ? • RDBMS …So strong • so crisp • so vast • And WE know it well!
  • 5. Trends shrends! – Gartner‟s 10 key IT trends for 2012 • unstructured data will grow some 80% over the course of the next five years 5
  • 6. What made some apps go No-SQLized? • Explosion of social media sites with large data needs • Open-source community • Upsurge of cloud-based solutions • Migration to dynamically-typed languages
  • 7. RDBMS..hmmm • Normalization => Joins => Slow Queries /Complications • Consistency => locks /transactions => Performance issues in distributed environments • Scalability becomes a mess as our apps grow in size and demand
  • 8. Current Approach to Scalability • Add hardware • Upgrade hardware • More machines • Turn off unwanted services • Caching • De-normalize…
  • 9. RDBMS ..tends to Massive [terabytes] Elastic scalability Easily achieve Fault tolerance Tunable Consistency
  • 10. But Why.. • ACID • - transaction slow under heavy load • - in distributed /replicated environment = 2 phase commit => infinite wait by either NODE or Coordinator
  • 11. But RDBMS is still holding up!! • Yes..it is • Will continue to Co-exist with NOSQL • What if data is no more a problem to me! • What new problems will I like to have?
  • 12. Seeds of NoSQL • Three major papers – BigTable (Google) – Dynamo (Amazon) • Gossip protocol (discovery and error detection) • Distributed key-value data store • Eventual consistency – CAP Theorem
  • 13. Brewer’s CAP Theorem • Properties of a system: – Consistency – Availability – Partitions
  • 14. Brewer’s CAP Theorem • You can have it good, you can have it fast, you can have it cheap: pick two 14
  • 15. BASE Vs ACID - Eventual Consistency • No updates for a long duration => eventually all updates will propagate through the system => all the nodes will be consistent • Any given accepted update and a given node, eventually either the update reaches the node or the node is removed from service • Known as BASE (Basically Available, Soft state, Eventual consistency)
  • 16. What kinds of NoSQL • 2 Major areas: – Key/Value or „the big hash table‟. • Dynamo • Voldemort • Scalaris – Schema-less • column-based, document-based or graph-based. – Cassandra (column-based) – CouchDB (document-based) – Neo4J (graph-based) – HBase (column-based)
  • 18. Cassandra to the Rescue! – , source, Open Distributed, Decentralized, Elastically scalable Highly available / fault-tolerant Tune ably consistent Column-oriented database Automatic sharding Gossip Architecture 18
  • 19. Distributed and Decentralized Can be running Decentralized on multiple • that there is no single machines point of failure. • appearing to users as • All the nodes in single instance cluster function exactly the same [server symmetry] 19
  • 20. Elastic Scalability • Vertical scaling : – more hardware capacity /memory • Horizontal scaling : • More machines that have all or some of the data • So that no machine is bearing the complete load 20
  • 21. Elastic Scalability , No single point failure • Elastic scalability : – Cluster will be able to scale up & down • Master Slave issue 21
  • 22. Scale UP & Scale down • Add nodes and they can start serving clients! – NO server restart / NO query change / NO balancing – JUST add an another machine. • Just unplug the system. – Since cassandra has multiple copies of the same data in more than one node [configurable] there wont be any loss of data.
  • 23. High Availability and Fault Tolerance • High availability + central server based system = problem – Internal Hard ware redundancy – Sounds cool but Extremely Costly 23
  • 24. High Availability and Fault Tolerance – Cassandra allows to : • replace failed nodes in with no downtime • replicate data to multiple data centers to prevent downtime [automatic]
  • 25. Tuneable Consistency • Consistency : All Reads return the most recently written value – Cassandra is “eventually consistent” model by default. 25
  • 26. But then! • Amazon, Facebook, Google, Twitter which uses this model. – DATA is their main sales item – High performance!
  • 27. Setting up Apache Cassandra • From the DataStax community Project – www.datastax.com/download • From the Apache Cassandra project: – http://cassandra.apache.org/ Believe it.. It‟s easy to install & set up!
  • 28. Keyspace & Column Family creation Column family 1 Key1 ColumnName1 ColumnName2 Value Value Key2 ColumnName1 ColumnName2 Value Value Key3 ColumnName1 ColumnName2 ColumnName3 Value Value Value Column family 2 Key1 ColumnName1 ColumnName2 ColumnName3 Value Value Value
  • 29. Data makes sense.. Column family Close Friends 010051 Mail id tweets Ramesh_Rajini Hello 010052 Mail id tweets Vinz_Raj I‟m logged in! 010053 Mail id tweet1 tweet2 Ragh_Rao Hey, how r u ? Movie.. Column family Colleagues 020061 Mail id City Likes Puru_lal Bangalore Ladoos!
  • 30. Cassandra Data Structure key space Ex: column family Colony Name, UserIDs, Ex: Address, column EmpIDs Tweets, Likes, name value timestamp Skill Set
  • 31. Key-in the Key space.. 31
  • 33. Multi-level Dictionary {“FriendsInfo”: Keyspace {“closefriends”: Column Family Key {010053: OrderedDict( [(“MailId”:“Ragh_Rao”), Columns (“tweet1”:“Hey, how r u ?”), (“tweet2”: “Movie..”)]) OrderedDict( .. }} ColumnKeys ColumnValues
  • 34. Can I insert in bulk? • Yes, luckily as an ordered dict.. col_fam.batch_insert( {'010054': {'Name': 'Vinayak', 'Id': „9308'}, '010057': {'Name': 'Poorvi'} }) __________________________________ for i in range(1000, 1010): ... col_fam.insert('EmpIDs', {str(i): 'Hello'}) 34
  • 35. Is the data stored? • With Key , get all details: col_fam.get('010052') OrderedDict ([('Maild', 'Vinz_Raj'), ('tweets', 'Im loggedin!')]) • With Key, get specific details: col_fam.get('010053', columns=['MaiID', 'tweet2']) OrderedDict([('tweet2', 'Movie..')]) • Specifying start & end columns: col_fam.get('EmpIDs', column_start='1002', column_finish='1006') OrderedDict([('1002', 'Hello'), ('1003', 'Hello'), ('1004', 'Hello'), ('1005', 'Hello'), ('1006', 'Hello')]) 35
  • 36. Can the columns be sliced? • Specifying the reverse way col_fam.get('EmpIDs', column_reversed=True, column_count=3) OrderedDict([('1009', 'Hello'), ('1008', 'Hello'), ('1007', 'Hello')]) • Fetching multiple rows col_fam.multiget(['010053', '010051']) OrderedDict( [('010053', OrderedDict([('Maild', 'Ragh_Rao'), ('tweet1', 'Hey, how r u?'), ('tweet2', 'Movie..')])), ('010051', OrderedDict([('Mailid', 'Ramesh_Rajini'), ('tweets', 'Hello')]))]) 36
  • 37. Counting.. • get_count()  Count the number of columns in the row with key . • multiget_count()  Perform a column count in parallel on a set of rows.  Similar parameters as for multiget(), except that a list of keys may be used.  A dictionary of the form {key: int} is returned. 37
  • 38. What Next? • Explore more on Pycassa modules.. – http://pycassa.github.com/pycassa/api/index.html • Start using it.. I‟m sure you‟ll enjoy because it is simply superb! 38
  • 39. Recap • Need & Introduction to NoSQL DB • Cassandra Introduction • Data model creation • Pycassa in action 39
  • 40. References • Cassandra, The Definitive Guide – O‟reilly Publication,Eben Hewitt • http://www.datastax.com/ • http://pycassa.github.com/pycassa/ • https://github.com/twissandra/twissandra • https://groups.google.com/forum/?fromgroups#!forum/py cassa-discuss 40
  • 41. Time for R&R? - Requests & Responses
  • 42. Thank you! - R&R Ramesh Rajini Disclaimer : All logos and images belong to the creator and companies which own them