ADVANCED DATABASES CIS 6930 Dr. Markus Schneider

Similar documents
Axway API Management 7.5.x Cassandra Best practices. #axway

CS 655 Advanced Topics in Distributed Systems

Big Data Development CASSANDRA NoSQL Training - Workshop. November 20 to (5 days) 9 am to 5 pm HOTEL DUBAI GRAND DUBAI

Spotify. Scaling storage to million of users world wide. Jimmy Mårdell October 14, 2014

Outline. Introduction Background Use Cases Data Model & Query Language Architecture Conclusion

Cassandra- A Distributed Database

CISC 7610 Lecture 2b The beginnings of NoSQL

Certified Apache Cassandra Professional VS-1046

Intro Cassandra. Adelaide Big Data Meetup.

Glossary. Updated: :00

June 20, 2017 Revision NoSQL Database Architectural Comparison

Cassandra Design Patterns

Migrating to Cassandra in the Cloud, the Netflix Way

Cassandra - A Decentralized Structured Storage System. Avinash Lakshman and Prashant Malik Facebook

Big Data Infrastructure CS 489/698 Big Data Infrastructure (Winter 2017)

Goal of the presentation is to give an introduction of NoSQL databases, why they are there.

Infrastructures for Cloud Computing and Big Data

Cassandra Database Security

DEMYSTIFYING BIG DATA WITH RIAK USE CASES. Martin Schneider Basho Technologies!

Tools for Social Networking Infrastructures

Column-Family Databases Cassandra and HBase

Distributed File Systems II

Eventual Consistency 1

Getting to know. by Michelle Darling August 2013

We are ready to serve Latest Testing Trends, Are you ready to learn?? New Batches Info

CSE-E5430 Scalable Cloud Computing Lecture 9

Scylla Open Source 3.0

CIB Session 12th NoSQL Databases Structures

Bigtable. Presenter: Yijun Hou, Yixiao Peng

Big Data Infrastructure CS 489/698 Big Data Infrastructure (Winter 2016)

Extreme Computing. NoSQL.

Exploring Cassandra and HBase with BigTable Model

Making Non-Distributed Databases, Distributed. Ioannis Papapanagiotou, PhD Shailesh Birari

Distributed PostgreSQL with YugaByte DB

Big Data Analytics. Rasoul Karimi

Compactions in Apache Cassandra

Migrating Oracle Databases To Cassandra

NoSQL Databases MongoDB vs Cassandra. Kenny Huynh, Andre Chik, Kevin Vu

NoSQL systems. Lecture 21 (optional) Instructor: Sudeepa Roy. CompSci 516 Data Intensive Computing Systems

Architekturen für die Cloud

Topics. Big Data Analytics What is and Why Hadoop? Comparison to other technologies Hadoop architecture Hadoop ecosystem Hadoop usage examples

PROFESSIONAL. NoSQL. Shashank Tiwari WILEY. John Wiley & Sons, Inc.

How do we build TiDB. a Distributed, Consistent, Scalable, SQL Database

NOSQL EGCO321 DATABASE SYSTEMS KANAT POOLSAWASD DEPARTMENT OF COMPUTER ENGINEERING MAHIDOL UNIVERSITY

Cloud Computing and Hadoop Distributed File System. UCSB CS170, Spring 2018

Cassandra, MongoDB, and HBase. Cassandra, MongoDB, and HBase. I have chosen these three due to their recent

4. Managing Big Data. Cloud Computing & Big Data MASTER ENGINYERIA INFORMÀTICA FIB/UPC. Fall Jordi Torres, UPC - BSC

Chapter 24 NOSQL Databases and Big Data Storage Systems

CSE 444: Database Internals. Lectures 26 NoSQL: Extensible Record Stores

10. Replication. Motivation

The NoSQL Ecosystem. Adam Marcus MIT CSAIL

Compaction strategies in Apache Cassandra

BigTable. Chubby. BigTable. Chubby. Why Chubby? How to do consensus as a service

Servers fail, who cares? (Answer: I do, sort of) Gregg Ulrich, #netflixcloud #cassandra12

BIG DATA AND CONSISTENCY. Amy Babay

NoSQL Databases. Amir H. Payberah. Swedish Institute of Computer Science. April 10, 2014

Shen PingCAP 2017

A Non-Relational Storage Analysis

CISC 7610 Lecture 5 Distributed multimedia databases. Topics: Scaling up vs out Replication Partitioning CAP Theorem NoSQL NewSQL

Apache Cassandra. Tips and tricks for Azure

Stages of Data Processing

Big Data Hadoop Course Content

Bigtable: A Distributed Storage System for Structured Data By Fay Chang, et al. OSDI Presented by Xiang Gao

Webinar Series TMIP VISION

Hadoop An Overview. - Socrates CCDH

Accelerate MySQL for Demanding OLAP and OLTP Use Cases with Apache Ignite. Peter Zaitsev, Denis Magda Santa Clara, California April 25th, 2017

ΕΠΛ 602:Foundations of Internet Technologies. Cloud Computing

Datacenter replication solution with quasardb

Hadoop 2.x Core: YARN, Tez, and Spark. Hortonworks Inc All Rights Reserved

Challenges for Data Driven Systems

NoSQL Database Comparison: Bigtable, Cassandra and MongoDB CJ Campbell Brigham Young University October 16, 2015

Jargons, Concepts, Scope and Systems. Key Value Stores, Document Stores, Extensible Record Stores. Overview of different scalable relational systems

A Fast and High Throughput SQL Query System for Big Data

Ghislain Fourny. Big Data 5. Column stores

SCALABLE CONSISTENCY AND TRANSACTION MODELS

Using space-filling curves for multidimensional

Typical size of data you deal with on a daily basis

CPSC 426/526. Cloud Computing. Ennan Zhai. Computer Science Department Yale University

ExaminingCassandra Constraints: Pragmatic. Eyes

CS November 2017

Facebook. The Technology Behind Messages (and more ) Kannan Muthukkaruppan Software Engineer, Facebook. March 11, 2011

Bigtable: A Distributed Storage System for Structured Data by Google SUNNIE CHUNG CIS 612

Lecture 11 Hadoop & Spark

Data Informatics. Seon Ho Kim, Ph.D.

HDFS: Hadoop Distributed File System. CIS 612 Sunnie Chung

Introduction Aggregate data model Distribution Models Consistency Map-Reduce Types of NoSQL Databases

Managing IoT and Time Series Data with Amazon ElastiCache for Redis

Time Series Storage with Apache Kudu (incubating)

Apache Cassandra-The Data Storage Framework for Hadoop

Oracle NoSQL Database Enterprise Edition, Version 18.1

Comparing SQL and NOSQL databases

A NOVEL APPROACH FOR HOTEL MANAGEMENT SYSTEM USING CASSANDRA

Horizontal or vertical scalability? Horizontal scaling is challenging. Today. Scaling Out Key-Value Storage

Scaling Out Key-Value Storage

BigTable: A Distributed Storage System for Structured Data

Index. Raul Estrada and Isaac Ruiz 2016 R. Estrada and I. Ruiz, Big Data SMACK, DOI /

MongoDB and Mysql: Which one is a better fit for me? Room 204-2:20PM-3:10PM

NoSQL systems: sharding, replication and consistency. Riccardo Torlone Università Roma Tre

Non-Relational Databases. Pelle Jakovits

App Engine: Datastore Introduction

Transcription:

ADVANCED DATABASES CIS 6930 Dr. Markus Schneider Group 2 Archana Nagarajan, Krishna Ramesh, Raghav Ravishankar, Satish Parasaram

Drawbacks of RDBMS Replication Lag Master Slave Vertical Scaling. ACID doesn t always hold good for Big Data. Sharding becomes very difficult. High Availability is complicated.

Why No SQL? Non- Relational. Mostly Open Source. Easy Scalability and High Efficiency. No need to develop a detailed database model. Stores large volumes of data. Capable of performing agile operations. Object oriented programming.

Definition of Cassandra Cassandra is a Distributed High Performance Extremely scalable Fault tolerant Post relational database solution

History Bigtable, 2006 Dynamo, 2007 OpenSource, 2008 Facebook released Cassandra as an open-source project on Google Code in July 2008. In March 2009 it became an Apache Incubator project. On February 17, 2010 it graduated to a top-level project.

How Big is Cassandra Today?

Key Features of Cassandra Distributed and Decentralized. Linear Scalability. Fault Tolerance. Handles huge amounts of data. Horizontal Scaling. Replication. Extremely Fast.

Distributed Architecture: Node Node Reads and Writes Data. Data Storage. Has an array of commands.

Distributed Architecture : Ring Node 1 Node 5 Node 2 Client Node 4 Node 3 41-60 Clustering System. Token Ranges : -2^63 to 2^63-1. Partitioner.

Distributed Architecture: Ring Node 1 Data: 30 Node 5 Node 2 Node 4 41-60 Node 3 Data: 30 Co-ordinator. Four States : Joining, Leaving, Up and Down. Peer to Peer. V nodes.

Distributed Architecture:Gossip Fig 1 Node 5 Node 1 Node 2 Node 5 Node 1 Node 2 Fig 2 Node 4 Node 3 Node 4 Node 3 Information is thus, sent to all the nodes in the cluster. Node 5 Node 1 Node 2 Fig 3 Node 4 Node 3

Distributed Architecture: Gossip Endpoint state Generation = 5 Version = 22 Node 1 Application State: Status = Normal Dc = dc - west Rack = rack1 Schema = c2a2b Load = 100.0 Severity = 0.75

Distributed Architecture: Gossip Digest SYN EP: 127.0.0.1 HB: 100:20 LOAD: 86 EP: 127.0.0.2 HB: 175:40 LOAD: 68 End:Gen:Ver 127.0.0.1 : 100 : 20 127.0.0.2 : 175 : 40 ACK End : Gen : Ver 127.0.0.1 : 100:15 127.0.0.2 : 175:50 EP: 127.0.0.1 HB: 100: 15 LOAD: 86 EP: 127.0.0.2 HB: 175: 50 LOAD: 68 Node 2 Node 1 Node 2

Distributed Architecture: Snitch Determines each node's rack and data center. The topology of the cluster. Configured in Cassandra.yaml. There are mainly 2 groups of snitches. They are as follows: 1) Cloud Based Snitches. 2) Regular Snitches.

Characteristic Features of Cassandra

Replication Factor Similar to MySQL Sharding Point of Failure, Data loss Node reboot, network failure, Power loss, natural calamities Update patches What about RF=2? Simple Strategy Client Create KEYSPACE socialdata With REPLICATION = { class : SimpleStrategy, replication_factor : 1 }

Replication Factor Node 5 Node1 Node 2 Data replicated to 3 nearby nodes Node can be down Is RF=3 better than RF=2? Odd values of RF better RF = 3 used in production Client Node 4 Node 3 41-60

Replication Factor XNode 5 Node1 New Coordinator Node 2 Node 3, Node 5 are down Coordinator is down All nodes equally likely to be coordinator New coordinator randomly selected Data fetched from Node 4 Client Node 4 XNode 3 41-60

Network Topology Strategy

Replication Factor Create KEYSPACE socialdata With REPLICATION = { class = NetworkTopologyStrategy, DC-East : 2, DC-West : 3 } Can lose a node Can lose an entire DC and be online Remote Coordinator High Availability cassandra.yaml Remote Coordinator Coordinator DC-East DC-West

Consistency Levels CL = 1 Coordinator chooses the closest node to respond, acknowledge CL = QUORUM, 51% of replicas to respond back RF = 2, RF = 3 49% of nodes can be down CL = ALL, Strong consistency If any node down, no data Digest, Checksum Consistency Levels in Writes and Reads CL = ALL WRITE, CL = ONE READ RF=3, CL = WRITE QUORUM, READ QUORUM, ATLEAST ONE OVERLAP RF=3, CL=QUORUM ACROSS DCs leads to latency

Consistency Levels across data centers Create KEYSPACE socialdata With REPLICATION = { class = NetworkTopologyStrategy, DC-East : 3, DC-West : 2 } CL = LOCAL_QUORUM, QUORUM = latency of 100ms for response Remote Coordinator Coordinator DC-East DC-West

Handoff

Hinted Handoff Hints Node 5 Node1 X Node 2 During Inserts, Updates, Deletes, RF=3 Node 2 is down Inconsistency handled Hints are stored on the Coordinator, Node 5 Node 2 is back up and Resyncs its data cassandra.yaml hinted_handoff default set to 3 hours Node 4 Node 3 41-60

Read Repair Pk,91, Sep 1 2016 5PM RF=3, CL = ALL Select operation Digest and checksum dint match Request for timestamp Update nodes with latest value based on timestamp Pk,95, Sep 1 2016 6PM Pk,95, Sep 1 2016 6PM

Cassandra Write Path Memtable - Partition Key 58 UID3451 Ryan WI 1473323778 Incoming Insert data 1 2 UID5121 Charles TX 1473323770 UID1348 Robert TX 1473323772 UID3451 Ryan WI 1473323778 UID9632 Michael FL 1473323775 Memory 3 Flush Disk SSTable Sorted String Table Commit Log ID1 UID5121 Charles TX 1473323770 ID2 UID1348 Robert TX 1473323772 ID3 UID3451 Ryan WI 1473323778 ID4 UID9632 Michael FL 1473323775 Writes to disk

Cassandra Write Path Memtable Partition Key 58 Updates Deletes Tombstones gc_grace_seconds Memory UID2101 Kevin FL 1473323780 UID2109 Richard FL 1473323782 UID3451 Ryan NY 1473323788 UID2191 Steven CA 1473323785 Flushed Disk SSTable 1 ID1 UID5121 Charles TX 1473323770 ID2 UID1348 Robert TX 1473323772 ID3 UID3451 Ryan WI 1473323778 ID4 UID9632 Michael FL 1473323775 SSTable 2 ID5 UID2101 Kevin FL 1473323780 ID6 UID2109 Richard FL 1473323782 ID7 UID3451 Ryan NY 1473323788 ID8 UID2191 Steven CA 1473323785

Cassandra Read Path 58 SSTable 1 SSTable 2 SSTable 3 Reference : http://www.datastax.com

Cassandra Read Path - SSTable Partition Index Summary Index Reference : http://www.datastax.com

Cassandra Read Path - SSTable Key Cache Reference : http://www.datastax.com

Cassandra Read Path - SSTable 36 92 58 Determines probabilistically if a value is not in a SSTable Gives false positives but zero false negatives Eliminates need to search across multiple SSTables Bloom Filter SSTable 1 SSTable 2 SSTable 3

Compaction SSTable 1 SSTable 2 SSTable 3 Reference : http://www.datastax.com

SSTable 1 Compaction SSTable 2 SSTable 3 Reference : http://www.datastax.com

Compaction Strategy min_sstable_size 50Mb min_threshold 4 Minimum number of SSTables required for compaction max_threshold 32 Maximum number of SSTables allowed for compaction tombstone_compaction_interval 86400secs

CAP Theorem Availability MySQL Cassandra Consistency Partition Tolerance

Data Model

Column Oriented DBs The storage of data is column value wise Column values are mapped back to the row-keys

Column Families Resembles a table in RDBMS Each column family can have more than one column Number of columns can vary for different rows

Column Families

Data Model in Cassandra Hybrid between key-value store and column oriented databases Column family - analog of a RDBMS table Row - identified uniquely by a key, has values as columns, all rows need not have same number of columns

Data Model in Cassandra (..contd) Keyspace - analog of a RDBMS schema, outermost container of data. Number of column families in Keyspace is fixed. Most basic attributes of a Keyspace are - Replication factor, Replica placement strategy

Data Distribution Rows are partitioned through a partition key which is the first component of a primary key Two ways to partition: Random Ordered

CQL (Cassandra Query Language) Way to interact with Cassandra Syntax is very similar to that of SQL, but far less capable No joins, no subqueries

Queries Create Keyspace - CREATE KEYSPACE users WITH CREATE KEYSPACE KeySpace Name WITH replication = {'class': Strategy name, 'replication_factor' : No.Of replicas }; Consistency - CONSISTENCY QUORUM Capture - CAPTURE dest_file.txt Source - SOURCE myfile.txt Copy - COPY airplanes (name, mach, year, manufacturer) TO 'temp.csv'

Monitoring Cassandra Cluster Java Management Extension(JMX) can be used to monitor Cassandra cluster Several JMX compliant tools are available

Applications

When to use Cassandra Highly scalable. Reliable cross-datacenter replication Excellent choice for real-time Analytics workload. Faster write operations Higher insertion rates Can be integrated with Hadoop, Hive and Apache Spark for Batch Processing Tunable Consistency and CAP parameters.

Throughput comparison Throughput for workload Read/Write Throughput for workload Read/Scan/Write

Tradeoffs Read latency for workload Read/Write Write latency for workload Read/Write

Drawbacks of Cassandra Transactions are not supported (ACID or otherwise) Eventual consistency isn t sufficient always. Eg : Trading stocks. No support for ad-hoc queries Cannot perform complex queries

Connecting applications to Cassandra : Drivers Drivers help connect the applications to Cassandra database Driver languages : o Python o Java o C o C++ o Ruby o And many more. (Refer http://www.planetcassandra.org/apache-cassandra-client-drivers/ ) API s are similar for all the languages

Setup Create a cluster object Use the cluster to obtain a session Session manages all the connections to the cluster #connect to the cluster and the keyspace sample from cassandra.cluster import Cluster cluster= Cluster() session=cluster.connect( sample ) Session object listens to the changes in the cluster and the driver reacts to the same

NetFlix - Challenges faced : Single datacenter meant single point of failure Users grew exponentially And every 2 weeks, the site was down for maintenance

What was required? More reliable and fault tolerant data storage High availability of member information, streaming quality video data in a more robust fashion Flexibility of streaming the video data from multiple devices

What Cassandra offered? Created better business agility for Netflix. No downtime as there are no schemas. No fear of data loss because replication means no single point of failure. Open-source model provided Netflix the flexibility to implement their own backup, recovery system and replication strategy

Instagram : Shift from Redis to Cassandra Memory limitations!! Cut the costs to the point where they were paying around a quarter of what they were paying before. Primarily used for fraud detection, newsfeed and inbox

Facebook : Why Cassandra Operational Requirement : Performance, Reliability, Efficiency, High Scalability, Fault Tolerance. Cross datacenter replication Designed to address the storage needs of inbox search problem. Provided high write throughput Exploited the timestamp property provided by Cassandra

Facebook : Shift from Cassandra to HBase Eventual consistency model not suitable for the new messenger. Hbase simpler consistency model High scalability and performance, auto load balancing. Hadoop widely used by Facebook and HDFS being the distributed file system for both Hadoop and Hbase.