61
NoSQL Jainul A. Musani (MCA,MPhil,MTech) 05-March- 2014 Wednesday

NoSQL - 05March2014 Seminar

Embed Size (px)

DESCRIPTION

NoSQL seminar

Citation preview

Page 1: NoSQL - 05March2014 Seminar

NoSQL

Jainul A. Musani(MCA,MPhil,MTech)

05-March-2014Wednesday

Page 2: NoSQL - 05March2014 Seminar

2

Page 3: NoSQL - 05March2014 Seminar

What’s Meaning....??

NOT SQL...???

3

Page 4: NoSQL - 05March2014 Seminar

Introduction

• Past Decade – DB Professionals dependent

on RDBMS (Relational Database Systems)

and a single standard supported by all

databases : SQL – Structure Query Language

• Relational Model – E.F.Codd’s 1970.

4

Page 5: NoSQL - 05March2014 Seminar

Introduction

• RDBMS - Table Oriented

Relational Database for_

•Storage of Data

•Retrieval of Data

5

5

Page 6: NoSQL - 05March2014 Seminar

6

6

StaffNo

StaffName

Post Salary BranchNo

BranchAddress

SL21 John White Manager 30,000 B005 22 Deer Rd, London

SG37 Ann Beech Assistant 12,000 B003 163 Main St,Glasgow

SG14 David Ford Supervisor 18,000 B003 163 Main St,Glasgow

SA9 Mary Howe Assistant 9,000 B007 16 Argyll St, Aberdeen

SG5 Susan Brand Manager 24,000 B003 163 Main St,Glasgow

SL41 Julie Lee Assistant 9,000 B005 22 Deer Rd, London

Page 7: NoSQL - 05March2014 Seminar

Introduction• Relational Model more suitable to Client-

Server programming .

• Easier to maintain data and write programming for Relational Model.

• Predominant technology for storing structured data in web and business applications.

7

Page 8: NoSQL - 05March2014 Seminar

Introduction

• Relational Model - relies upon hard-and

fast and Structured rules – ACID rules for

database transactions.

8

Page 9: NoSQL - 05March2014 Seminar

RDBMS

ACID RulesClassical Relational Database

AtomicConsistentIsolatedDurable

Page 10: NoSQL - 05March2014 Seminar

A.C.I.D. Properties

Atomic• A Transaction data modification – either

Completed –or – not perform.

Consistent• At end of Transaction all data in

consistent state.

10

Page 11: NoSQL - 05March2014 Seminar

A.C.I.D. Properties

Isolated• Modification of one data must be independent of another Transaction.

[other wise outcome of result will be erroneous]

Durable• When Transaction completed, modification performed must be permanent in the system.

11

Page 12: NoSQL - 05March2014 Seminar

A.C.I.D. Properties

12

12

Page 13: NoSQL - 05March2014 Seminar

What is NoSQL?

NoSQL

Page 14: NoSQL - 05March2014 Seminar

What is NoSQL...??

Non-relational database management systems,

Different from traditional RDBMS in some significant ways.

14

Page 15: NoSQL - 05March2014 Seminar

What is NoSQL...??

Core of NoSQL database_Hash Function – mathematical

algorithm – take variable length of Input and produce a consistent, fixedlength Output.

Key/Value pair is stored for later retrieval of record.

15

Page 16: NoSQL - 05March2014 Seminar

What is NoSQL...??

Designed for distributed data stores where very large scale of data storing

needs (for example Google or Facebook which collects terabits of data every day for their users).

16

Page 17: NoSQL - 05March2014 Seminar

What is NoSQL...??

These type of data storing may not require fixed schema, avoid join operations and typically scale horizontally.

17

Page 18: NoSQL - 05March2014 Seminar

Scaling...!!!!

Ability of a System to expand to meet business needs.

Ex. Web application – allow more people to use web application

Vertical Scaling Horizontal Scaling

18

Page 19: NoSQL - 05March2014 Seminar

Vertical Scaling...!!!!

Scale Up - add more resources within the same logical unit to increase capacity.

Ex. Add more CPUs / increase memory / add more hard drive

19

Page 20: NoSQL - 05March2014 Seminar

Horizontal Scaling...!!!!

Scale Out - add more nodes to system.

Ex. Add new computer to distributed software application.

In NoSQL system, data store can be much faster as it takes advantage

of “scaling out”

20

Page 21: NoSQL - 05March2014 Seminar

Term NoSQLby Carlo StrozziYear 1998

NoSQL

Page 22: NoSQL - 05March2014 Seminar

Why is NoSQL?

NoSQL

Page 23: NoSQL - 05March2014 Seminar

Why NoSQL ?

In today’s time data is becoming easier to access and capture through third parties such as Facebook, Google+ and others.

23

Page 24: NoSQL - 05March2014 Seminar

Why NoSQL ?

Personal user information, Social graphs, Geo location data, User-generated content and Machine logging data

are just a few examples where the data has been increasing

exponentially.

24

Page 25: NoSQL - 05March2014 Seminar

Why NoSQL ?

To avail the above service properly, it is required to process huge amount of data.

Which SQL databases were never designed. The evolution of NoSql databases is to handle these huge data properly.

25

Page 26: NoSQL - 05March2014 Seminar

26

26

Page 27: NoSQL - 05March2014 Seminar

What’s there in NoSQL ?

Instead of using structured tables to store multiple related attributes in a row, NoSQL databases use the concept of a key/value store.

27

Page 28: NoSQL - 05March2014 Seminar

What’s there in NoSQL ?

No schema for the database. Stores values for each provided

key, distributes them across the database and then allows their efficient retrieval.

28

Page 29: NoSQL - 05March2014 Seminar

What’s there in NoSQL ?

Lack of a schema prevents complex queries and essentially prevents the use of NoSQL as a transactional database environment

29

Page 30: NoSQL - 05March2014 Seminar

RDBMS v/s NoSQL Structured and

organized data Structured

query language-SQL

30

Stands for Not Only SQL

No declarative query language

No predefined schema

Page 31: NoSQL - 05March2014 Seminar

RDBMS v/s NoSQL Data and its

relationships are stored in separate tables.

Data Manipulation Language, Data Definition Language

31

Key-Value pair storage, Column Store, Document Store, Graph databases

Eventual consistency rather ACID property

Page 32: NoSQL - 05March2014 Seminar

RDBMS v/s NoSQL

• Tight Consistency

• BASE Transaction

32

Unstructured and unpredictable data

CAP Theorem Prioritizes high

performance, high availability and scalability

Page 33: NoSQL - 05March2014 Seminar

CAP Theorem(Brewer’s Theorem)

NoSQL

Page 34: NoSQL - 05March2014 Seminar

CAP Theorem

• When designing any distributed system. CAP theorem states that there are three basic requirements which exist in a special relation when designing applications for a distributed architecture.

34

Page 35: NoSQL - 05March2014 Seminar

CAP Theorem

• Consistency - the data in the database remains consistent after the execution of an operation. For example after an update operation all clients see the same data.

35

Page 36: NoSQL - 05March2014 Seminar

CAP Theorem

• Availability - the system is always on (service guarantee availability), no downtime.

36

Page 37: NoSQL - 05March2014 Seminar

CAP Theorem

• Partition Tolerance - the system continues to function even the communication among the servers is unreliable, i.e. the servers may be partitioned into multiple groups that cannot communicate with one another.

37

Page 38: NoSQL - 05March2014 Seminar

CAP Theorem

• In theoretically it is impossible to fulfill all 3 requirements

• CAP provides the basic requirements for a distributed system to follow 2 of the 3 requirements

38

Page 39: NoSQL - 05March2014 Seminar

CAP Theorem• CA - Single site cluster, therefore all

nodes are always in contact. When a partition occurs, the system blocks.

• CP - Some data may not be accessible, but the rest is still consistent/accurate.

• AP - System is still available under partitioning, but some of the data returned may be inaccurate.

39

Page 40: NoSQL - 05March2014 Seminar

CAP Theorem

40

40

Page 41: NoSQL - 05March2014 Seminar

The BASEby Eric Brewer

NoSQL

Page 42: NoSQL - 05March2014 Seminar

The BASE The CAP theorem states that a

distributed computer system cannot guarantee all of the following three properties at the same time:

ConsistencyAvailabilityPartition tolerance

42

Page 43: NoSQL - 05March2014 Seminar

The BASE A BASE system gives up on

consistency. Basically Available indicates

that the system does guarantee availability, in terms of the CAP theorem.

43

Page 44: NoSQL - 05March2014 Seminar

The BASE Soft state indicates that the

state of the system may change over time, even without input. This is because of the eventual consistency model.

44

Page 45: NoSQL - 05March2014 Seminar

The BASE• Eventual consistency indicates

that the system will become consistent over time, given that the system doesn't receive input during that time.

45

Page 46: NoSQL - 05March2014 Seminar

ACID v/s BASE ACID BASEAtomicity Basically Available

Consistency Soft state

Isolation Eventual consistency

Durable

46

Page 47: NoSQL - 05March2014 Seminar

Pros/Cons - NoSQLAdvantages

High ScalabilityDistributed ComputingLower CostSchema FlexibilitySemi-Structured DataNo Complicated Relationship

47

Page 48: NoSQL - 05March2014 Seminar

Pros/Cons - NoSQLDisadvantages

No StandardizationLimited Query CapabilitiesEventual Consistent is not

intuitive to program for

48

Page 49: NoSQL - 05March2014 Seminar

Types of NoSQL

NoSQL

Page 50: NoSQL - 05March2014 Seminar

Categories of NoSQL database1) Document Oriented:

Data is stored as documents. An example format may be like - FirstName="Arun", Address="St. Xavier's Road", Spouse=[{Name:"Kiran"}], Children=[{Name:"Rihit", Age:8}]

50

Page 51: NoSQL - 05March2014 Seminar

51

CouchDB, Jackrabbit, MongoDB, OrientDB, SimpleDB,Terrastore

Page 52: NoSQL - 05March2014 Seminar

Categories of NoSQL database2) XML database:

Data is stored in XML format.BaseX, eXist, MarkLogic Server etc.

52

Page 53: NoSQL - 05March2014 Seminar

Categories of NoSQL database3) Graph databases:

Data is stored as a collection of nodes, where nodes are analogous to objects in a programming language. Nodes are connected using edges.

53

Page 54: NoSQL - 05March2014 Seminar

54

AllegroGraph, DEX, Neo4j, FlockDB, Sones GraphDB

Page 55: NoSQL - 05March2014 Seminar

Categories of NoSQL database4) Key-value store:

In Key-value-store category of NoSQL database, an user can store data in schema-less way. A key may be strings, hashes, lists, sets, sorted setssorted sets and values are stored against these keys.

55

Page 56: NoSQL - 05March2014 Seminar

56

Cassandra, Riak, Redis, memcached, BigTable etc.

Page 57: NoSQL - 05March2014 Seminar

Production deployment There is a large number of

companies using NoSQL. Google, Facebook, Mozilla,

Adobe, Foursquare, LinkedIn, Digg, McGraw-Hill Education, Vermont Public Radio

57

Page 58: NoSQL - 05March2014 Seminar

Market & Business RoadMap of NoSQL

NoSQL

Page 59: NoSQL - 05March2014 Seminar

59

Page 60: NoSQL - 05March2014 Seminar

60

Page 61: NoSQL - 05March2014 Seminar

That’s All for NoSQL

Thank You…!!!

NoSQL