the no sql principles and basic application of casandra model

30
The NoSQL Principles The NoSQL Principles & & Basic Application of Basic Application of Cassandra Model Cassandra Model Reshmi Radhakrishnan Reshmi Radhakrishnan S7 CS B S7 CS B Roll NO:71 Roll NO:71 Guided by, Guided by, Dr.Sudheep Elayidom Dr.Sudheep Elayidom SOE CUSAT SOE CUSAT

Upload: rishikese-mr

Post on 16-Jul-2015

186 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: The No SQL Principles and Basic Application Of Casandra Model

The NoSQL Principles The NoSQL Principles &&

Basic Application of Basic Application of Cassandra ModelCassandra Model

Reshmi RadhakrishnanReshmi RadhakrishnanS7 CS BS7 CS BRoll NO:71Roll NO:71

Guided by,Guided by,Dr.Sudheep ElayidomDr.Sudheep ElayidomSOE CUSATSOE CUSAT

Page 2: The No SQL Principles and Basic Application Of Casandra Model

AGENDAAGENDA

• INTRODUCTION

• RDBMS

• CHALLENGE

• NoSQL

• COMMON CONCEPTS

• CLASSIFICATION

• CASSANDRA

• CASSANDRA CHARACTERISTICS

• CONCLUSION

• REFERENCES

Page 3: The No SQL Principles and Basic Application Of Casandra Model

INTRODUCTION

* RDBMS is the predominant technology for storing structured data in web and business applications.

* The relational database systems have little capability to horizontally scale.

* NoSQL approach includes simplicity of design, horizontal scaling and finer control over availability

* Cassandra is the right NoSQL database when you need scalability and high availability without compromising performance

Page 4: The No SQL Principles and Basic Application Of Casandra Model

RDBMS

MERITS:

• Rich language• Easy to use and integrate• Rich toolset • Vertical scaling

• The promise: ACIDo Atomicityo Consistencyo Isolationo Durability

Page 5: The No SQL Principles and Basic Application Of Casandra Model

RDBMS

DEMERTS:

• Vertical scaling is highly expensive

• Fails to handle large amount of data

• It is not much efficient in cloud conceptThe read-write rates of data in RDBMS are very poor

So it is hard to face the challenges from the modern web applications using RDBMS

Page 6: The No SQL Principles and Basic Application Of Casandra Model

The Challenge: Modern web apps

• Internet-scale data size• High read-write rates• Frequent schema changes

• "social" apps - not bankso They don't need the same

level of ACID

SCALING

Page 7: The No SQL Principles and Basic Application Of Casandra Model

NoSQL

• Uses horizontal scaling

• Distribute data over many servers

• It give up ACID property

• Based on CAP -theorem

Page 8: The No SQL Principles and Basic Application Of Casandra Model

Brewer's CAP Theorem:

You can only choose two

Page 9: The No SQL Principles and Basic Application Of Casandra Model

CAPConsistency:

A distributed system is considered to be consistent if after an update operation of some writer, all readers see his updates in some shared data sources

Availability:

System is designed in a way that continue operation even if nodes in a cluster crash

Partition Tolerance:

Ability of a system to continue operation in the presence of network partition

Page 10: The No SQL Principles and Basic Application Of Casandra Model

COMMON CONCEPTS

•Sharding

•Consistent hashing

•Map reduce

Page 11: The No SQL Principles and Basic Application Of Casandra Model

SHARDING

• it's a partitioning mechanism

• records are stored in different servers according to some key

• records that are accesses/updated together reside on same node

• load is almost evenly distributed among servers

• vertical partitioning: parts of single records are stored on different servers

Page 12: The No SQL Principles and Basic Application Of Casandra Model

Constant Hashing

• A,B,C:- NODES

• 1,2,3,4:- OBJECTS

-> both are placed in ring

->movement is clockwise

->nodes can leave the system

->nodes can enter into the system

Page 13: The No SQL Principles and Basic Application Of Casandra Model

MAP REDUCE

•Used in distributed computig

• map function

• reduce function

• process on key/value

Page 14: The No SQL Principles and Basic Application Of Casandra Model

Existing NOSQL Solutions

Page 15: The No SQL Principles and Basic Application Of Casandra Model

Classification of NOSQL data stores

• Document Orientedo CouchDB, MongoDB, Lotus Notes, SimpleDB

• Key-Value orientedo Voldemort, Dynamo, Riak (sort of), Redis, Tokyo

• Column orientedo Cassandra, HBase, BigTable

• Graph Databases orientedo Neo4J, FlockDB, DEX, AlegroGraph

Page 16: The No SQL Principles and Basic Application Of Casandra Model

• Developed at facebook

• Follows the BigTable Data Model - column oriented

• Follows the Dynamo Eventual Consistency model

• Opensourced at Apache

• Implemented in Java

Page 17: The No SQL Principles and Basic Application Of Casandra Model

• Distributed Storage System• Manages structured data and scale to large

size

Page 18: The No SQL Principles and Basic Application Of Casandra Model

Data Model

• Instance of Cassandra – Consists of one table represent multidimensional map indexed by a key

• Query for information: get(keyspace, column family, row key)

• Keyspace:- top level unit of information, Column families are subordinate of one key space

• Column :- atomic unit of information, expressed as: name:value

• Super Column :- groups together like columns with a common name,

Used for modeling complex data types (address)

Page 19: The No SQL Principles and Basic Application Of Casandra Model

Data ModelROW FAMILY

• uniquely identifiable data• groups column and super column• Every row are identified by row key

COLUMN FAMILY

• It have to be define in advance before a cluster of servers in Cassandra instance is launched

• It consists of keyed rows which groups columns and super columns

• Column and super column added dynamically to column families and they are not restricted in numbers

Page 20: The No SQL Principles and Basic Application Of Casandra Model

Write Path

Page 21: The No SQL Principles and Basic Application Of Casandra Model

MEMTABLES

• In-memory representation of recently written data• When the table is full, it's sorted and then flushed to disk -> sstable

SS TABLESSorted Strings Tables• Unchangeable • On-disk• Sorted by a string key• In-memory index of elements• Binary search (in memory) to find element location• Bloom filter to reduce number of unneeded binary searches.

WRITE PROPERTIES• No Locks in the critical path• Always available to writes, even if there are failures. No seeks • Fast • Atomic within a Row

Page 22: The No SQL Principles and Basic Application Of Casandra Model

Read Path

Page 23: The No SQL Principles and Basic Application Of Casandra Model

Read Properteis

• Read multiple SSTables • Slower than writes (but still fast) • Seeks can be mitigated with more RAM• Uses probabilistic bloom filters to reduce lookups.• Extensive optional caching

o Key Cacheo Row Cache

Page 24: The No SQL Principles and Basic Application Of Casandra Model

Bloom Filters

• Space efficient probabilistic data structure• Test whether an element is a member of a set• Union and intersection are implemented as bitwise OR, AND

Page 25: The No SQL Principles and Basic Application Of Casandra Model

CREATE INDEX CREATE CUSTOM INDEX IF NOT EXISTS index_nameON keyspace_name.table_name ( KEYS (column_name) )( USING class_name ) ( WITH OPTIONS = map )Restrictions:USING class_name is allowed only if CUSTOM is used andclass_name is a string literal containing a java class name.index_name is an identifier, enclosed or not enclosed in doublequotation marks, excluding reserved words.map is described in ALTER KEYSPACE.CREATE KEYSPACE CREATE ( KEYSPACE | SCHEMA ) IF NOT EXISTS keyspace_nameWITH REPLICATION = mapAND DURABLE_WRITES = ( true | false )

QUERIES EXAMPLES

Page 26: The No SQL Principles and Basic Application Of Casandra Model

MySQL Comparison

• MySQL : for 50 GB Data Writes Average : ~300 ms Reads Average : ~350 ms

• Cassandra: for 50 GB Data Writes Average : 0.12 ms Reads Average : 15 ms

Page 27: The No SQL Principles and Basic Application Of Casandra Model

CONCLUSION

•NoSQL is highly efficient concept for dealing large amount of data.

•It can be used to solve big data problem.

•Cassandra model can provide fast reading and writing operations •So this database model is used by all the latest social networking medias

Page 28: The No SQL Principles and Basic Application Of Casandra Model

REFERENCES

**The NoSQL Principles and Basic Application of Cassandra Model

Guoxi Wang ; Jianfeng Tang

Computer Science & Service System (CSSS), 2012 International Conference on

Digital Object Identifier: 10.1109/CSSS.2012.336

Publication Year: 2012 , Page(s): 1332 - 1335

IEEE CONFERENCE PUBLICATIONS

**Survey on NoSQL database

Jing Han ; Haihong, E. ; Guan Le ; Jian Du

Pervasive Computing and Applications (ICPCA), 2011 6th InternationalConferenceon

Digital Object Identifier: 10.1109/ICPCA.2011.6106531

Publication Year: 2011 , Page(s): 363 - 366

Cited by: Papers (2)

IEEE CONFERENCE PUBLICATIONS

Page 29: The No SQL Principles and Basic Application Of Casandra Model

Questions?Questions?

Page 30: The No SQL Principles and Basic Application Of Casandra Model