Slide 1

Slide 1 text

Edgar Allan Poe presents The Raven

Slide 2

Slide 2 text

Once upon a midnight dreary, while I pondered, weak and weary, Over many a quaint and curious volume of forgotten lore-- While I nodded, nearly napping, suddenly there came a tapping, As of some one gently rapping, rapping at my chamber door. "'Tis some visiter," I muttered, "tapping at my chamber door-- Only this and nothing more."

Slide 3

Slide 3 text

…just kidding…

Slide 4

Slide 4 text

Jaime González García Enthusiastic Software developer! Works at Medius R&D building a SPA... ... but also started jaimegonzalezgarcia.com Blogs at barbarianmeetscoding.com likes... fantasy sci-fi drawing Malin ???

Slide 5

Slide 5 text

Contents • NoSQL? • What is RavenDB? • RavenDB .NET API • RavenDB REST API • Installing RavenDB • Replication and Sharding

Slide 6

Slide 6 text

Nosql

Slide 7

Slide 7 text

In the beginning… the year 1970 of our Lord … 20 years of kicking ass… Edgar Frank Codd

Slide 8

Slide 8 text

In the beginning…

Slide 9

Slide 9 text

2000 BigTable Dynamo 2009 Nosql

Slide 10

Slide 10 text

What is NoSql today? • Big term used to refer to all non relational DBs (RDMBS’s) • Big hype • In general: • No relational • No schema • High availability and scalability (Web Scale) • Eventual consistency • No SQL (generally) …just like html5… Villaine hipsters!

Slide 11

Slide 11 text

Why Nosql ? Why Document Stores? • Simplicity • Developer friendly • No impedance mismatch (SQL != OOD) • No schema, less friction • Scalability: replication and sharding • Great APIs • Right tool for the job Databases for developers??

Slide 12

Slide 12 text

Why Sql ? :-) • ACID • Consistency • More mature • More Common Competence • Better tooling • Can handle all kinds of queries • SQL

Slide 13

Slide 13 text

Types of nosql databases? Graph Databases http://nosql-database.org/ Wide Column Stores Document Stores Key value Stores

Slide 14

Slide 14 text

Ravendb basics

Slide 15

Slide 15 text

Ravendb • Document Database • No schema • Store objects as JSON documents • Query using LINQ • Built-in REST API Wonderfultastic!

Slide 16

Slide 16 text

Ravendb • ACID document transactions • BASE index querying • Self-optimizes based on usage • High scalability • Replication and sharding out of the box • Safe by default

Slide 17

Slide 17 text

Ravendb Management Studio (RDBMS) • Silverlight application • Access via browser where RavenDB server is hosted

Slide 18

Slide 18 text

Ravendb documents • An object stored in RavenDB is called a document • Documents need not be flat unlike rows in RDBMS • Persisted as JSON

Slide 19

Slide 19 text

Ravendb documents • Documents can be [logically] grouped in collections • Collections are defined as metadata • Indexes filter by collections

Slide 20

Slide 20 text

Ravendb documents • Each document has its own unique document ID • If we try to store two entities with the same id -> overwrite • By convention ID = collectionName/entityId (users/1) • By default entity id’s are generated (auto-incremented)

Slide 21

Slide 21 text

Ravendb documents • Every document has metadata attached

Slide 22

Slide 22 text

Modeling in Ravendb • Documents are not flat, you can store complex structures • RavenDB is not relational • A document is an independent entity • Include all details you need within the document • This is good for sharding • References are not enforced by the DB • If following DDD, an Aggregrate is a document • This pretty much enforces DDD uses of aggregates from the dB • Use aggregate to enforce invariants to store information safely

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

demo Ravendb management studio

Slide 25

Slide 25 text

Ravendb .net api

Slide 26

Slide 26 text

Ravendb .net api • Unit of Work • Change tracking, transactions, batching, etc • Feels like Entity Framework or NHibernate • IDocumentSession (unit of work) • IDocumentStore (session factory, singleton) • Query with LINQ • Works with pure POCOs • Available on NuGet

Slide 27

Slide 27 text

A Poco’s life in Ravendb C# class Public class Raven { public string Name {get;set;} } POCO var myCuteRaven= new Raven {Name = “Kiwi”} (Plain Old CLR Object) Document instantiate ravens/1 { “Name”: “Kiwi” }

Slide 28

Slide 28 text

Ravendb .net api – Querying • Every query uses and index • Static indexes persisted in the DB • Dynamic indexes created on the fly • Based on the queries that you do • Self-optimization based on usage • Eventual Consistency • Stale better than offline • BASE (Basically Available, Soft State, Eventual Consistency)

Slide 29

Slide 29 text

Ravendb .net api – Querying

Slide 30

Slide 30 text

Ravendb .net api – Other cool stuff • Uses Lucene as search engine • Can easily add attachments to documents • Profiling • Fully customizable • cache • Max number of request per session • Key generator • conventions • etc...

Slide 31

Slide 31 text

demo

Slide 32

Slide 32 text

Ravendb Rest api

Slide 33

Slide 33 text

Ravendb Rest api • Documents in RavenDB feel a lot like resources... • Built-in REST api for CRUD operations over documents! You could run your whole single page application against Ravendb!

Slide 34

Slide 34 text

demo Get started with Ravendb Rest api

Slide 35

Slide 35 text

Ravendb Intalling

Slide 36

Slide 36 text

Installing Ravendb • Client-Server • Install and start the service manually • Install as a windows service • Deploy it on IIS • DaaS (Database as a Service) (IaaS ) • Embedded in your .NET Application

Slide 37

Slide 37 text

Installing Ravendb

Slide 38

Slide 38 text

Extend Ravendb via Bundles • Compression • Encryption • Expiration • Versioning • Quotas • Periodic Backups • Authorization • etc http://ravendb.net/docs/2.5/server/extending/bundles

Slide 39

Slide 39 text

demo Installing Ravendb

Slide 40

Slide 40 text

Ravendb With replication and sharding Scaling out

Slide 41

Slide 41 text

Scaling Ravendb • Replication and Sharding out of the box • Sharding • Native • Partition contents of a ravendb database across several machines • Replication • Replicate contents of a ravendb database • As a bundle • Can replicate to SQL Server http://ravendb.net/docs/2.5/server/scaling-out

Slide 42

Slide 42 text

References And code samples

Slide 43

Slide 43 text

Github https://github.com/Vintharas/TheRavenDB https://github.com/Vintharas/BLooDandSTeeL

Slide 44

Slide 44 text

No content

Slide 45

Slide 45 text

Nosql books

Slide 46

Slide 46 text

Ravendb books

Slide 47

Slide 47 text

On NoSql • NoSQL databases Explained • http://www.mongodb.com/learn/nosql • Pluralsight - NoSQL the big picture • http://pluralsight.com/training/Courses/TableOfContents/nosql-big-pic • Pluralsight - Understanding NoSQL • http://pluralsight.com/training/Courses/TableOfContents/understanding-nosql

Slide 48

Slide 48 text

Ravendb documentation • RavenDB Documentation • https://ravendb.net/docs • RavenDB YouTube channel • http://www.youtube.com/playlist?list=PL7E1E1A49999CB0F5

Slide 49

Slide 49 text

No content

Slide 50

Slide 50 text

Ravendb courses • Pluralsight - Introduction to RavenDB • http://pluralsight.com/training/Courses/TableOfContents/ravendb • Pluralsight - A Tour of RavenDB (with Ayende!!) • http://pluralsight.com/training/Courses/TableOfContents/tekpub-ravendb

Slide 51

Slide 51 text

Thank you. y u so sad?!? Thank you!