Presentation is loading. Please wait.

Presentation is loading. Please wait.

CloudAnt: Database as a Service (DBaaS)

Similar presentations


Presentation on theme: "CloudAnt: Database as a Service (DBaaS)"— Presentation transcript:

1 CloudAnt: Database as a Service (DBaaS)
Some Basic Idea to start with cloudant development Mansura Habiba

2 Agenda Different Components of Cloudant
Document Structure for Cloudant Single Big Document Concept Map/ Reduce in Cloudnat Implement 1:m relation without Big single document Some SQL Aggregate functions Replication Consistancy Management in CloudAnt Attachment(s) to document

3 Different Component of cloudant Architecture
It Provides fundamental component for DBaaS

4 Document Structure for Cloudant
Documents are stored as Json Documents and View can be accessed through API The One single document for all related information for the an Entity 1:m Relation in a single document

5 Single Big Document Concept
The Concept is - all child document will be inside the parent document as array. Such as comments in this example Why not recommnded usually? Very long document Complex structure HTTP 409 conflict error if multiple client process start editing same document. E.g in this example multiple client start adding comment to the same blog post , the single document might return 409 Too much redandancy blog comments { "_id": “user01", “name": “…", "author": "john", "title": "My blog post", "content": "Bla bla bla …", "comments": [ {"author": "jack", "content": "…"}, {"author": "jane", "content": "…"} ] } Is this a good idea? It can be, if: Not to big document and performance is manageable by using views. The information in the inner document only appears there and does not need to be duplicated into other documents, or such duplication is acceptable for your application. For example, if you wanted to rename the "couchdb" skill to "couchdb / cloudant", you would have to update it in all employee documents. The document does not get updated concurrently. If it does, there will likely be unnecessary conflicts that will need to be resolved by the application. It is called “The everything-in-one-document approach”

6 Map/Reduce in Cloudant
“MapReduce is a software framework introduced by Google to support distributed computing on large data sets on clusters of computers.” Used by cloudant to implement views Just a framework / pattern: You can implement “any” algorithm using map-reduce. Map and reduce functions are custom .Specially its just similar to the query in relational database in order to create a view Reduce is optional, plain view serves as a document index

7 Map /Reduce in Cloudant (Cont...)

8 Using Map/Reduce to implement 1:m relation without Big single document (1/3)
Use case: A number of student have different courses from a number of courses Relation : 1 course: m students Query: list of students who has registered for course_1 For Example, Student and have been registered for course 1

9 List of students who have registered for course_1
Using Map/Reduce to implement 1:m relation without Big single document (3/3) List of students who have registered for course_1

10 How to Link Document in Cloudant
There is no ensured inter document consistency in cloudant List IDs of related documents in document (1:m) one document contains the ids of other documents

11 Using Map/Reduce to implement 1:m relation without Big single document (2/3)
Map/Reduce function to achieve the goal Query to achieve the goal

12 Some SQL Aggregate functions using cloudant Map/Reduce (1/5)
Count: How many course a student has been registered against

13 Some SQL Aggregate functions using cloudant Map/Reduce (2/5)
sum : The total marks that obtain in different courses

14 Some SQL Aggregate functions using cloudant Map/Reduce (3/5)
avg: The average marks that obtain in different courses Reduce Function Map Function

15 Some SQL Aggregate functions using cloudant Map/Reduce (3/5 cont...)

16 Some SQL Aggregate functions using cloudant Map/Reduce (4/5)
max: The maximum marks that obtain among all courses Reduce Function Map Function

17 Some SQL Aggregate functions using cloudant Map/Reduce (5/5)
min: The minimum marks that obtain among all courses Map Function Reduce Function

18 Replication Consistancy Management in CloudAnt
eventually consistent If the application performs a document write or update, followed immediately by a read of the same document, older document content is retrieved. Only the leader are allowed for data write operation, Replica nodes replicate data from the leader leader replica Replicas = # of nodes storing replica Writes = # of nodes that confirm a commit Reads= # of nodes that are contacted at a read operation Strongly consistent Writes + Reads > Replicas replica replica Cloudant is eventually consistent rather than strongly consistent.

19 Attachment(s) to document
Single inline attachment Multiple inline attachment If ?attachments=true is added to the query , it will return resulted documents along with attachments Elastic search has an implementation for creating search index in attachment but I am afraid that’s not an option for CDP 

20 Reference https://docs.cloudant.com/api.html
internet-connected-apps-with-db2-and-informix-cover things-apps-bluemix-cloudant-for-designing-iot-apps

21 Some libraries to access cloudant API for development
Cloudant is also available as an IBM Bluemix service


Download ppt "CloudAnt: Database as a Service (DBaaS)"

Similar presentations


Ads by Google