Professional Documents
Culture Documents
Shinto Philip
TOPICS
Big Data NoSQL JSON Introduction to MongoDB
BIG DATA
Big Users
Not that long ago, 1,000 daily users of an application was a lot Today, with the growth in global Internet use, it's not uncommon for apps to have millions of users a day.. The increased number of hours users spend online. The growing popularity of smart phones and tablets.
BIG Data
90% of the data in the world today has been created in the last two years alone.
This data comes from Sensors used to gather climate information Posts to social media sites Digital pictures and videos Purchase transaction records, and. Cell phone GPS signals to name a few.
This data is
big DATA.
BIG Data
BIG Data
Solution????...??
NO SQL
NO SQL
Non relational
Features
Scalability o Vertically Add more data o Horizontally Add more storage No pre-defined schema No join operations(We just have pointers) NoSQL = Not Only SQL No declarative query language more programming Relaxed consistency fewer guarantees
Advantages
Cheap, easy to implement
Data are replicated and can be partitioned. Easy to distribute Can scale up and down Quick process of large amount of data. Can handle web-scale data, whereas Relational DBs cannot.
Why No SQL?
RDBMS
NO SQL
Schema less No need of JOIN operations, primary keys and foreign keys FASTER ACCESS
Example
Scale up
A centralized approach that relies on bigger and bigger servers.
Scale Out
A distributed approach that leverages many standard, commodity physical or virtual servers. NoSQL databases were developed from the ground up to be distributed, scale out databases. Theres no need to modify the application as you scale since the application always sees a single (distributed) database.
scale out
Characteristics
Auto-sharding - If load increases (more storage space, more processing
Integrated caching To reduce latency and increase sustained data throughput, advanced NoSQL database technologies transparently cache data in system memory.
Types of NoSQL
Key-value stores The simplest NoSQL databases. Every single item in the database is stored as an attribute name, or key, together with its value. Examples : Riak, Voldemort, BigTable. Document databases pair each key with a complex data structure known as a document.
Documents can contain many different key-value pairs, or key-array pairs, or even nested documents.
Example: MongoDB
Types of NoSQL
Wide-column stores Cassandra and HBase are optimized for queries over large datasets, and store columns of data together, instead of rows. Graph stores Used to store information about networks, such as social connections. Examples: Neo4J and HyperGraphDB
References
Shinto Philip
What is JSON??
JSON is a data interchange format AJAX: Data transfer without refreshing a page. JSON is a subset of Java Script. JSON can be parsed by a Java Script parser. It can represent either complex or simple data as it has data types They are Strings, Number, Boolean, Objects and Arrays
Comparing
XML <person> <age>12</age> <name>Danielle</name> </person>
Strings
Sequence of 0 or more Unicode characters. No separate character type. A character is represented as a string with a length of 1. Wrapped in "double quotes. Backslash escapement.
Strings
string
"
"
quotation mark reverse solidus solidus backspace formfeed newline carriage return horizontal tab 4 hexadecimal digits
Numbers
Integer Real Scientific
No octal or hex
No NaN or Infinity - Use null instead
Numbers
number
0 .
digit
digit 1 - 9 digit
e E +
digit
-
Booleans
true false
Null
A value that isn't anything
Object
Objects are unordered containers of key/value pairs Objects are wrapped in { } , separates key/value pairs : separates keys and values Keys are strings Values are JSON values
object
{
string
: ,
value
"name": "Jack B. Nimble", "at large": true, "grade": "A", "format": { "type": "rect", "width": 1920, "height": 1080, "interlace": false, "framerate": 24 }
}
Arrays
Arrays are ordered sequences of values Arrays are wrapped in [] , separates values
JSON does not talk about indexing. An implementation can start array indexing at 0 or 1.
value
,
array
[ ]
Arrays:Example
Arrays:Example
JSON has no version number. No revisions to the JSON grammar are anticipated. JSON is very stable.
application/json
More. . .
JSON response at client side is: var name = eval('(' + req.responseText + ')').fullname.value; To access a composite element eval('(' + req.responseText + ')').xyz.abc.value; Thus, any level deep elements can be easily accessed.
References
http://www.mongodb.org/ http://www.mkyong.com/tutorials/java-mongodb-tutorials/
Shinto Philip
Introduction
Open Source database written in C++. DOCUMENT ORIENTED DATABASE Uses a document model, which can be thought of as a row in a RDBMS. Documents, a set of fields (key-value pairs) map nicely to programming language data types. A MongoDB database holds a collection which is a set of documents. Embedded documents and arrays reduce need for joins, which is key for high performance and speed.
Sharding
Insertion
db.tablename.insert({data}) or db.tablename.save({data}).
Update
Delete
db.tablename.remove({criteria})
Fetching
db.tablename.find( {criteria} ).
Example: >db.userdetails.find({"education":"M.C.A."})
References
http://www.mongodb.org/ http://www.mkyong.com/tutorials/java-mongodb-tutorials/