No sql - { If and Else }


Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • Transaction avalable only for one row. No batching transactions avaliable.Needs middleware to handle transactions for multiple rows
  • No sql - { If and Else }

    1. 1. NoSql<br />Future begins here<br />Author: Marjan Nikolovski<br />Date: 2011-02-03<br />
    2. 2. Content<br />NoSql as movement<br />Pros and Cons<br />Categories<br />Mongo DB showcase<br />Discussion<br />
    3. 3. NoSql as movement<br />“NoSQL is a term used to designate databases that differ from classic relational databases in some way”<br />Schemaless<br />No “joins”<br />
    4. 4. NoSql as movement<br />Schemaless – means everything can be stored without order, type, structure<br /><ul><li>No “joins” – means normalization is not used to relate and retrieve the data</li></li></ul><li>NoSql as movement<br />Invented to cover what RDBMS could not<br />Fast write/read under heavy usage of a system<br />Highly distribution of data<br />Better architecture of distributed systems<br />Fun <br />
    5. 5. Cap Theorem<br />CAP Theorem !!!<br />“It is impossible for a distributed computer system to simultaneously provide all three of the following guarantees:<br /> - Consistency (all nodes see the same data at the same time)<br /> - Availability (node failures do not prevent survivors from continuing to operate)<br /> - Partition Tolerance (the system continues to operate despite arbitrary message loss)<br />According to the theorem, a distributed system can satisfy any two of these guarantees at the same time, but not all three”<br />
    6. 6. Cap Theorem - 2<br />
    7. 7. Pros and Cons - 2<br />PROS<br />Complex objects<br />High-Volume Low-Value data<br />Real-time analysis<br />Online games (MMRPG)<br />Search engines<br />Scalable horizontally(sharding)<br />Redundancy<br />Flexibility<br />Faster development<br />Geospatial<br />CONS<br /><ul><li>Transactions and distributedtransactions
    8. 8. Business Intelligence</li></li></ul><li>Pros and Cons<br />What are we architecting ???<br />What are our options ???<br />Result …<br />
    9. 9. Categories<br />Under NoSql four main categories exists:<br />Key / Value<br />BigTable<br />Document<br />Graph<br />
    10. 10. Categories – Key / Value<br />We can see on this type as distributed hash table<br />Used for caching layers<br />Querying is done by key only<br />Highly distributive<br />Products:<br />Memcached<br />Project Voldemort<br />Amazon Dynamo<br />
    11. 11. Categories - BigTable<br />BigTable are step forward from Key/Value stores<br />There is some order in these stores and querying can be done by more params<br />More like the RDBMS that we now with excluded foreign key concept and with support each row to have different columns<br />Products:<br />Apache Cassandra<br />Apache HBase<br />
    12. 12. Categories – Document<br />Documents stores are json/xml based stores for objects<br />Highly queryable<br />Products<br />MongoDB<br />RavenDB<br />Apache CouchDB<br />
    13. 13. Categories – Graph<br />Graph stores store data in vortex connected with zero or more vortexes.<br />Data is held in hashtable in each node<br />Rich objects are not supported<br />Products<br />Neo4j<br />AllegroGraph<br />InfoGrid<br />
    14. 14. Categories – size/complexity<br />*Complexity = Sophistication of data modeling<br />
    15. 15. Mongo DB showcase - 1<br />What is<br />Document store<br />Fast, scalable and available<br />JSon – used for data hydratation<br />Dynamic<br />Stores data structured as documents instead of row as seen in RDBMS<br />Uses Query, Insert, Update and Remove for data manipulation<br />Used for adding data at high rates without “choking” the system<br />
    16. 16. Mongo DB showcase - 2<br />Internals of <br />Core<br />Map files in memory (virtual) <br />Memory is allocated by namespaces <br />Free space comes at the end of the structure<br />Each document contains a header for traversal and position, body (document data) and padding<br />Replication<br />Master/Slave and Replication sets architecture<br />Both require Master but Replication set vote for new master if the one dedicated for the job is unavailable<br />Cursors<br />Results can be of type cursor which can be iterated until cursor have 0 elements left<br />
    17. 17. Mongo DB showcase - 3<br />Documents in<br />Each document can be of size max to 4mb<br />Each document you insert into MongoDB will be assigned an id consisted of: <br />This is a 12-byte value consisting of 4 parts: timestamp (4 bytes)<br />machine identifier (3 bytes)<br />process id (2 bytes)<br />increment (3 bytes)<br />in MongoDB, each document will contain not only the values, but the key names (~"column names" in relational db-speak) too. So if you have keys: “Username" and “Password", then those alone will add 16 bytes to each document.<br />MongoDB automatically adds some padding to the documents to allow for documents to grow in size to try and reduce the need for documents to be moved around if they do grow<br />
    18. 18. Mongo DB showcase - 4<br />Map reduce and<br />Map/Reduce is done via javascript<br />
    19. 19. Mongo DB showcase - 5<br />Simple usage<br />On win32 start mongod.exe<br />Start mongo.exe test client for testing <br />db.Workers.insert({<br /> _workerId: “936DA01F-9ABD-4d9d-80C7-02AF85C822A8”,<br /> name: “XyZ”,<br /> department: “services”,<br />subdepartment: “.NET”<br />});<br />db.Workers.find({ name: “XyZ” });<br />
    20. 20. Mongo DB showcase - 6<br />Performance analyses <br />
    21. 21. Mongo DB showcase - 7<br />So how can we use it in .NET ??? <br />
    22. 22. Mongo DB showcase - 8<br />Get Mongodb-csharp driver<br /><br />Let’s start<br />
    23. 23. Suggestions<br />Check:<br /> The high scalability blog<br />Apache Cassandra<br />RanvenDB, .Net implementation of document store<br />mysql performance blog<br />CAP theorem<br />
    24. 24. Discussion<br />
    25. 25. Sponsored by<br />