The No SQL Principles and Basic Application Of Casandra Model
-
Upload
rishikese-mr -
Category
Technology
-
view
186 -
download
1
Transcript of The No SQL Principles and Basic Application Of Casandra Model
![Page 1: The No SQL Principles and Basic Application Of Casandra Model](https://reader034.fdocuments.in/reader034/viewer/2022042817/55a6a4551a28ab9a148b4642/html5/thumbnails/1.jpg)
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](https://reader034.fdocuments.in/reader034/viewer/2022042817/55a6a4551a28ab9a148b4642/html5/thumbnails/2.jpg)
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](https://reader034.fdocuments.in/reader034/viewer/2022042817/55a6a4551a28ab9a148b4642/html5/thumbnails/3.jpg)
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](https://reader034.fdocuments.in/reader034/viewer/2022042817/55a6a4551a28ab9a148b4642/html5/thumbnails/4.jpg)
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](https://reader034.fdocuments.in/reader034/viewer/2022042817/55a6a4551a28ab9a148b4642/html5/thumbnails/5.jpg)
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](https://reader034.fdocuments.in/reader034/viewer/2022042817/55a6a4551a28ab9a148b4642/html5/thumbnails/6.jpg)
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](https://reader034.fdocuments.in/reader034/viewer/2022042817/55a6a4551a28ab9a148b4642/html5/thumbnails/7.jpg)
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](https://reader034.fdocuments.in/reader034/viewer/2022042817/55a6a4551a28ab9a148b4642/html5/thumbnails/8.jpg)
Brewer's CAP Theorem:
You can only choose two
![Page 9: The No SQL Principles and Basic Application Of Casandra Model](https://reader034.fdocuments.in/reader034/viewer/2022042817/55a6a4551a28ab9a148b4642/html5/thumbnails/9.jpg)
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](https://reader034.fdocuments.in/reader034/viewer/2022042817/55a6a4551a28ab9a148b4642/html5/thumbnails/10.jpg)
COMMON CONCEPTS
•Sharding
•Consistent hashing
•Map reduce
![Page 11: The No SQL Principles and Basic Application Of Casandra Model](https://reader034.fdocuments.in/reader034/viewer/2022042817/55a6a4551a28ab9a148b4642/html5/thumbnails/11.jpg)
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](https://reader034.fdocuments.in/reader034/viewer/2022042817/55a6a4551a28ab9a148b4642/html5/thumbnails/12.jpg)
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](https://reader034.fdocuments.in/reader034/viewer/2022042817/55a6a4551a28ab9a148b4642/html5/thumbnails/13.jpg)
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](https://reader034.fdocuments.in/reader034/viewer/2022042817/55a6a4551a28ab9a148b4642/html5/thumbnails/14.jpg)
Existing NOSQL Solutions
![Page 15: The No SQL Principles and Basic Application Of Casandra Model](https://reader034.fdocuments.in/reader034/viewer/2022042817/55a6a4551a28ab9a148b4642/html5/thumbnails/15.jpg)
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](https://reader034.fdocuments.in/reader034/viewer/2022042817/55a6a4551a28ab9a148b4642/html5/thumbnails/16.jpg)
• 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](https://reader034.fdocuments.in/reader034/viewer/2022042817/55a6a4551a28ab9a148b4642/html5/thumbnails/17.jpg)
• Distributed Storage System• Manages structured data and scale to large
size
![Page 18: The No SQL Principles and Basic Application Of Casandra Model](https://reader034.fdocuments.in/reader034/viewer/2022042817/55a6a4551a28ab9a148b4642/html5/thumbnails/18.jpg)
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](https://reader034.fdocuments.in/reader034/viewer/2022042817/55a6a4551a28ab9a148b4642/html5/thumbnails/19.jpg)
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](https://reader034.fdocuments.in/reader034/viewer/2022042817/55a6a4551a28ab9a148b4642/html5/thumbnails/20.jpg)
Write Path
![Page 21: The No SQL Principles and Basic Application Of Casandra Model](https://reader034.fdocuments.in/reader034/viewer/2022042817/55a6a4551a28ab9a148b4642/html5/thumbnails/21.jpg)
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](https://reader034.fdocuments.in/reader034/viewer/2022042817/55a6a4551a28ab9a148b4642/html5/thumbnails/22.jpg)
Read Path
![Page 23: The No SQL Principles and Basic Application Of Casandra Model](https://reader034.fdocuments.in/reader034/viewer/2022042817/55a6a4551a28ab9a148b4642/html5/thumbnails/23.jpg)
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](https://reader034.fdocuments.in/reader034/viewer/2022042817/55a6a4551a28ab9a148b4642/html5/thumbnails/24.jpg)
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](https://reader034.fdocuments.in/reader034/viewer/2022042817/55a6a4551a28ab9a148b4642/html5/thumbnails/25.jpg)
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](https://reader034.fdocuments.in/reader034/viewer/2022042817/55a6a4551a28ab9a148b4642/html5/thumbnails/26.jpg)
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](https://reader034.fdocuments.in/reader034/viewer/2022042817/55a6a4551a28ab9a148b4642/html5/thumbnails/27.jpg)
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](https://reader034.fdocuments.in/reader034/viewer/2022042817/55a6a4551a28ab9a148b4642/html5/thumbnails/28.jpg)
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](https://reader034.fdocuments.in/reader034/viewer/2022042817/55a6a4551a28ab9a148b4642/html5/thumbnails/29.jpg)
Questions?Questions?
![Page 30: The No SQL Principles and Basic Application Of Casandra Model](https://reader034.fdocuments.in/reader034/viewer/2022042817/55a6a4551a28ab9a148b4642/html5/thumbnails/30.jpg)